Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
Faceted Navigation with django-haystack and solrDjangoTO 2012-02-09Craig Nagy @nagyman
What is Faceted Navigation/Browsing?• Visible options for narrowing a set of items based on metadata; interactive  query b...
Engines with Faceted Search• Commercial: Endeca, FAST Search Server (Microsoft, SharePoint)• Open Source: solr (backed by ...
Solr• Full text, faceted, distributed, amazing performance (Java)• Lucene syntax - title:”The Right Way” AND text:go, text...
Solr Schema	• All fields to index in schema.xml. Haystack has tools to help generate this file  (manage.py build_solr_schema...
Haystack• Provides QuerySet-like API to a number of search backends  haystack.query.SearchQuerySet  • sqs = SearchQuerySet...
Haystack - Indexing• subclass haystack.indexes.SearchIndex.• prepare_<fieldname> or prepare callbacks• manage.py update_ind...
Full text indexingPrepare FieldsRegister
Not Included• Not included in Haystack  • Views, templates, utilities, generating URLs, handling special data types• Custo...
Facet Parsing• Haystack returns dictionaries of facet data; we parse into custom objects
Template Tagstemplatetags for arranging the faceted navigation
UI Pattern - Integrated Faceted Breadcrumbs (IFB)• http://boxesandarrows.com/view/faceted-finding-with (by Greg Nudelman)
Integrated Faceted Breadcrumbs
Refs• http://www.flickr.com/photos/morville/collections/72157603789246885/• http://haystacksearch.org/• https://github.com/...
Fin.
Faceted navigation using django haystack and solr
Faceted navigation using django haystack and solr
Upcoming SlideShare
Loading in …5
×

Faceted navigation using django haystack and solr

10,771 views

Published on

Started publishing some code here: https://github.com/Nagyman/django-faceted-search Lots to do to make it more generally useful as it was extracted from a larger project.

Published in: Technology
  • Ditto the two comments below. I am making progress with django-haystack-solr, but have a long way to go. I believe your presentation will be a big help, but I have a long way to go to get all the pieces working together. More code would certainly accelerate the process. Thanks for sharing what you already have. wjburris@gmail.com
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Yes, please, I am working with facets and haystack, and I would really benefit from your code, as an example. Is this part of an open source project?
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Great deck, Craig! Is your facet code published anywhere? I think a lot of people would find your classes and template tags useful, either directly or as an example to work from.
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

Faceted navigation using django haystack and solr

  1. 1. Faceted Navigation with django-haystack and solrDjangoTO 2012-02-09Craig Nagy @nagyman
  2. 2. What is Faceted Navigation/Browsing?• Visible options for narrowing a set of items based on metadata; interactive query building• Important for e-commerce sites with a significant number of products; shared classifications/metadata• Browse vs Search, Links vs. Forms
  3. 3. Engines with Faceted Search• Commercial: Endeca, FAST Search Server (Microsoft, SharePoint)• Open Source: solr (backed by Apache Lucene), Whoosh, Sphinx (“multi- queries”)• SQL - COUNT, GROUP BY, JOINs, oh my
  4. 4. Solr• Full text, faceted, distributed, amazing performance (Java)• Lucene syntax - title:”The Right Way” AND text:go, text:swim?ing, test~, craig nagy^4• JSON/XML API - transparent with Haystack• Run in a servlet container (e.g. Tomcat); Haystack provides easy local testing (Jetty) - manage.py solr --start• Data is denormalized; documents based on a schema
  5. 5. Solr Schema • All fields to index in schema.xml. Haystack has tools to help generate this file (manage.py build_solr_schema)• _exact fields for facets, multiValued=”true” for lists of data, data types
  6. 6. Haystack• Provides QuerySet-like API to a number of search backends haystack.query.SearchQuerySet • sqs = SearchQuerySet().filter(content=foo, pub_date__lte=datetime.date(2012, 1, 1))• Mirror your models, and any value you want to index• Automatic content_type handling• Performance Tip: Don’t access unindexed data
  7. 7. Haystack - Indexing• subclass haystack.indexes.SearchIndex.• prepare_<fieldname> or prepare callbacks• manage.py update_index or real-time
  8. 8. Full text indexingPrepare FieldsRegister
  9. 9. Not Included• Not included in Haystack • Views, templates, utilities, generating URLs, handling special data types• Custom Helpers: Searcher, FacetList, Facet, FacetItem, templatetags• Extras: Facet Landing Pages (e.g. Etsy, Zappos, G Adventures)
  10. 10. Facet Parsing• Haystack returns dictionaries of facet data; we parse into custom objects
  11. 11. Template Tagstemplatetags for arranging the faceted navigation
  12. 12. UI Pattern - Integrated Faceted Breadcrumbs (IFB)• http://boxesandarrows.com/view/faceted-finding-with (by Greg Nudelman)
  13. 13. Integrated Faceted Breadcrumbs
  14. 14. Refs• http://www.flickr.com/photos/morville/collections/72157603789246885/• http://haystacksearch.org/• https://github.com/toastdriven/django-haystack• http://boxesandarrows.com/view/faceted-finding-with• http://lucene.apache.org/solr/• http://django-haystack.readthedocs.org/en/latest/tutorial.html• http://www.gadventures.com/trips/
  15. 15. Fin.

×