Browse Source

Bug 12430: Use releance ranking without QueryWeightFields

The system preference "QueryWeightFields" is mutually exclusive with
the system preference "QueryAutoTruncate" and the * truncation
modifier, when not using QueryParser.

If you use truncation, relevance won't work anymore. (N.B. Relevance
doesn't work probably when using QueryParser, but for a very different
reason beyond the current scope of this bug.)

This patch adds relevance ranking when using truncation (or basically
when QueryWeightFields is disabled).

_TEST PLAN_

1) Turn on "QueryWeightFields" and set "QueryAutoTruncate" to auto
2) Turn off "UseQueryParser"
3) Do a keyword search in the OPAC
4) Note that the results are ordered by biblionumber ascending

5) Apply patch

6) Do the same keyword search in the OPAC
7) Note that the results are never ordered differently
(presumably in relevance order :P)

If you're a stickler, throw in some warns so that you can see
what CCL query is being sent to Zebra.

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
21.05.x
David Cook 10 years ago
committed by Jonathan Druart
parent
commit
f6b5dfa4b7
  1. 7
      C4/Search.pm

7
C4/Search.pm

@ -1494,6 +1494,13 @@ sub buildQuery {
warn "FIELD WEIGHTED OPERAND: >$weighted_operand<" if $DEBUG;
#Use relevance ranking when not using a weighted query (which adds relevance ranking of its own)
#N.B. Truncation is mutually exclusive with Weighted Queries,
#so even if QueryWeightFields is turned on, QueryAutoTruncate will turn it off, thus
#the need for this relevance wrapper.
$operand = "(rk=($operand))" unless $weight_fields;
($query,$query_cgi,$query_desc,$previous_operand) = _build_initial_query({
query => $query,
query_cgi => $query_cgi,

Loading…
Cancel
Save