How to enable faceted search in Oscar ?

1,004 views
Skip to first unread message

Yugal Jindle

unread,
Jul 10, 2013, 12:12:34 AM7/10/13
to django...@googlegroups.com
Hi all,

I am very new to Oscar, I have been trying to use the builtin support for faceted search for my Oscar project but I have no clue (can't find any documentation).

I have : 

- My elastic search running at port 9200
- Haystack settings :

HAYSTACK_CONNECTIONS = {
    'default': {
        'ENGINE': 'haystack.backends.elasticsearch_backend.ElasticsearchSearchEngine',
        'URL': 'http://127.0.0.1:9200/',
        'INDEX_NAME': 'haystack',
    },
}

- I was able to index my catalogue successfully with ` python manage.py rebuild_index `


But my /search/ page still lists only categories to click through. I digged in deeper into the views.py in search app (from oscar) and found its MultiFacetedSearchView is rendering 'search/results.html'

And 'search/results.html' seems to be looping over categories and rendering categories only. Nothing related to faceted search.


I don't know if i am missing something or what ?
How should I enable faceted search for my catelogue ? [ If its a 1 step process ]
Even if its not a 1 step process, then can you link me to some code snippets or documentation ( I was enable to find any ) ?

[ Also, I am new to haystack as well so may be I am asking something stupid ]

Michael Lind Hjulskov

unread,
Aug 4, 2014, 4:45:33 AM8/4/14
to django...@googlegroups.com
Hi

I too cant get facets working on oscar ver 0.7.2
No facets is showing up and I tried playing around with settings.OSCAR_SEARCH_FACETS
Havent got a clue what I need to do to activate it

Maybe you've found the way to do it?
Please let me know

Michael

Michael Lind Hjulskov

unread,
Aug 4, 2014, 4:52:06 AM8/4/14
to django...@googlegroups.com

BugSpencer

unread,
Aug 4, 2014, 8:12:45 AM8/4/14
to django...@googlegroups.com
The key part is to use something different from SimbleBackend, which is a kind of "noop" backend, for Haystack to work properly.

Oscar only supports Solr officially, but I can assure you that ElasticSearch works too and even Whoosh works for basic facets.
Of course you have to take care of installing the correct python library ("pyelasticsearch" and "Whoosh" iirc) to make it work.

If you choose Elasticsearch you also need to set up a server on your own (as you would with Solr) or find a provider online.

If you want basic facet support using whoosh (e.g. NO query facets) you can't pip install haystack stable version,
but have to choose a commit from parruc/audax fork, as it's still not merged even if it's 1 year old.
To be honest haystack seems quite "dormient" lately, but maybe this weekend there will be a new release.

This is just for reference if you want something up and running "quicker" than Solr, just to see how it works.
Solr seems to be the only supported backend for going in production.

Michael Lind Hjulskov

unread,
Aug 7, 2014, 2:46:01 AM8/7/14
to django...@googlegroups.com
Thanks alot for this explaining / information :)
Seems like its a lot of very complicated work, so I think I will just skip the faceted search.

Wish I could be easier to customize things like that, and many other things in Oscar...
Its like its made for geeks with 3 heads :) and I only have one :)

Thanks though :)

Kishan Mehta

unread,
Sep 22, 2015, 2:44:58 AM9/22/15
to django-oscar
Can I use faceted search for filtering down already existing product listing page ?? FIltering criterias are attributes of products like year , price , etc .

Thanks for help.
Kishan
Reply all
Reply to author
Forward
0 new messages