Zebra, Query Parsing, Search, All the things
Hi all: I was getting 0 results when I should've been getting 78 results with the following query: Host-item:Criminology and criminal justice : an international journal I looked in the Zebra logs, and noticed that it was being transformed into the following: @not @and @attr 1=1033 Criminology @and @and @and @and @and criminal justice = an international journal @attr 1=9011 1 If we decompose the RPN, we'll see that it's basically saying: (Host-item=Crimology and ((((criminal and justice) and = ) and international) and journal )) not Suppression=1 The problem is that "=" is going to return 0 results, so the "and" will always be 0. The way to remedy this problem is to add quotes around our Host-item "value": Host-item:"Criminology and criminal justice an international journal" This will produce the following RPN query, which returns 78 results: @not @attr 1=1033 "Criminology and criminal justice = an international journal" @attr 1=9011 1 As far as I can tell, the = symbol is ignored. You can remove it or substitute another symbol and it'll still return the same number of results. Although it looks like using * for truncation doesn't work in double quotation marks... I suppose that's because it's already part of a term so you can't really translate it into RPN separately. I notice sometimes we strip out double quotation marks from queries and sometimes we add them in. we should probably do something consistent. David Cook Systems Librarian Prosentient Systems 72/330 Wattle St, Ultimo, NSW 2007
David, you didn't mention if you are getting those results with(out) using the QueryParser, so I don't completely understand if you are proposing some fix? Maybe provide a regression test so someone can work on it. 2015-10-13 3:26 GMT-03:00 David Cook <dcook@prosentient.com.au>:
Hi all:
I was getting 0 results when I should’ve been getting 78 results with the following query:
Host-item:Criminology and criminal justice : an international journal
I looked in the Zebra logs, and noticed that it was being transformed into the following:
@not @and @attr 1=1033 Criminology @and @and @and @and @and criminal justice = an international journal @attr 1=9011 1
If we decompose the RPN, we’ll see that it’s basically saying:
(Host-item=Crimology and ((((criminal and justice) and = ) and international) and journal )) not Suppression=1
The problem is that “=” is going to return 0 results, so the “and” will always be 0.
The way to remedy this problem is to add quotes around our Host-item “value”:
Host-item:”Criminology and criminal justice an international journal”
This will produce the following RPN query, which returns 78 results:
@not @attr 1=1033 "Criminology and criminal justice = an international journal" @attr 1=9011 1
As far as I can tell, the = symbol is ignored. You can remove it or substitute another symbol and it’ll still return the same number of results.
Although it looks like using * for truncation doesn’t work in double quotation marks... I suppose that’s because it’s already part of a term so you can’t really translate it into RPN separately…
I notice sometimes we strip out double quotation marks from queries and sometimes we add them in… we should probably do something consistent…
David Cook
Systems Librarian
Prosentient Systems
72/330 Wattle St, Ultimo, NSW 2007
_______________________________________________ Koha-devel mailing list Koha-devel@lists.koha-community.org http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel website : http://www.koha-community.org/ git : http://git.koha-community.org/ bugs : http://bugs.koha-community.org/
-- Tomás Cohen Arazi Theke Solutions (http://theke.io) ✆ +54 9351 3513384 GPG: B76C 6E7C 2D80 551A C765 E225 0A27 2EA1 B2F3 C15F
participants (2)
-
David Cook -
Tomas Cohen Arazi