[open-ils-commits] r17884 - branches/rel_2_0/Open-ILS/src/perlmods/OpenILS/Application/Search (dbs)
svn at svn.open-ils.org
svn at svn.open-ils.org
Tue Sep 21 22:13:23 EDT 2010
Author: dbs
Date: 2010-09-21 22:13:21 -0400 (Tue, 21 Sep 2010)
New Revision: 17884
Modified:
branches/rel_2_0/Open-ILS/src/perlmods/OpenILS/Application/Search/Biblio.pm
Log:
Forward port r17847: Make query parser a bit more careful when converting convenience classes to search classes
Queries like "Heart disease: a global problem" were getting converted to series searches
due to the trailing "se:" in the search terms. This change ensures that the convenience
class is either at the start of the input or preceded by whitespace.
Modified: branches/rel_2_0/Open-ILS/src/perlmods/OpenILS/Application/Search/Biblio.pm
===================================================================
--- branches/rel_2_0/Open-ILS/src/perlmods/OpenILS/Application/Search/Biblio.pm 2010-09-22 02:12:32 UTC (rev 17883)
+++ branches/rel_2_0/Open-ILS/src/perlmods/OpenILS/Application/Search/Biblio.pm 2010-09-22 02:13:21 UTC (rev 17884)
@@ -689,12 +689,13 @@
$query =~ s/^\s+//go;
# convert convenience classes (e.g. kw for keyword) to the full class name
- $query =~ s/kw(:|\|)/keyword$1/go;
- $query =~ s/ti(:|\|)/title$1/go;
- $query =~ s/au(:|\|)/author$1/go;
- $query =~ s/su(:|\|)/subject$1/go;
- $query =~ s/se(:|\|)/series$1/go;
- $query =~ s/name(:|\|)/author$1/og;
+ # ensure that the convenience class isn't part of a word (e.g. 'playhouse')
+ $query =~ s/(^|\s)kw(:|\|)/$1keyword$2/go;
+ $query =~ s/(^|\s)ti(:|\|)/$1title$2/go;
+ $query =~ s/(^|\s)au(:|\|)/$1author$2/go;
+ $query =~ s/(^|\s)su(:|\|)/$1subject$2/go;
+ $query =~ s/(^|\s)se(:|\|)/$1series$2/go;
+ $query =~ s/(^|\s)name(:|\|)/$1author$2/og;
$logger->debug("cleansed query string => $query");
my $search = {};
More information about the open-ils-commits
mailing list