postgresql - Partial text search with postgreql & django -
tried implement partial text search postgresql , django,used following query
entry.objects.filter(headline__contains="search text")
this returns records having exact match,ie suppose checking match against record "welcome new world" query __contains="welcome world" , returns 0 records
how can implement partial text search postgresql-8.4 , django?
if want exact partial search can use startswitch field lookup method: entry.objects.filter(headline__startswith="search text"). see more info @ https://docs.djangoproject.com/en/dev/ref/models/querysets/#startswith.
this method creates query ("select ... headline 'search text%'") if you're looking fulltext alternative can check out postgresql's built in tsearch2 extension or other options such xapian, solr, sphinx, etc.
each of former engines mentioned have django apps makes them easier integrate: djapian xapian integration or haystack multiple integrations in 1 app.
Comments
Post a Comment