I recommend against trying to re-sort results in PHP.  While it is possible to get large numbers of records back from Solr at the same time, it will become very slow and may cause your server to run out of memory.


I think the easiest and most reliable way to get better sorting behavior is to create a new field in the Solr index (called callnumber-sort for example) and then creating a new indexing routine that normalizes call numbers into a form that will sort alphabetically in the way you want (i.e. pad numbers with a large number of zeroes, normalize case, etc.).  Then you can reconfigure the sort options in web/conf/searches.ini to use callnumber-sort instead of the main callnumber field.


If you need help adding a new Solr field or creating a custom indexing routine with BeanShell, let me know and I can provide more technical details.


- Demian


From: fapeng@notes.cc.sunysb.edu [mailto:fapeng@notes.cc.sunysb.edu]
Sent: Tuesday, June 21, 2011 10:57 PM
To: Demian Katz; vufind-tech@lists.sourceforge.net
Subject: callnumber sorting


Hi Demian:

The callnumber sorting in the result is alphabetic instead of alphanumeric. I am trying to write a php function to re-sort the search result by call number (the result does not seem to be in correct order).
The problem I have is that I don't know how to get the whole result set. I was able to get the result set of current page only, which is "$this->indexResult['response']['docs']" in Solr.php. Do you know how I can get the whole result set if there is one?

Thanks very much.

Fang Peng
Library Information System/DoIT
Stony Brook University