Bug 11255 - sort by relevance asc generates a wrong query
Summary: sort by relevance asc generates a wrong query
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Searching (show other bugs)
Version: master
Hardware: All All
: P5 - low normal (vote)
Assignee: Jonathan Druart
QA Contact: Testopia
URL:
Keywords:
Depends on: 7674 10283
Blocks:
  Show dependency treegraph
 
Reported: 2013-11-15 10:11 UTC by Jonathan Druart
Modified: 2015-06-04 23:24 UTC (History)
6 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Trivial patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 11255: allow sorting by relevance asc (1.26 KB, patch)
2013-11-15 10:17 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 11255: allow sorting by relevance asc (1.34 KB, patch)
2013-12-10 23:38 UTC, sandboxes@biblibre.com
Details | Diff | Splinter Review
Bug 11255: allow sorting by relevance asc (1.39 KB, patch)
2013-12-13 19:19 UTC, Kyle M Hall
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Jonathan Druart 2013-11-15 10:11:38 UTC
Using query parser, the relevance asc sort is not well manage.
Comment 1 Jonathan Druart 2013-11-15 10:17:07 UTC Comment hidden (obsolete)
Comment 2 mathieu saby 2013-11-15 11:41:04 UTC
By the way, note that all mention of "relevance dsc" in queryparser conf, perl code, sysprefs, and templates should be removed.

"Relevance dsc" is a really weird idea.

Mathieu
Comment 3 mathieu saby 2013-11-15 11:53:48 UTC
Oh, I'm not well wake up.

I mean "relevance ASC" is
Comment 4 mathieu saby 2013-11-15 11:54:04 UTC
... is a weird thing.
Comment 5 mathieu saby 2013-11-15 11:56:25 UTC
On UX point of view, you never use an opac or even a staff search (except for some testing maybe) and expect to find the least relevant results on the first page. It is useless.

Mathieu
Comment 6 Jonathan Druart 2013-11-15 12:40:20 UTC
Yes, it is completely stupid :)
But it is possible to set the pref like that, so we should manage with this configuration.
Comment 7 Owen Leonard 2013-11-15 17:56:54 UTC
In order to get this to work I had to manually copy ~/kohaclone/etc/searchengine/queryparser.yaml to ~/koha-dev/etc/searchengine/queryparser.yaml. Is that to be expected with a git installation?

Performing the search after following the test plan results in some results (instead of no results), but the results look the same. No difference in the order.
Comment 8 Jonathan Druart 2013-11-18 09:11:22 UTC
(In reply to Owen Leonard from comment #7)
> In order to get this to work I had to manually copy
> ~/kohaclone/etc/searchengine/queryparser.yaml to
> ~/koha-dev/etc/searchengine/queryparser.yaml. Is that to be expected with a
> git installation?

I suppose, yes.

> Performing the search after following the test plan results in some results
> (instead of no results), but the results look the same. No difference in the
> order.

Yes, it is normal. The relevance is a relation attribute in the zebra query, not a type 7 attribute (using for sort), so I think it is not possible to sort by relevance asc.
Comment 9 sandboxes@biblibre.com 2013-12-10 23:38:03 UTC
Patch tested with a sandbox, by Christopher Brannon <cbrannon@cdalibrary.org>
Comment 10 sandboxes@biblibre.com 2013-12-10 23:38:20 UTC Comment hidden (obsolete)
Comment 11 Christopher Brannon 2013-12-10 23:39:52 UTC
The patch works as expected, according to the test plan.

Christopher
Comment 12 Kyle M Hall 2013-12-13 19:19:25 UTC
Created attachment 23539 [details] [review]
Bug 11255: allow sorting by relevance asc

The query parser config does not declare relevance asc as possible
"modifier".

Test plan:
0/ create some biblio with "history" in the title
1/ define prefs defaultSortField = relevance and defaultSortOrder = asc
2/ search "history" on the staff interface
3/ note that no result is returned.
4/ apply the patch
5/ verify the queryparser config file in use takes the modification into
account (see the queryparser_config value in your $KOHA_CONF file).
6/ relaunch the search and verify results are returned

Signed-off-by: Christopher Brannon <cbrannon@cdalibrary.org>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Comment 13 Galen Charlton 2013-12-13 19:45:34 UTC
Pushed to master.  Thanks, Jonathan!
Comment 14 Fridolin Somers 2013-12-24 13:03:51 UTC
Patch pushed to 3.14.x, will be in 3.14.2
Comment 15 Tomás Cohen Arazi 2014-01-15 17:17:11 UTC
This patch has been pushed to 3.12.x, will be in 3.12.9.

Thanks Jonathan!