toastdriven/django-haystack — Issue #439: multiply HTTP requests to SOLR during single search
Author: stargazer33
Created: 2011-11-06 17:56:48+00:00
State: open

doing search, highlighting, facets and spelling suggestions produce 4 HTTP requests to SOLR backend
Is there any way to reduce number of requests to the backend? (By the way, it seems 3 from 4 requests are exactly the same!)
Here the details:

Request 1:
"GET /solr/select/?
spellcheck.count=1&rows=20&spellcheck=true&hl=true&fq=django_ct%3A%28job.joboffer%29&q=new&start=0&wt=json&hl.fragsize=200&spellcheck.collate=true&fl=%2A+score HTTP/1.1" 200 1411
it comes from this code in my subclass of SearchForm:
`
class MySearchForm(SearchForm):
...
def search(self):
sqs = super(MySearchForm, self).search().highlight()
`
Request 2:
"GET /solr/select/?spellcheck.count=1&rows=20&facet.field=job_categories_exact&hl=true&fq=django_ct%3A%28job.joboffer%29&facet=on&q=new&start=0&wt=json&hl.fragsize=200&spellcheck.collate=true&fl=%2A+score&spellcheck=true HTTP/1.1" 200 1583
comes from this code in the view:
`
results = form.search().facet('job_categories')
`
Request 3:
"GET /solr/select/?spellcheck.count=1&rows=20&facet.field=job_categories_exact&hl=true&fq=django_ct%3A%28job.joboffer%29&facet=on&q=new&start=0&wt=json&hl.fragsize=200&spellcheck.collate=true& fl=%2A+score&spellcheck=true HTTP/1.1" 200 1583
triggered by this code:
`
tmp_fields=results.facet_counts().get('fields')
`
Request 4:
"GET /solr/select/?spellcheck.count=1&rows=20&facet.field=job_categories_exact&hl=true&fq=django_ct%3A%28job.joboffer%29&facet=on&q=new&start=0&wt=json&hl.fragsize=200&spellcheck.collate=true&fl=%2A+score&spellcheck=true HTTP/1.1" 200 1583
happens when spelling suggestions retrieved:
`
results.spelling_suggestion()
`