Not a problem!  Editing searches.ini is a good workaround to hide the problem for now, and hopefully you'll find something meaningful when you reindex with the stored field.  Let me know if you need more help troubleshooting or analyzing results once you reach that point.

- Demian

From: Steven P. Johnson []
Sent: Thursday, December 27, 2012 1:20 PM
To: Demian Katz;
Subject: RE: Sort by date, VuFind 1.3



Evidently my memory & brainworks cannot be trusted before the morning dog walk and bike ride to work…  During the walk and ride, I recalled that of course I was the one who set those publishDate and publishDatesort values in (And why did I mention a theme?)


Per the documentation, I had copied and edited the publishDate lines from  In an attempt to get the date sort to work, I pulled the line “publishDateSort = custom, getDate” directly from the schema.xml, in my typical trial and error way, and learned that the results were not as desired.  (Several other variations resulted in fatal errors in indexing.)


I removed the date sorts from searches.ini  on the production server and will work with date sorting on the test server.  Thank you for your assistance.




Steve Johnson

Alaska Resources Library & Information Services (ARLIS)

Anchorage, AK 99508

907 786-7661






From: Demian Katz []
Sent: Thursday, December 27, 2012 5:07 AM
To: Steven P. Johnson;
Subject: RE: Sort by date, VuFind 1.3


Is it intentional that the publishDate field is being given the "script" BeanShell version (comma-delimited list) while the publishDateSort field is being given the "custom" (i.e. built-in SolrMarc) version (first year string only)?

Is it possible that you haven't fully reindexed since upgrading from an earlier version of VuFind?  Changes in date sorting behavior between 1.2 and 1.3 have been known to cause problems if the index is not rebuilt.

If that doesn't help (or if you want to set up some extra debugging while you are reindexing), it might be worth modifying the schema to temporarily make the publishDateSort field "stored=true" so that after reindexing, you can view the Solr output and see exactly which values are being used for sorting.  If you want to try this but need more details how, just let me know.

- Demian

From: Steven P. Johnson []
Sent: Wednesday, December 26, 2012 5:46 PM
Subject: [VuFind-Tech] Sort by date, VuFind 1.3

Sorting by date/year of publication is not working  in a VuFind 1.3 collection, though search by year works.   Both ascending and descending date/year sorts return records in no obviously sorted order.


In this collection, the only collection in this instance of VuFind, the 518a field was used, rather than 260c, for date of publication.     


In, fields are defined as :



publishDate = 518c

publishDate = script(getdate.bsh), getDate

publishDateSort = custom, getDate


In  getDate.bsh, I made changes only in the last section:




* Project is using 518a as a date string

* Return the date in 260c as a string

* @param record - the marc record object

* @return 260c, "cleaned" per



public String getDate(Record record)


Set result = SolrIndexer.getFieldList(record, "518a");

/*    Set result = SolrIndexer.getFieldList(record, "260c"); */

    String date =, ", ");

    if (date == null || date.length() == 0)

        return (null);

    return cleanDate(date);



My guess is that I need to make corresponding changes in one or more places in VuFind.


I would appreciate any leads.


Thank you,


Steve Johnson

Alaska Resources Library & Information Services (ARLIS)

Anchorage, AK 99508

907 786-7661