Closed tariksetia closed 8 months ago
Any help is deeply appreciated.
I'm still not able to solve this. @kvesteri, any help is deeply appreciated.
Have you tried to weight them?
https://sqlalchemy-searchable.readthedocs.io/en/latest/configuration.html#weighting-search-results
Use the search
function with sort=True
parameter to sort the results by rank:
import sqlalchemy as sa
from sqlalchemy_searchable import search
combined_search_vector = Article.search_vector | Category.search_vector
articles = session.scalars(
search(
sa.select(Article).join(Category),
search_query="matrix",
vector=combined_search_vector,
sort=True,
)
).all()
Consider the following example from documentation:
How do I sort the result by rank?