omop.preprocess
preprocess_search_term
def preprocess_search_term(
term: str
)
Preprocess a search term for use in a full-text search query.
This function performs the following operations:
- Converts the input term to lowercase.
- Splits the term into individual words.
- Removes common stop words.
- Joins the remaining words with ’ | ’ for use in PostgreSQL’s to_tsquery function.
Parameters
term: str
The original search term.
Returns
str
A preprocessed string ready for use in a full-text search query.