Koha/C4
Fridolyn SOMERS e17abe0e28 Bug 10271: fix searching using an index containing "ns" or "nb"
When an index does not contain a structure part, the structure "wrdl"
is automatically added and a structure is mandatory to build search
query (to convert ':' into '=').

But the code that tests that the structure is not already defined looks
in entire index string :

  $index =~ /(st-|phr|ext|wrdl|nb|ns)/

It should look for a comma followed by a structure and in the case of
"nb" and "ns" look for an exact match.

The consequence is that an index containing ns or nb or phr or etc does
not work.

This patch modifies the regexp for this part and other parts looking at
structures into index.

Test plan :
- Desactivate all searching sysprefs.
- Create a new index called "ansa" number 8999 into bib1.att,
  ccl.properties and records.abs
- Index a biblio with a value on this index, ie "VALUE"
- Perform a search on this index by editing URL:
  http://<server>/cgi-bin/koha/catalogue/search.pl?idx=ansa&q=VALUE
=> Without patch, the search does not work. The PQF query is
   "@and ansa: VALUE"
=> With patch, the search works. The PQF query is "@attr 1=8999 VALUE";
- Perform same test with an index containing a structure ie "aphra"
- Set QueryAutoTruncate syspref to automatically
=> Check * is added to operand : PQF query is
   "@attr 1=8999 @attr 4=6 @attr 5=1 VALUE"
- You may check stopwords removal but this feature is obsolete

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>

Comment: as far as I can test, this works. Small tab error reported
by koha-qa, fixed in a followup.

This kind of patch is difficult to test without explicit instructions,
not everyone knows how to check what kind of PQF search is used.
I don't know. But I can test search results.

Test:
1) Deactivate search sysprefs
QueryAutoTruncate = only if * is added
QueryFuzzy = Don't try
QueryStemming = Don't try
QueryWeightFields = Disable
UseQueryParser = Do not try

2) Create new index 'ansa'
bib1.att : att 8999 ansa
ccl.properties : ansa 1=8999
records.abs : melm 999 ansa:w,ansa:p

1) and 2) from comment 3 on Bug

3) In the undestanding that index refers to field 999,
edited default framework, made 999a visible on editor

4) Edit sample record, add 'VALUE' to 999a, save, reindex

5) Search with /cgi-bin/koha/catalogue/search.pl?idx=ansa&q=VALUE
No results

6) Apply patch, repeat search
Got results

That's all I can test. If not enough for QA, then this
must wait until further and explicit test instructions

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

There is (for MARC21, at least), an exising indexes that this patch
fixes: Code-institution.

