Bugzilla – Attachment 38024 Details for
Bug 13414
Enable right truncation with search by relevance
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 13414 - Enable automatic right truncation while searching by relevance
Bug-13414---Enable-automatic-right-truncation-whil.patch (text/plain), 5.44 KB, created by
Marcel de Rooy
on 2015-04-17 10:32:22 UTC
(
hide
)
Description:
Bug 13414 - Enable automatic right truncation while searching by relevance
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2015-04-17 10:32:22 UTC
Size:
5.44 KB
patch
obsolete
>From c79a8579112dea972772eb0ade2e0cec887ea207 Mon Sep 17 00:00:00 2001 >From: kohapreprod <koha@univ-lyon3.fr> >Date: Wed, 10 Dec 2014 20:46:57 +0100 >Subject: [PATCH] Bug 13414 - Enable automatic right truncation while > searching by relevance >Content-Type: text/plain; charset=utf-8 > >This makes slight modification in build_weighted_query function in order to make >automatic right truncation possible when QueryWeightFields syspref activated (even little ranked) >Modify this syspref type from boolean to choice in order to add >this possiblity as a third option : Search by relevance with automatic right truncation. > >Signed-off-by: kohateam rennes 2 <koha@listes.univ-rennes2.fr> >--- > C4/Search.pm | 13 ++++++++----- > installer/data/mysql/sysprefs.sql | 2 +- > installer/data/mysql/updatedatabase.pl | 7 +++++++ > .../prog/en/modules/admin/preferences/searching.pref | 8 ++++---- > 4 files changed, 20 insertions(+), 10 deletions(-) > >diff --git a/C4/Search.pm b/C4/Search.pm >index 357f735..118d388 100644 >--- a/C4/Search.pm >+++ b/C4/Search.pm >@@ -1029,11 +1029,14 @@ sub _build_weighted_query { > #$weighted_query .=" or kw,wrdl,r5=\"$operand\""; # word list any > $weighted_query .= " or wrdl,fuzzy,r8=\"$operand\"" > if $fuzzy_enabled; # add fuzzy, word list >- $weighted_query .= " or wrdl,right-Truncation,r9=\"$stemmed_operand\"" >- if ( $stemming and $stemmed_operand ) >+ if ( $stemming and $stemmed_operand ) { >+ $weighted_query .= " or wrdl,right-Truncation,r9=\"$stemmed_operand\"" > ; # add stemming, right truncation >- $weighted_query .= " or wrdl,r9=\"$operand\""; >- >+ } elsif ( $weight_fields == 2 ) { >+ $weighted_query .= " or wrdl,right-Truncation,r9=\"$operand\""; >+ } else { >+ $weighted_query .= " or wrdl,r9=\"$operand\""; >+ } > # embedded sorting: 0 a-z; 1 z-a > # $weighted_query .= ") or (sort1,aut=1"; > } >@@ -1623,7 +1626,7 @@ sub buildQuery { > # Apply Truncation > if ( > scalar(@$righttruncated) + scalar(@$lefttruncated) + >- scalar(@$rightlefttruncated) > 0 ) >+ scalar(@$rightlefttruncated) > 0 and $weight_fields < 2 ) > { > > # Don't field weight or add the index to the query, we do it here >diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql >index be44611..8617a10 100644 >--- a/installer/data/mysql/sysprefs.sql >+++ b/installer/data/mysql/sysprefs.sql >@@ -343,7 +343,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('QueryAutoTruncate','1',NULL,'If ON, query truncation is enabled by default','YesNo'), > ('QueryFuzzy','1',NULL,'If ON, enables fuzzy option for searches','YesNo'), > ('QueryStemming','1',NULL,'If ON, enables query stemming','YesNo'), >-('QueryWeightFields','1',NULL,'If ON, enables field weighting','YesNo'), >+('QueryWeightFields','1','0|1|2','Enable field weighting research','Choice'), > ('QuoteOfTheDay','0',NULL,'Enable or disable display of Quote of the Day on the OPAC home page','YesNo'), > ('RandomizeHoldsQueueWeight','0',NULL,'if ON, the holds queue in circulation will be randomized, either based on all location codes, or by the location codes specified in StaticHoldsQueueWeight','YesNo'), > ('RecordLocalUseOnReturn','0',NULL,'If ON, statistically record returns of unissued items as local use, instead of return','YesNo'), >diff --git a/installer/data/mysql/updatedatabase.pl b/installer/data/mysql/updatedatabase.pl >index ca27cde..c632d41 100755 >--- a/installer/data/mysql/updatedatabase.pl >+++ b/installer/data/mysql/updatedatabase.pl >@@ -10035,6 +10035,13 @@ if ( CheckVersion($DBversion) ) { > SetVersion ($DBversion); > } > >+$DBversion = "3.19.00.XXX"; >+if ( CheckVersion($DBversion) ) { >+ $dbh->do("UPDATE systempreferences set explanation = 'If ON, enables field weighting with or without automatic right truncation', options = '0|1|2', type= 'Choice' where variable = 'QueryWeightFields'"); >+ SetVersion ($DBversion); >+} >+ >+ > # DEVELOPER PROCESS, search for anything to execute in the db_update directory > # SEE bug 13068 > # if there is anything in the atomicupdate, read and execute it. >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/searching.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/searching.pref >index 8b04d39..3113fea 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/searching.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/searching.pref >@@ -24,11 +24,11 @@ Searching: > - to match words of the same base in a search (for example, a search for <cite>enabling</cite> would also match <cite>enable</cite> and <cite>enabled</cite>; REQUIRES ZEBRA). > - > - pref: QueryWeightFields >- type: boolean >+ default: 1 > choices: >- yes: Enable >- no: Disable >- - ranking of search results by relevance (REQUIRES ZEBRA). >+ 0: Disable ranking of search results by relevance. >+ 1: Enable ranking of search results by relevance. >+ 2: Enable ranking of search results by relevance with automatic right truncation. > - > - pref: OpacGroupResults > default: 0 >-- >1.7.10.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 13414
:
34199
|
34285
|
34316
| 38024