2

With Django 1.6 and postgres and the module djorm-ext-pgfulltext, I am trying to perform full text searches that use greedy matching(ie: app would match apple) instead of exact word matching.

I see that postgres has pg_trgm module(http://www.postgresql.org/docs/9.0/static/pgtrgm.html) for this(match 3 consecutive characters of search word). However, I am pretty stumped on how I would integrate/use this in djorm-ext-pgfulltext. I know that SearchManager() does take a config arguement, but I am not sure how I would use pg_trgm in it. I read over making my own configuration file enter link description here but I don't see a way to integrate pg_trgm in there ether.

objects = SearchManager(
    fields = ('name', 'description'),
    config = 'pg_catalog.english', # this is default
    search_field = 'search_index', # this is default
    auto_update_search_field = True
)
dman
  • 10,406
  • 18
  • 102
  • 201

1 Answers1

1

Found this post which solved all my problems. All I needed to do was go into the database and run CREATE EXTENSION pg_trgm;

Similarity function in Postgres with pg_trgm

Community
  • 1
  • 1
dman
  • 10,406
  • 18
  • 102
  • 201