I'm building a personal bibliography on my site and like most academics, I have my default display by type. However, within each type, the publications are sorted by title rather than by year. In fact, I cannot really think of a scenario where the title would be the preferable secondary sort rather than author or year.

Would it be possible to have that as an option in the settings? I would even be willing to go to the inadvisable inconvenience of hacking the biblio.pages.inc but couldn't figure out how to do it with my meager PHP/SQL skills.

Comments

This is a long standing feature request which (with a bit of luck) I will try to get into the 1.0 release.

Ron.

I second this request, this feature is one of the last missing for our academic needs, too!

Status:Active» Fixed

Done.

It's hard coded right now, but I'll work on making user configurable.

Ron.

Thanks Ron, I really do believe this is a default that will make sense for most people. Is it in dev now? I can't wait to test it on my site.

Dominik

Version:6.x-1.0-rc2» 6.x-1.0-rc5

It hasn't been checked in yet (the site was down most of the day yesterday) look for it later today.

Ok, it's been committed to the -dev version.

Ron.

OK, I checked the -dev version, and it seems there is a side-effect (or an other bug?)

In previous version, selecting sorting by publication type would make the types appear in this order : book, book chapter, journal article, conference paper...

but now, the order is more like : book, conference paper, journal article.

It seems the type are now order by alphabetical order, but the previous sorting was by publication type id and was better (for me and most academics, I believe...)

Indeed, they are sorted alphabetically (which, although might not fit your desires, is probably more understandable)

I could put an option to sort by type ID or Name.

That would be great!

Status:Fixed» Needs review
StatusFileSize
new1.28 KB

Ok, here is a patch (against head) that does it!

Thanks for this Ron. I installed it on my system and it works just as advertised.

Re option to sort by ID or name, wouldn't it be better to make it possible to assign weights to the reference types? I solved the sorting problem by going into the database and changing the names of the types but I'm afraid that might have a knock on effect later on. And I assume the IDs need to stay constant. But it might be too much work to solve a relatively marginal problem.

That's a good idea, and they actually already have "weight" values, you just can't see them or change them :-(

If I add "table drag" to "admin/settings/biblio/fields/type" then you could just rearrange them to your hearts content.

Ron.

Will this also work as "sort by year, within year by (weighted) type"? Because our main sort is by year on the global publication list, but within the years we would like to chose a sort-by-type order.

What I wonder is if we can also get this for inline calls. When I call biblio_db_search with two order options, only the last one is taken. Using sth. like biblio_db_search('order', 'year,type') doesn't work. If biblio could evaluate more complex order elements it would be possible to do sth. like biblio_db_search('order', 'year,field(biblio_type,102,100,205)') reaching what you plan with the drag&drop.

Do you think this is possible or would parsing be too complicated? Maybe some syntatic sugar like ('order', 'year', 'and_order', 'field...')?

Note: I'm currently using the following patch for my site:

--- biblio.pages.inc.orig       2009-02-12 03:33:28.000000000 +0100
+++ biblio.pages.inc    2009-02-24 09:57:03.000000000 +0100
@@ -361,6 +361,10 @@
     $where[] = 'n.status = 1 ';
   }//show only published entries to everyone except admin
+  $alter_params = array(&$args);
+  $alter_params['__drupal_alter_by_ref'] = array(&$where, &$published,
+                                                &$limit, &$sortby, &$sort_attrib);
+  drupal_alter('biblio_build_query', $alter_params);
   $joins = implode(' ', $join);
   $where_clause = count($where) > 1 ? '('. implode(') AND (', $where) .')': $where[0];

This allows any module implementing <module>_biblio_build_query_alter(...) to change the query to do thinks like that. Adding the field sort option etc. is simple, so I can provide the field option to my users. This might help people who need sth. like this in case you don't see chances to implement this in biblio itself.

Hi Frank,

Some good ideas here, and I think it may be time to completely re-think/write the query building.

Also, FYI, it has come to my attention recently that some of these "sub-sorts" are absolutely killing large (40K+) databases. Especially if there are opposing sort orders (one is DESC and one is ASC) also the title sorts are a killer. The bottom line is that some may want sub-sorting to be optional. (See #306014: biblio causing massive use of resources)

I see... Maybe an additional "sort" tab like the "filter" tab that allows to add sort criterias one after another? While still having the basic sort options on the main page... Because it seems like adding sort options is very much like adding filters. One would just need the possibility to save the chosen sort criterias as default one.

I noticed that the secondary sort disappeared in 6.x-1.5. Is it still in dev? Or am I missing something?

Actually, I don't think it ever made it into the code, (at least not that I remember).

You might want to start looking into the use of Views. Biblio now has reasonably complete Views support and this allows some fairly complex sorting and filtering to be done.

Ron.

It was in the DEV version I was using until I upgraded to 1.5. But I'll look into Views. That was the flexibility, I was looking for anyway. Thanks.

Yep, I agree on this too. I currently have the default display by year, but it would be nice to to have the option to then sort them under each year by the first named author alphabetically.

For displaying on user profile pages, I agree too that most default displays are likely to be by type and strongly support the idea of being able to then have an option to set the sort order to be by title rather than by year.

I was able to recreate this functionality with views and then some. The only bit that is missing is the export function. I submitted it as a new feature request here: #484872: export links in views

I think all the development efforts should now go towards tighter Views/CCK integration - which is where Ron seems to be headed.

Status:Needs review» Closed (duplicate)

This is standard functionality already available to fields (CCK) through other modules, so marking as duplicate of #682044: Support fields (CCK) in D7 Bibliography Module since that would also satisfy this.

StatusFileSize
new9.88 KB

I've created a custom search using Views 6.x-2.8, with the 'Table' style to allow for sorting by column headers.

However, none of the Biblio fields have a sortable option in the Table configuration. I've attached a screenshot snippet to demonstrate.

Am I following the wrong approach here? Any help would be greatly appreciated.

StatusFileSize
new810 bytes

Even though this can be achieved through the use of cck and views, I still think that the original spirit of the ticket remains. The default sort should not be by type then title, but instead by type then year.

-Richard