rebuild_index command not working

195 views
Skip to first unread message

Eric van Zanten

unread,
May 8, 2012, 4:22:23 PM5/8/12
to django-haystack
Hello:
I am in the process of migrating and app from one server to another
and encountered a bit of a head scratcher. First, here are a couple
details about the environment, in case that's handy:

OS: Ubuntu 12.04LTS
Django: 1.3.1
Haystack: 1.2.7
Solr: 3.5.0 (? pretty sure)

After I setup the virtualenv and got my Django apps working, I went
ahead and issued the command to rebuild the index (after populating my
models with data) and found that Haystack was unable to find anything
to index. I checked to see whether Solr was running by hitting it with
a search request using PySolr and found that, indeed it was there and
listening, it was just empty. The really puzzling thing is that,
although the management command doesn't work to build/update the
index, this does:

>>> from app.model import Model
>>> from app.search_indexes import ModelIndex
>>> i = ModelIndex(Model)
>>> for m in Model.objects.all():
i.update_object(m)

Any clues as to why this might be happening? It's be nice to use the
actual management command for my cron jobs instead of having to write
a separate script.

Thanks,
Eric

David Sauve

unread,
May 8, 2012, 5:55:12 PM5/8/12
to django-...@googlegroups.com
Did you remember to copy over the schema?  If not, you'll need to create it using `build_solr_schema` from the command line.
--
You received this message because you are subscribed to the Google Groups "django-haystack" group.
To post to this group, send email to django-...@googlegroups.com.
To unsubscribe from this group, send email to django-haysta...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-haystack?hl=en.

Matt Bartolome

unread,
May 8, 2012, 5:55:53 PM5/8/12
to django-...@googlegroups.com
What backend are you using to run solr? Tomcat6?

Eric van Zanten

unread,
May 8, 2012, 5:59:33 PM5/8/12
to django-haystack
> Did you remember to copy over the schema?  If not, you'll need to create it using `build_solr_schema` from the command line.

Yup. It's there. I actually rebuilt it for good measure. This may be a
naive question but, doesn't the fact that I could manually (one by
one) shove object into the index and get them back out again in the
way that I'd expect, show that the schema is built properly?

I honestly don't know much about Java and have only scratched the
surface of the innards of Solr so that's meant as an honest question.

Eric

Eric van Zanten

unread,
May 8, 2012, 6:00:07 PM5/8/12
to django-haystack
> What backend are you using to run solr? Tomcat6?

Jetty? Is that a thing? It's whatever was used in the example in the
Haystack docs.

Eric

David Sauve

unread,
May 8, 2012, 6:02:12 PM5/8/12
to django-...@googlegroups.com
Yup.  Jetty is what I've used in the past.  Tomcat seemed even bigger and more complex to me, so I avoided it.  The dependency list was crazy.

Maybe try dropping some `ipdb.set_trace()` calls in to the management commands to see what's going on?  Weird that command line works but not rebuild_index.

William Burris

unread,
May 8, 2012, 6:13:50 PM5/8/12
to django-...@googlegroups.com
You may have Solr3.6.0 (seems you were not sure about the version) the schema.xml generated by Haystack's rebuild_solr_schema will have to be modified to work with solr3.6.0.  Solr moved the location of stopwords_en.txt to lang/stopwords_en.txt.  Do a search and replace on the schema.xml - if you search for stopwords_en.txt you should get 2 occurrences they need to be replaced with lang/stopword_en.txt.
--
Bill

William Burris
Cell:  248-790-6694
E-mail:  wjbu...@gmail.com

Eric van Zanten

unread,
May 8, 2012, 6:16:04 PM5/8/12
to django-haystack
> You may have Solr3.6.0 (seems you were not sure about the version)

What's a good way of checking the version?

Eric

Matt Bartolome

unread,
May 8, 2012, 6:21:51 PM5/8/12
to django-...@googlegroups.com
I had a java heap space memory error with tomcat6 so was thinking you
might be running into the same some sort of memory error when
migrating to the new environment. Maybe you are hitting a memory
threshold when doing the rebuild_index command, which updates in
batches (you can configure this setting) where as in the script you
are only updating one object at a time.

William Burris

unread,
May 8, 2012, 8:20:51 PM5/8/12
to django-...@googlegroups.com
if you can get the admin screen to load in your browser check the "info'" page.  You can also look at the directory structure of the example, if you have a have a /lang subdirectory below solr/conf and it contains stopwords_en.txt you probably have 3.6.0.


Eric

--
You received this message because you are subscribed to the Google Groups "django-haystack" group.
To post to this group, send email to django-...@googlegroups.com.
To unsubscribe from this group, send email to django-haysta...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-haystack?hl=en.

Reply all
Reply to author
Forward
0 new messages