Moodle

Global search suffers fatal php error is quotes are placed arouns search phrase

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 1.9.2
  • Fix Version/s: 1.9.4, 2.0
  • Component/s: Global search
  • Labels:
    None
  • Environment:
    PHP 5.2.6, MySQL 5.0.58, running uinder Centos Linux 4.6
    Running apc cache
  • Affected Branches:
    MOODLE_19_STABLE
  • Fixed Branches:
    MOODLE_19_STABLE, MOODLE_20_STABLE

Description

If a search term is entered into the search box, surrounded by quotes - "Surrey" is the example that I used, then a PHP fatal error occurs:

[Mon Jul 14 12:11:03 2008] [error] [client 81.179.17.193] PHP Fatal error: Uncaught exception 'Zend_Search_Lucene_Search_QueryParse
rException' with message 'Two chars lexeme expected. Position is 1.' in /home/httpd/vhosts/web27/web/search/Zend/Search/Lucene/Searc
h/QueryLexer.php:397\nStack trace:\n#0 /home/httpd/vhosts/web27/web/search/Zend/Search/Lucene/FSMAction.php(62): Zend_Search_Lucene_
Search_QueryLexer->addQuerySyntaxLexeme()\n#1 /home/httpd/vhosts/web27/web/search/Zend/Search/Lucene/FSM.php(419): Zend_Search_Lucen
e_FSMAction->doAction()\n#2 /home/httpd/vhosts/web27/web/search/Zend/Search/Lucene/Search/QueryLexer.php(358): Zend_Search_Lucene_FS
M->process(1)\n#3 /home/httpd/vhosts/web27/web/search/Zend/Search/Lucene/Search/QueryParser.php(334): Zend_Search_Lucene_Search_Quer
yLexer->tokenize('"surrey ti...', '')\n#4 /home/httpd/vhosts/web27/web/search/Zend/Search/Lucene.php(554): Zend_Search_Lucene_S
earch_QueryParser::parse('"surrey ti...')\n#5 /home/httpd/vhosts/web27/web/search/querylib.php(228): Zend_Search_Lucene->find('
"surrey ti...')\n#6 /home/httpd/vhosts/web27/we in /home/httpd/vhosts/web27/web/search/Zend/Search/Lucene/Search/QueryLexer.php
on line 397, referer: http://www.derbycoco.co.uk/search/query.php?query_string=Surrey

Lots of people are used to using quotes in things like google searches, so even if Moodle global search doesn't use them, it should be able to trap them and discard them, rather than crashing.

Sean K

Activity

Hide
Matthew Cannings added a comment -

I have noticed another Query Parser error for searches that contain the word to

Fatal error: Uncaught exception 'Zend_Search_Lucene_Search_QueryParserException' with message 'Syntax error at char position 9.' in /srv/www/htdocs/training/search/Zend/Search/Lucene/Search/QueryParser.php:350 Stack trace: #0 /srv/www/htdocs/training/search/Zend/Search/Lucene.php(554): Zend_Search_Lucene_Search_QueryParser::parse('return to work ...') #1 /srv/www/htdocs/training/search/querylib.php(228): Zend_Search_Lucene->find('return to work ...') #2 /srv/www/htdocs/training/search/querylib.php(302): SearchQuery->process_results() #3 /srv/www/htdocs/training/search/querylib.php(200): SearchQuery->get_results() #4 /srv/www/htdocs/training/search/querylib.php(179): SearchQuery->set_query('return to work') #5 /srv/www/htdocs/training/search/query.php(137): SearchQuery->__construct('return to work', 1, 10, false) #6 {main} thrown in /srv/www/htdocs/training/search/Zend/Search/Lucene/Search/QueryParser.php on line 350

Show
Matthew Cannings added a comment - I have noticed another Query Parser error for searches that contain the word to Fatal error: Uncaught exception 'Zend_Search_Lucene_Search_QueryParserException' with message 'Syntax error at char position 9.' in /srv/www/htdocs/training/search/Zend/Search/Lucene/Search/QueryParser.php:350 Stack trace: #0 /srv/www/htdocs/training/search/Zend/Search/Lucene.php(554): Zend_Search_Lucene_Search_QueryParser::parse('return to work ...') #1 /srv/www/htdocs/training/search/querylib.php(228): Zend_Search_Lucene->find('return to work ...') #2 /srv/www/htdocs/training/search/querylib.php(302): SearchQuery->process_results() #3 /srv/www/htdocs/training/search/querylib.php(200): SearchQuery->get_results() #4 /srv/www/htdocs/training/search/querylib.php(179): SearchQuery->set_query('return to work') #5 /srv/www/htdocs/training/search/query.php(137): SearchQuery->__construct('return to work', 1, 10, false) #6 {main} thrown in /srv/www/htdocs/training/search/Zend/Search/Lucene/Search/QueryParser.php on line 350
Hide
Valery Fremaux added a comment -

Solved by the big update was made on MOODLE_19_STABLE codebase.

Show
Valery Fremaux added a comment - Solved by the big update was made on MOODLE_19_STABLE codebase.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: