2
votes

I am very new to Django and haystack. I started haystack with the tutorial 'Getting Started with Haystack' (http://django-haystack.readthedocs.org/en/latest/tutorial.html). I followed it completely and am able to get the results for Simple backend but not for Solr. I updated HAYSTACK_CONNECTIONS, created schema.xml and put it in the conf folder of solr, rebuilt the index and restarted the solr (and the web server too). But when I browse the page, I get no result. For the same query, Simple backend gives some result. On the solr console, I can see this:

INFO: [] webapp=/solr path=/select/ params={fl=*+score&start=0&q=e&wt=json&fq=django_ct:(myapp.note)&rows=0} hits=0 status=0 QTime=1

I had copied and pasted all source code from 'Getting Started with Haystack'. What else do I need to do to make it work? Please help!

1
q=e? Please try a q=*:* to fetch all documents indexed by Solr, and tell what happens.Jesvin Jose
For q=*:*, I could get all the rows (I have 3 rows at the moment): INFO: [] webapp=/solr path=/select/ params={fl=*+score&start=0&q=*:*&wt=json&fq=django_ct:(myapp.note)&rows=20} hits=3 status=0 QTime=0user1219791
I got why I was not getting the expected result. Actually, I wanted to get all the rows in which text fields contain a letter 'e' (LIKE '%e%' ). With Simple backend, I get the expected result but in Solr, it looks for the exact word ( = 'e')user1219791

1 Answers

0
votes

To get a query akin to LIKE '%e%', you need to use Haystack's autocomplete function.

http://django-haystack.readthedocs.org/en/latest/autocomplete.html