2544: HTTP 500 when performing search

lukasz.********@gmai***** (Google Code) (Is this you? Claim this profile.)
Jan. 10, 2014
3016
What version are you running?
1.6.4.1

What's the URL of the page containing the problem?
/reviewboard/r/search/?q=test

What steps will reproduce the problem?
1. Enter any phrase to the search field
2. HTTP 500 will occur with following error in log file:

Traceback (most recent call last):

  File "/usr/local/lib/python2.7/dist-packages/Django-1.3.1-py2.7.egg/django/core/handlers/base.py", line 111, in get_response
    response = callback(request, *callback_args, **callback_kwargs)

  File "/usr/local/lib/python2.7/dist-packages/ReviewBoard-1.6.4.1-py2.7.egg/reviewboard/accounts/decorators.py", line 21, in _check
    return view_func(*args, **kwargs)

  File "/usr/local/lib/python2.7/dist-packages/ReviewBoard-1.6.4.1-py2.7.egg/reviewboard/reviews/views.py", line 1115, in search
    for hit in searcher.search(parser.parse(query))]

TypeError: Document<stored/uncompressed,omitNorms<id:1015>>

What is the expected output? What do you see instead?

Search result or information, that no results were found.

What operating system are you using? What browser?

Ubuntu 11.10
Chrome 17.0.963.79

Please provide any additional information below.

pylucene version: 2.3.1-1.1ubuntu2
david
#1 david
  • +Component-Search
#2 alexander*********@web*** (Google Code) (Is this you? Claim this profile.)
Same problem here even with a recent Review Board 1.7.3 and PyLucene 2.3.1 on Ubuntu 12.04.1 LTS:

ERROR - Exception thrown for user JuicyLucy at http://reviews/r/search/?q=whyisthissearchbroken

Document<stored/uncompressed<id:669>>
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/Django-1.4.3-py2.7.egg/django/core/handlers/base.py", line 111, in get_response
    response = callback(request, *callback_args, **callback_kwargs)
  File "/usr/local/lib/python2.7/dist-packages/ReviewBoard-1.7.3-py2.7.egg/reviewboard/accounts/decorators.py", line 20, in _check
    return login_required(view_func)(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/Djblets-0.7.9-py2.7.egg/djblets/auth/util.py", line 47, in _checklogin
    return view_func(request, *args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/ReviewBoard-1.7.3-py2.7.egg/reviewboard/reviews/views.py", line 1425, in search
    for hit in searcher.search(parser.parse(query))]
TypeError: Document<stored/uncompressed<id:669>>
2013-01-30 08:38:14,602 - ERROR - Internal Server Error: /r/search/
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/Django-1.4.3-py2.7.egg/django/core/handlers/base.py", line 111, in get_response
    response = callback(request, *callback_args, **callback_kwargs)
  File "/usr/local/lib/python2.7/dist-packages/ReviewBoard-1.7.3-py2.7.egg/reviewboard/accounts/decorators.py", line 20, in _check
    return login_required(view_func)(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/Djblets-0.7.9-py2.7.egg/djblets/auth/util.py", line 47, in _checklogin
    return view_func(request, *args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/ReviewBoard-1.7.3-py2.7.egg/reviewboard/reviews/views.py", line 1425, in search
    for hit in searcher.search(parser.parse(query))]
TypeError: Document<stored/uncompressed<id:669>>
#3 alexander*********@web*** (Google Code) (Is this you? Claim this profile.)
I fixed it by applying the following changes:

--- views_broken.py    2013-01-30 13:33:34.129933013 +0100
+++ views_fixed.py     2013-01-30 13:58:57.755434114 +0100
@@ -1421,8 +1421,8 @@
 
     if lucene_is_2x:
         parser = lucene.QueryParser('text', lucene.StandardAnalyzer())
-        result_ids = [int(lucene.Hit.cast_(hit).getDocument().get('id')) \
-                      for hit in searcher.search(parser.parse(query))]
+        hits = searcher.search(parser.parse(query))
+        result_ids = [int(hits.doc(n).get('id')) for n in range(hits.length())]
     elif lucene_is_3x:
         parser = lucene.QueryParser(lucene.Version.LUCENE_CURRENT, 'text',
             lucene.StandardAnalyzer(lucene.Version.LUCENE_CURRENT))

Please verify whether this is correct for all lucene 2.x versions and still does what it should have done before :).

Regards
Alex
#4 nmon****@gmai***** (Google Code) (Is this you? Claim this profile.)
This worked for me on 12.04, pylucene 2.3.1. Thanks for posting the solution.
#5 erik*****@gmai***** (Google Code) (Is this you? Claim this profile.)
This seems to still be an issue in rb 1.7.11 running on Ubuntu 12.04. The above patch works though, how do we generalize it enough to get it upstream? I assume that for some versions of lucene2x, the original block still works.
#6 br***@wie**** (Google Code) (Is this you? Claim this profile.)
Same problem here with 12.04
#7 subodh******@gmai***** (Google Code) (Is this you? Claim this profile.)
Same issue with 1.7.11 and 12.04 with pylucene, but the above fix in admin/views.py worked.
#9 christia*********@gmai***** (Google Code) (Is this you? Claim this profile.)
Will the patch break on the versions of lucene2x where the original code works? Can anyone check that? If the patch works on all versions of lucene2x then shouldn't it be merged in?
#10 chris.a********@socra****** (Google Code) (Is this you? Claim this profile.)
We just hit this as well. Would love to see this patched... 

Could someone who knows more about RB internals comment on the feasability of this change? I don't know much about pylucene
david
#11 david
I've just pushed a change to master (aa44d9e) which switches out the search backend from pylucene (which is highly annoying) to django-haystack with the whoosh backend. This is therefore obsolete.
  • +Fixed
david
#12 david
Pardon, the commit is 6859662.
#13 chris.a********@socra****** (Google Code) (Is this you? Claim this profile.)
This is awesome news! Will it be in the next release?
david
#14 david
It's going to be in the 2.0 major release. A beta including this will be coming soon. The 1.7.x series still uses the old pylucene implementation.