Login

Tag "haystack"

Snippet List

Haystack whoosh backend with custom analyzer (allow using any lang, word processing, etc)

It is a haystack custom whoosh backend which provides analyzer customisation (required `get_analyzer` method definition). That means it is possible to define any complex analyzers (see [whoosh](https://bitbucket.org/mchaput/whoosh/wiki/Home) docs and source). Sample code shows how to use it, builtin `LanguageAnalyzer` instance configured for working with russian language used as custom analyzer. Base idea taken from this snippet: [https://djangosnippets.org/snippets/3025/](https://djangosnippets.org/snippets/3025/)

  • haystack
  • stemming
  • whoosh
  • analyzer
Read More

Haystack whoosh backend for stemming non-english language words

It's haystack whoosh backend code which involves stemming for specific language in time of indexing. 2 lines was changed comparing to original whoosh backend (StemmingAnalyzer replaced with LanguageAnalyzer for russian language, list of supported languages: [here](https://bitbucket.org/mchaput/whoosh/raw/default/src/whoosh/lang/snowball/__init__.py) )

  • haystack
  • stemming
  • whoosh
Read More

haystack auto update (forget about update_index)

Dead simple snippet. Paste it in some models (i use project_specific/models.py), and you don't need to run update_index anymore. When a model is deleted from the database: it is deleted from the index. When a model is saved (created or modified): it is updated in the index.

  • haystack
Read More

Haystack objects in one query

Actually the best way to handle this is to use built-in http://docs.haystacksearch.org/dev/searchqueryset_api.html#load-all I just missed it while checking documentation and wrote this crappy snippet!

  • django
  • haystack
  • SearchQuerySet
Read More

5 snippets posted so far.