您的位置:首页 > 编程语言 > Go语言

Django and full-text search

2012-06-08 09:34 441 查看
Structure in the flow » Blog Archive » Django and full-text search

Django and full-text search

13th February 2009, 11:18 am Lately I’ve been searching for a simple solution for full-text Model search using Django. Every task up to this point just seemed so easy, so I was a bit surprised to discover there’s no quick, clean and preferred way to go about adding site search functionality in the framework.

So far, the information I read seems to suggest existing solutions are:

Based on a dedicated full-text search module djangosearch Supposed to become the official search contrib. Rather recent history (during 2008).
It’s an framework over existing, dedicated full text indexing engines: Lucene (Java version)
Solr (still Java, and also based on Lucene)
Xapian (C++)
HyperEstraier

django-sphinx Wrapper around Sphinx full-text search engine

Based on a database engine full-text capability (ie. you must create full text indexes with appropriate DB commands) For the MySQL backend, there’s already a “fieldname__search” syntax already supported in the framework, translating into a MATCH AGAINST query in SQL. Supports basic boolean operators
Reference (look at the conclusion of the article)

For PostgreSQL, depending on the version of the engine, there are solutions, but they seem complex, relative to the MySQL approach

Most simple, but very inefficient: based on a simple LIKE %keyword% query Uses the “fieldname__icontains” filter syntax
That’s what I used temporarily for get the feature going in my prototype

Other approaches are mentioned in this thread on StackOverflow.

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: