Skip to content

Commit

Permalink
Start indexing observation text in FTS table
Browse files Browse the repository at this point in the history
  • Loading branch information
JWCook committed Jul 2, 2024
1 parent 5d8da79 commit 1531a4f
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions naturtag/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,8 @@ def count(self, username: str, **params) -> int:
def search(self, **params) -> WrapperPaginator[Observation]:
"""Search observations, and save results to the database (for future reference by ID)"""
results = super().search(**params).all()
self.save(results)
if results:
self.save(results)
return WrapperPaginator(results)

def get_user_observations(
Expand Down Expand Up @@ -155,8 +156,9 @@ def get_user_observations(
return list(obs)

def save(self, observations: list[Observation]):
"""Save observations to the database"""
"""Save observations to the database (full records + text search index)"""
save_observations(observations, self.client.db_path)
index_observation_text(observations, self.client.db_path)


class TaxonDbController(TaxonController):
Expand Down

0 comments on commit 1531a4f

Please sign in to comment.