[OPEN-ILS-DEV] pubdate index

Mike Rylander mrylander at gmail.com
Fri Jan 31 11:26:56 EST 2014


Liam,

Thanks for looking at this, but I think we should just use the
approximate_low_date() normalizer and be done.  I believe a recently
offered branch of yours should take care of making sure it is
installed, and we can also add it to the normalizer list for pubdate
without risk.

As for creating two attributes, that is a waste of space, will slow
down search, and will lead to confusing user-level behavior.  By
having differing values for replacement of u (or x, as is sometimes
used) used for ASC or DESC, we'll just make the display order unstable
and confusing when switching between the two.

As for nulls, we can use NULLS FIRST/LAST to push unknown values to
the end.  We do that already for at least some of the ORDER BY columns
... and I thought pubdate was one of the.


On Fri, Jan 31, 2014 at 10:58 AM, Liam Whalen
<liam.whalen at bc.libraries.coop> wrote:
> We have noticed a problem with sorting by date where records with empty date1 values or date1 values with 'u' in them are sorted to the top of the search results in both Newest to Oldest and Oldest to Newest sorts.
>
> I have worked around this with the following fix:
>
> http://git.sitka.bclibraries.ca/gitweb/?p=sitka/evergreen.git;a=commit;h=476cf5aa7b14b9934ae5521046eb79c9d3d4573b
>
> But, this forces calculations to happen when sorting, which fails to capitalize on the possibilities of an index.
>
> I suggest that we change the pubdate index to pubdate_asc and pubdate_desc.
>
> In the case of records with no date1 value, pubdate_asc would be given a value of 9999 and pubdate_desc would be given a value of 0.
>
> This will force these records to the bottom of date sorted results.
>
> In the case of records with 'u' characters in date1, we replace all occurrences of u with 9 in pubdate_asc and all occurrences of u with 0 in pubade_desc.  This will push these records to the bottom of their relevant date groups.
>
> I can make these changes.  Is it a good idea to separate pubdate into two categories like this?
>
> Liam



-- 
Mike Rylander
 | Director of Research and Development
 | Equinox Software, Inc. / Your Library's Guide to Open Source
 | phone:  1-877-OPEN-ILS (673-6457)
 | email:  miker at esilibrary.com
 | web:  http://www.esilibrary.com


More information about the Open-ils-dev mailing list