Signed-off-by: Galen Charlton <gmc@esilibrary.com>
2013-10-28 16:14:06 +00:00
..
AuthoritiesMarc Bug 7941 : Fix version numbers in modules 2012-06-11 17:29:38 +02:00
Barcodes Bug 6679 - [SIGNED-OFF] fix 6 perlcritic violations in C4/Barcodes/hbyymmincr.pm 2012-09-20 12:01:36 +02:00
ClassSortRoutine Bug 9770: fix sorting of Dewey call numbers that contain prefixes 2013-07-15 16:12:47 +00:00
Creators Bug 10763 - [SIGNED-OFF] Update POD of C4::Creators::Lib::html_table() to use TT syntax 2013-08-20 14:31:34 +00:00
External Bug 10320: (follow-up) correct license statement 2013-09-08 07:04:45 +00:00
Form Talking Tech Support - Phase I - Followup - Fix Messaging Preferences 2012-06-10 17:46:58 +02:00
Heading Bug 7941 : Fix version numbers in modules 2012-06-11 17:29:38 +02:00
ILSDI Bug 10667: Allow authentication with cardnumber for ILS-DI 2013-09-16 19:14:10 +00:00
Installer Bug 8798: (follow-up) remove tabs 2013-10-14 21:08:02 +00:00
Labels bug 9370: improve splitting of LC call numbers for labels 2013-06-12 07:44:10 -07:00
Linker Bug 8447: Make sure we have enough subfields for broader_headings 2012-09-14 14:56:48 +02:00
Members Bug 7919: Fix unit test (Members_AttributeTypes.t) 2012-12-07 18:26:37 -05:00
OAI Bug 9295: Introduce operator equal/ notequal to OAI set mapping instead of hardcoded 'equal' value. 2013-10-10 23:03:30 +00:00
Output Fix FSF address in directory C4/ 2010-03-16 20:17:56 -04:00
Patroncards Bug 8315 - remove use C4::* version 2012-07-13 14:17:20 +02:00
Reports Bug 10761: (follow-up) use explicit return in C4::Reports::Guided::delete_report() 2013-08-21 14:45:41 +00:00
Search Bug 5385: POD Cleanups (part 1) 2010-11-12 10:06:55 +13:00
SIP bug 9611: use checkpw_hash() instead of md5 hash for SIP2 logins 2013-10-03 23:01:46 +00:00
Utils Bug 7941 : Fix version numbers in modules 2012-06-11 17:29:38 +02:00
VirtualShelves Bug 10853: All existing routing to get a CSV should return a MARC csv 2013-10-11 02:16:33 +00:00
Accounts.pm Bug 11123: remove two unused routines from C4::Accounts 2013-10-24 16:55:36 +00:00
Acquisition.pm Bug 5336: (follow-up) remove unused new parameter to NewOrder() that slipped in 2013-10-22 13:42:23 +00:00
Auth.pm Bug 10309: (follow-up) restore setting some OPAC template variables in C4::Auth 2013-10-15 15:27:59 +00:00
Auth_cas_servers.yaml.orig Bug 5630 CAS improvements 2011-10-13 10:49:49 +13:00
Auth_with_cas.pm Bug 10927: remove disused C4::Utils module 2013-10-03 14:53:02 +00:00
Auth_with_ldap.pm Bug 10908: restore docs on principal_name LDAP option 2013-10-21 15:28:11 +00:00
AuthoritiesMarc.pm Bug 10602: Set default value for authority fields via the framework 2013-10-10 23:25:47 +00:00
BackgroundJob.pm Bug 10601: (follow-up) improvements to ->set() and ->get() 2013-09-18 17:23:44 +00:00
Barcodes.pm Bug 6679 - [SIGNED-OFF] fix 8 perlcritic violations in C4/Barcodes.pm 2012-09-20 12:01:36 +02:00
Biblio.pm Bug 11037: remove non-existent routines from Biblio's @EXPORT 2013-10-21 15:31:28 +00:00
Bookseller.pm Bug 10641 - GetBooksellerWithLateOrders in C4::Bookseller.pm has some incoherences 2013-10-09 04:02:47 +00:00
Boolean.pm Bug 10080 - Change system pref IndependantBranches to IndependentBranches 2013-05-22 07:58:23 -07:00
Branch.pm Bug 10629: remove inappropriate uses of $sth->finish() in C4::Branch 2013-08-28 14:25:52 +00:00
Breeding.pm Bug 10096 - (follow-up) various QA improvements 2013-10-04 14:29:18 +00:00
Budgets.pm Bug 10535: by default sort funds by name 2013-07-11 16:52:34 +00:00
Calendar.pm Bug 7351 : feature that allows to delete a range of dates 2012-09-28 12:19:45 +02:00
Category.pm Bug 7919: FIX the "all" categories method 2013-01-02 16:50:52 -05:00
Charset.pm Bug 8347 - Koha forces UNIMARC 100 field code language to 'fre' 2013-02-20 09:06:57 -05:00
Circulation.pm Bug 10493: (follow-up) fix test errors 2013-10-23 04:25:34 +00:00
ClassSortRoutine.pm Bug 7941 : Fix version numbers in modules 2012-06-11 17:29:38 +02:00
ClassSource.pm Bug 10643: fix inappropriate uses of $sth->finish() in C4::ClassSource.pm 2013-08-09 15:32:22 +00:00
Context.pm Bug 8798: moving code to Koha::Database and adding tests 2013-10-14 21:08:02 +00:00
Contract.pm Bug 7941 : Fix version numbers in modules 2012-06-11 17:29:38 +02:00
CourseReserves.pm bug 8215: (followup) rename GetItemReservesInfo 2013-05-21 15:51:03 -07:00
Creators.pm Bug 8315 - remove use C4::* version 2012-07-13 14:17:20 +02:00
Csv.pm Bug 10853: All existing routing to get a CSV should return a MARC csv 2013-10-11 02:16:33 +00:00
Dates.pm Bug 7941 : Fix version numbers in modules 2012-06-11 17:29:38 +02:00
Debug.pm Bug 7941 : Fix version numbers in modules 2012-06-11 17:29:38 +02:00
Heading.pm Bug 7941 : Fix version numbers in modules 2012-06-11 17:29:38 +02:00
HoldsQueue.pm Bug 10550: Fix database typo wthdrawn 2013-09-08 01:58:41 +00:00
HTML5Media.pm Bug 8377: Followup move style in a css file and do not pass template to a pm 2012-12-27 09:28:00 -05:00
Images.pm Bug 8710 - Don't show the images tab in the OPAC if the record has no local images 2012-11-28 18:54:40 -05:00
ImportBatch.pm Bug 10230: Don't limit valid matches to bibs 2013-05-19 08:40:13 -04:00
ImportExportFramework.pm bug 9611: (follow-up) remove md5_base64 from imports - not used 2013-10-03 23:00:32 +00:00
Input.pm Bug 7919 : Display of values depending on the connexion library 2012-12-05 10:10:57 -05:00
Installer.pm Bug 9752: Set marcflavour to NORMARC when NORMARC is chosen 2013-03-30 22:51:17 -04:00
ItemCirculationAlertPreference.pm Bug 6679 - [SIGNED-OFF] fix 2 perlcritic violations in C4/ItemCirculationAlertPreference.pm 2012-09-20 12:01:39 +02:00
Items.pm Bug 10493: Add renewal script 2013-10-22 17:04:03 +00:00
ItemType.pm Bug 10513: display a warning/message when returning a chosen item type 2013-09-16 17:45:31 +00:00
Koha.pm Bug 10426: Remove unused sub GetCcodes from Koha.pm 2013-09-06 18:27:16 +00:00
Labels.pm Bug 8315 - remove use C4::* version 2012-07-13 14:17:20 +02:00
Languages.pm Bug 10309 - New OPAC theme based on Bootstrap 2013-10-14 23:13:05 +00:00
Letters.pm Bug 10843: fix crash that can occur when confirming hold if ReservesMaxPickUpDelay is undefined 2013-10-18 06:16:57 +00:00
Linker.pm Bug 7284: Fix unit test broken by erroneous POD 2012-03-08 15:24:18 +01:00
Log.pm Bug 7067 - OPAC Borrower Self Registration 2012-12-14 08:08:59 -05:00
Maintainance.pm Bug 7941 : Fix version numbers in modules 2012-06-11 17:29:38 +02:00
Matcher.pm Bug 10230: no need to use SimpleSearch for matching auths 2013-05-19 08:40:13 -04:00
Members.pm Bug 10636 - patronimage should have borrowernumber as PK, not cardnumber 2013-10-14 21:08:02 +00:00
Message.pm Bug 6679 - [SIGNED-OFF] fix 3 perlcritic violations in C4/Message.pm 2012-09-20 12:01:39 +02:00
NewsChannels.pm Bug 7941 : Fix version numbers in modules 2012-06-11 17:29:38 +02:00
Output.pm Bug 10016: force zero browser-side caching of SCO pages 2013-10-21 18:05:12 +00:00
Overdues.pm Bug 10256: Remove some unused subs from Overdues module 2013-06-17 09:08:50 -07:00
Patroncards.pm Bug 8315 - remove use C4::* version 2012-07-13 14:17:20 +02:00
Print.pm Bug 6679 - [SIGNED-OFF] fix 2 perlcritic violations in C4/Print.pm 2012-09-20 12:17:43 +02:00
Ratings.pm Bug 7941 : Fix version numbers in modules 2012-06-11 17:29:38 +02:00
Record.pm Bug 11058: fix compilation warning in C4::Record 2013-10-22 01:21:07 +00:00
Reports.pm Bug 7941 : Fix version numbers in modules 2012-06-11 17:29:38 +02:00
Reserves.pm Bug 10493: Add renewal script 2013-10-22 17:04:03 +00:00
Review.pm Bug 7941 : Fix version numbers in modules 2012-06-11 17:29:38 +02:00
Ris.pm Bug 7941 : Fix version numbers in modules 2012-06-11 17:29:38 +02:00
RotatingCollections.pm Bug 10642: fix inappropriate uses of $sth->finish() in C4::RotatingCollections.pm 2013-08-16 16:19:02 +00:00
Scheduler.pm Bug 7941 : Fix version numbers in modules 2012-06-11 17:29:38 +02:00
Scrubber.pm Bug 7941 : Fix version numbers in modules 2012-06-11 17:29:38 +02:00
Search.pm Bug 10271: fix searching using an index containing "ns" or "nb" 2013-10-28 16:14:06 +00:00
Serials.pm Bug 10689: make public note appear in subscriptions search 2013-10-11 04:21:47 +00:00
Service.pm POD Cleanups 2010-06-09 08:38:59 -04:00
ShelfBrowser.pm Bug 10856: (follow-up) if callnumbers are equal, order should be on itemnumber 2013-10-04 15:57:03 +00:00
SMS.pm Bug 7941 : Fix version numbers in modules 2012-06-11 17:29:38 +02:00
SocialData.pm bug 7470 follow-up, fix POD doc 2012-03-26 17:53:28 +02:00
SQLHelper.pm Bug 10403: add ability to change fund on receipt 2013-10-22 12:57:25 +00:00
Stats.pm Bug 4118 - Add Collection Code to Statistics Table 2012-09-13 18:42:46 +02:00
Suggestions.pm Bug 10080 - Change system pref IndependantBranches to IndependentBranches 2013-05-22 07:58:23 -07:00
Tags.pm Bug 9136: C4::Tags not Plack-compatible 2012-12-22 15:47:48 -05:00
Templates.pm Bug 9735 - Let the language be selected through URL parameters 2013-10-04 03:26:09 +00:00
TmplToken.pm Bug 7941 : Fix version numbers in modules 2012-06-11 17:29:38 +02:00
TmplTokenType.pm Revert "Bug 6679 - [SIGNED-OFF] fix 9 perlcritic violations in C4/TmplTokenType.pm" 2012-09-20 13:29:59 +02:00
TTParser.pm Bug 5327 : Follow up for TTParser test 2012-07-12 16:06:21 +02:00
UploadedFile.pm Bug 7941 : Fix version numbers in modules 2012-06-11 17:29:38 +02:00
VirtualShelves.pm Bug 10386: improvements to VirtualShelves.t 2013-06-28 05:19:49 -07:00
XISBN.pm Bug 9728: XISBN unit test update 2013-06-18 09:46:37 -07:00
XSLT.pm Bug 10550: Fix database typo wthdrawn 2013-09-08 01:58:41 +00:00