[Koha-bugs] [Bug 3711] New: Intermittent search error in OPAC

bugzilla-daemon at kohaorg.ec2.liblime.com bugzilla-daemon at kohaorg.ec2.liblime.com
Wed Oct 14 17:42:16 CEST 2009


http://bugs.koha.org/cgi-bin/bugzilla3/show_bug.cgi?id=3711

           Summary: Intermittent search error in OPAC
           Product: Koha
           Version: rel_3_0
          Platform: PC
        OS/Version: Windows 2000
            Status: ASSIGNED
          Severity: major
          Priority: P3
         Component: OPAC
        AssignedTo: jwagner at ptfs.com
        ReportedBy: jwagner at ptfs.com
   Estimated Hours: 0.0
 Change sponsored?: ---


I've been having an intermittent script error in OPAC searching that refers to
opac-tmpl/prog/en/lib/jquery/plugins/jquery.highlight-3.js:38 and complains
that 'data' is null or not an object.

I thought this was related to Bug 3589, since it seemed to be related to
highlighting, but that was misleading.  After much troubleshooting on the IRC
with Owen Leonard (THANKS!), I tracked the problem to a search term that begins
with a space.  For example, from the page source:

               <input type="hidden" name="q" value="seasons"/>
               <input type="hidden" name="q" value=" seasons"/>

The second case triggers the error; the first doesn't.  Testing by manually
searching for a term beginning with a space always triggers the error.  I added
a couple of lines to opac-search.pl to check for leading and trailing spaces in
the query and remove them:

## I. BUILD THE QUERY
(
$error,$query,$simple_query,$query_cgi,$query_desc,$limit,$limit_cgi,$limit_desc,$stopwords_removed,$query_type)
= buildQuery(\@operators,\@operands,\@indexes,\@limits,\@sort_by);

        $query_desc =~ s/^\s+//;        # removes leading space
        $query_desc =~ s/\s+$//;        # removes trailing space


That seems to fix the problem.


-- 
Configure bugmail: http://bugs.koha.org/cgi-bin/bugzilla3/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching all bug changes.



More information about the Koha-bugs mailing list