Django and Lupy
Full text search in Django
Creating Search IndexPlace this code in a view: For a model:
Real UsageI've added this code to the wiki "add page" view, after the data is validated and saved: Where diamandaSearchCache is the Lupy cache name, "WIKI_SEARCH_WITH_LUPY" is a setting in settings.py which can be True/False indicating if we use Lupy or not. This code indexes added page.
Searching is more advanced - boolean OR search for each word in the phrase. The code is part of wiki search view: Search form has a submit button called lupy: The name indicates which search (LIKE, Google or Lupy) is used by the user. Results are showed in the template: