-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Z39.50 resultset sort should support numeric sorting #37
Comments
We worked around the problem by zero padding the integers going into the sort register so that the lexicographic sort will "do the right thing" anyway. But it would be great if the yaz sort spec could take a numeric flag so that we wouldn't have to do that workaround. |
On Thu, Jun 23, 2022 at 2:32 AM minusdavid ***@***.***> wrote:
We worked around the problem by zero padding the integers going into the
sort register so that the lexicographic sort will "do the right thing"
anyway.
But it would be great if the yaz sort spec could take a numeric flag so
that we wouldn't have to do that workaround.
Again, what specifically were you attempting, that didn't work?
Did you try "sortby someField/cql.number"?
…-- Mike.
Message ID: ***@***.***>
|
I've tried with both ZOOM::ResultSet::sort() and yaz-client's sort() functions. Haven't tried the ZOOM::Query::sortby function. That's interesting. We typically use ZOOM::Query::PQF or ZOOM::Query::CCL2RPN and then sort the result set. I quite like the idea of ZOOM::Query::sortby instead as that should be more efficient. Koha's already used ZOOM::ResultSet::sort() for many years, so that's what I need to work with, but interesting... In any case, the sort() we do is "1=12 >i" or "1=12 <i". unix:/var/run/koha/kohadev/bibliosocket Even though 1=12 is an integer (in Koha), it sorts lexicographically. We've worked around it by zero-padding that integer so that the lexicographic sort will work. -- Actually, I think ZOOM::Query::sortby wouldn't work for us either because the sort spec still can't define a numeric sort when using the PQF attributes which I think is the only option with the ZOOM module. I was able to get these PQF searches working but they were hand-made from scratch: Ascending order: Descending order: |
What exactly are you attempting, that is not working?
…-- Mike.
On Mon, Jun 20, 2022 at 5:26 AM minusdavid ***@***.***> wrote:
It looks like the "z39.50" ZOOM sort strategy only supports lexicographic
sorting.
I was able to get numeric sorting working with the "type7" sort strategy
according to "3.2.1. Zebra Extension Embedded Sort Attribute (type 7)" on
https://software.indexdata.com/zebra/doc/querymodel-zebra.html#querymodel-zebra-attr-sorting,
but I need to use the ZOOM::ResultSet::sort method from
https://metacpan.org/pod/ZOOM#sort() to do the sorting so that won't
work...
Am I missing something or is this just a flaw in the "z39.50" sort
strategy?
—
Reply to this email directly, view it on GitHub
<#37>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AABT6GN65GQJNI7NU2C5E7LVP7XHHANCNFSM5ZHRCOCQ>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
My apologies. As far as I can tell, I've described exactly what I'm attempting above in detail. What part is unclear?
It makes sense that a lot of Zebra/YAZ sorting would be lexicographic string sorting, but there are use cases where we want to sort numerically instead Our workaround was to zero pad the local number so that it sorts like 01,02,03,04,05,06,07,08,09,10 I was thinking it would be useful if the sort spec had a flag like "n" to denote a numeric sort so that we wouldn't have to use the zero padding workaround. |
My apologies for letting this get dropped on the floor. You are quite correct that You are also correct that the obvious way to fix this would be to support the use of In the mean time, of course, your zero-padding workaround is a functional if inelegant way to get the behaviour you want. Or you can find a way to use one of the other two ways of expressing sorting within YAZ. (Yes, it's a shame there are three different ways -- this is a historical accident, and I don't think could really have been avoided.) These options are:
Sorry that it's taken so long to reply, and that the reply is not really satisfactory. |
You must specify |
Right, but @minusdavid's question is about how to communicate the equivalent of |
There is no numeric sort flag in Z39.50 sort. But you can pass multiple attribute pairs, as in |
Ah, perfect! So, @minusdavid, it seems you can likely get what you want using Please let us know if it works. (@adamdickmeiss, we should mention this in the YAZ docs.) |
Legends! Thanks very much, Adam and Mike. That's done it! I had no idea it was possible to pass multiple attribute pairs. Including examples of that in the following would be great: |
I was wondering if @adamdickmeiss had any thoughts on #35 as well? In databases with 1,000,000+ records, we've had to stop using Zebra facets as stop words in the original search query like "the" cause the response time to blow out from 2 seconds to 60+ seconds. |
|
It looks like the "z39.50" ZOOM sort strategy only supports lexicographic sorting.
I was able to get numeric sorting working with the "type7" sort strategy according to "3.2.1. Zebra Extension Embedded Sort Attribute (type 7)" on https://software.indexdata.com/zebra/doc/querymodel-zebra.html#querymodel-zebra-attr-sorting, but I need to use the ZOOM::ResultSet::sort method from https://metacpan.org/pod/ZOOM#sort() to do the sorting so that won't work...
Am I missing something or is this just a flaw in the "z39.50" sort strategy?
The text was updated successfully, but these errors were encountered: