Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

following tutorial, schema generated by build_solr_schema is "empty" #44

Closed
abeld opened this issue Jun 16, 2009 · 3 comments
Closed

following tutorial, schema generated by build_solr_schema is "empty" #44

abeld opened this issue Jun 16, 2009 · 3 comments
Labels

Comments

@abeld
Copy link

abeld commented Jun 16, 2009

I tried following the tutorial at http://haystacksearch.org/docs/tutorial.html#haystack-tutorial, but I ended up with the following problem:
even if I have
import haystack
haystack.autodiscover()
in urls.py, build_solr_schema generates the same output as if no SearchIndex was defined. Using this schema, solr understandably gives

SEVERE: org.apache.solr.common.SolrException: no field name specified in query and no defaultSearchField defined in schema.xml

(I'll try to attach or link to a minimal example that shows this problem.)

@abeld
Copy link
Author

abeld commented Jun 16, 2009

To illustrate the problem, see http://github.com/abeld/haystack-problem/tree/master
(sorry for not forking properly)

The urls.py contains three different ways of defining indices, all three result in the same schema as if neither was enabled.

@abeld
Copy link
Author

abeld commented Jun 16, 2009

To reproduce, run
./manage.py build_solr_schema
with various parts enabled in urls.py

@toastdriven
Copy link
Contributor

I believe SHA: 95d40e4 fixes your issue. When I modify (the haystack portion) of your urls.py to be:

from trivial.models import Thing
from haystack import site
site.register(Thing)

I get the correct schema. I also get the correct schema by using:

from trivial.models import Thing
from haystack import site
from haystack import indexes
class ThingIndex(indexes.SearchIndex):
    name = indexes.CharField(document=True, model_attr='name')
site.register(Thing, ThingIndex)

The odd one out here is the autodiscover but that won't work unless you create a search_indexes.py file within your app where you register the SearchIndex classes. (This is analogous to the way django.contrib.admin does autodiscover, the only method I was using/testing and was working regardless).

Somewhere along the line, an odd regression came up and caused the erroneous behavior. It should be fixed now for all cases and I have tests to make sure it stays that way.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants