2755: default value for search-index

jarriz******@gmai***** (Google Code) (Is this you? Claim this profile.)
Jan. 10, 2014
What version are you running?
1.7 beta1

What's the URL of the page containing the problem?
http://cm5/reviews/admin/settings/general/

What steps will reproduce the problem?
1. install clean version of 1.7 beta1
2. click enable search
3. default dir is /usr/local/lib/python2.6/dist-packages/ReviewBoard-1.7beta1-py2.6.egg/reviewboard/search-index

What is the expected output? What do you see instead?
The default directory is writable. 
JavaError: java.io.IOException: Cannot create directory: /usr/local/lib/python2.6/dist-packages/ReviewBoard-1.7beta1-py2.6.egg/reviewboard/search-index

Changing it to another directory and setting permissions to the search-index directory worked.

The resolution is either something in the FAQ, or have the system check the permissions when the "enable search" is checked

What operating system are you using? What browser?
Ubuntu 10.04
Chrome

Please provide any additional information below.
#1 raja****@gmai***** (Google Code) (Is this you? Claim this profile.)
Lucene would typically create the last part(s) of the directory when the index is created assuming it has access to create those directories. The current logic assumes that the directory exists and then checks for write-access to that directory.

If its okay, I have a patch that will check for the parent directory of the given directory and checks if that exists and if there is write access on it. Would that work?

Patch:
-            if (os.path.exists(index_file) and
-                not os.access(index_file, os.W_OK)):
+            if ((os.path.exists(index_file) and
+                not os.access(index_file, os.W_OK)) or
+                (os.path.exists(os.path.dirname(index_file)) and
+                    not os.access(os.path.dirname(index_file), os.W_OK))):
                 raise forms.ValidationError(
                     _('The search index path is not writable. Make sure the '
                       'web server has write access to it and its parent '
david
#2 david
  • +Component-Admin
david
#3 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
#4 david
Pardon, the commit is 6859662.