solr - Do not show drill down results for faceted search -
i using haystack 2.4 , solr 4.* , trying faceted search. template:
<h4>by author</h4> <div> <dl> {% if facets.fields.author %} <dt>author</dt> {# provide top 5 authors #} {% author in facets.fields.author|slice:":5" %} <dd><a href="{{ request.get_full_path }}&selected_facets=author_exact:{{ author.0|urlencode }}">{{ author.0 }}</a> ({{ author.1 }})</dd> {% endfor %} {% else %} <p>no author facets.</p> {% endif %} </dl>
but shows top level results like:
author1 (20)
when click author1 drill down results, nothing shows up. added url http://localhost:8000/search/?q=test1&selected_facets=author_exact:author1&selected_facets=author_exact:author1&selected_facets=author_exact:author1
anyone has idea on it? thanks!
it seems related url.py configuration. tried use
urlpatterns = patterns('haystack.views', url(r'^$', facetedsearchview(form_class=facetedsearchform, facet_fields=['author']), name='haystack_search'), )
as mentioned in haystack faceted search documentation http://django-haystack.readthedocs.org/en/latest/faceting.html
but got error on unexpected keyword facet_fileds
. double checked haystack facetedsearchview
, searchview
's init. seems not have init parameter facet_fields
. switched following way works fine me. faceted_sqs = searchqueryset().facet('author') urlpatterns = patterns('haystack.views',url(r'^$',facetedsearchview(form_class=facetedsearchform, searchqueryset=faceted_sqs), name='haystack_search'), )
if got wrong, please point out. thanks!
Comments
Post a Comment