I replaced djorm’s VectorField and SearchManager with built-in solutions for handling full text search in Postgres. To do this, I added a post_save signal for the Professors app that takes care of updating the search_index using the update() method on the queryset. The djorm extension also handled auto-updating the search index with a post_save signal.
The SearchManager in djorm-ext-pgfulltext basically worked by adding an update_search_field method on the model class during model set up. It then ran a raw SQL query to keep the column up-to-date when auto_update_search_field was True.
I wasn't sure if making a new field was necessary, so I just updated the existing search_index field.
I also implemented a GIN index on the search_index field based on recommendations from this comment: https://news.ycombinator.com/item?id=16086489. As I understand it, adding an extension to the Postgres DB may be required to use the GIN index.
Also, I didn't uninstall djorm-ext-pgfulltext from the Pipfile since there is a migration which references the package...
I replaced djorm’s VectorField and SearchManager with built-in solutions for handling full text search in Postgres. To do this, I added a
post_save
signal for the Professors app that takes care of updating the search_index using theupdate()
method on the queryset. The djorm extension also handled auto-updating the search index with a post_save signal.The SearchManager in djorm-ext-pgfulltext basically worked by adding an update_search_field method on the model class during model set up. It then ran a raw SQL query to keep the column up-to-date when
auto_update_search_field
wasTrue
.I wasn't sure if making a new field was necessary, so I just updated the existing
search_index
field.I also implemented a GIN index on the search_index field based on recommendations from this comment: https://news.ycombinator.com/item?id=16086489. As I understand it, adding an extension to the Postgres DB may be required to use the GIN index.
Also, I didn't uninstall djorm-ext-pgfulltext from the Pipfile since there is a migration which references the package...