I’m working on getting django-haystack set up on my site, and am trying to have snippets in my search results roughly like so:
Title of result one about Wikis
…this special thing about wiki values is that…I always use a wiki when I walk…snippet value three talks about wikis too…and here’s another snippet value
about wikis.
I know there’s a template tag that uses Haystack code to do the the highlighting, but the snippets it generates are pretty limited:
- they always start with the query word
- there’s only one snippet value
- they don’t support asterisk queries
- and other stuff?
Is there a way to use the Solr backend to generate proper snippets as shown above?
Bottom line is that the Solr highlighting can’t really be used by Haystack in a flexible way. I spoke to the main developer for Haystack on IRC, and he said basically, if I want to have the kind of highlighting I’m looking for, the only way to get it is to extend the Solr backend that Haystack uses.
I dabbled in that for about half a day, but couldn’t get Haystack to recognize my custom back end. Haystack has some magic backend loading code that just wasn’t working with me.
Consequently, I’ve switched over to sunburnt, which provides a lighter-weight and more extensible wrapper around Solr. I’m hoping it will fare better.