etianen / django-watson

Full-text multi-table search application for Django. Easy to install and use, with good performance.
BSD 3-Clause "New" or "Revised" License
1.2k stars 130 forks source link

Using Django-Watson to index non-database content #196

Closed engineervix closed 7 years ago

engineervix commented 7 years ago

In many cases, one needs to index flat (non-model-based) content on a website. For Haystack, Haystack Static Pages provides this functionality. In addition, Eric Holscher has documented an alternative technique which involves reading the file contents from the filesystem instead of from the database. How can one index flat (non-model-based) content using Django-Watson?

etianen commented 7 years ago

You need to register a custom SearchAdapter, as shown here:

https://github.com/etianen/django-watson/wiki/Registering-models#tweaking-search-weighting

The get_content implementation should return content loaded from the filesystem that is associated with the given model.

engineervix commented 7 years ago

Thanks @etianen I'll give it a shot.