On 12/28/05, Kevin <[EMAIL PROTECTED]> wrote: > Could anyone provide some hints on how they have implemented search > functionality on their web site? Did you do it django or use another > middleware (eg, Lucene)? If you did it django, did you bypass the ORM > and use direct SQL to take advantage of full text search?
Hey Kevin, At World Online, the search engine (lawrence.com/search, ljworld.com/search) uses swish-e (http://swish-e.org/) to index files. We made a small script that reads a custom Django setting (FULL_TEXT_INDEXING) to find out which models need to be indexed. The indexer runs on a regular basis; for each to-be-indexed model, it grabs all items in the system using get_list() (with optional limiting kwargs designated in FULL_TEXT_INDEXING), renders each result in a template according to its content type, and indexes the resulting rendered template. Then, when somebody does a search on the site, we use swish-e's Python bindings to retrieve the IDs of the objects that match the search criteria. Then we use Django's get_in_bulk() to retrieve the actual objects. get_in_bulk() takes a list of IDs and returns a dictionary of {id: object}. (Trivia: get_in_bulk() was created to solve this exact problem.) Hope that helps! It would be pretty cool to open-source this mini search framework and pop it in django/contrib, but that would be up to Jacob to decide. Adrian -- Adrian Holovaty holovaty.com | djangoproject.com | chicagocrime.org