You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
one thing i've noticed is that the ordering of the results is done by case which seems quite inefficient or at least if you don't have a limit on the number of search results would create a really large query string.
the problem i see: while i do want a limit on the number of search results i also have some other filters in my query before i apply the search, e.g. the document shouldn't be older than a few days. since whoosh doesn't pay attention to these other filters it might very well be that i set a whoosh limit of 10 but then i get 10 articles which are subsequently filtered out by my other condition, leaving me with nothing. therefore i would apply .limit(10) on the query afterwards. however then i still have the problem that the first 10 articles that are ordered by default might not be the ones i'm left with after the other filter conditions are applied and of course i would still like to have my final search results ordered. but with no limit, ordering all my results will result in this huge query as mentioned in the beginning.
Overwriting the __iter__() method would certainly be an ideal solution, I was looking at WhooshAlchemy as well and I like it. The current solution is kind of simplistic and I agree it's far from ideal. I don't have time to work on this right now, but I'd gladly accept PR that would implement sorting via the __iter__() method.
one thing i've noticed is that the ordering of the results is done by case which seems quite inefficient or at least if you don't have a limit on the number of search results would create a really large query string.
the problem i see: while i do want a limit on the number of search results i also have some other filters in my query before i apply the search, e.g. the document shouldn't be older than a few days. since whoosh doesn't pay attention to these other filters it might very well be that i set a whoosh limit of 10 but then i get 10 articles which are subsequently filtered out by my other condition, leaving me with nothing. therefore i would apply
.limit(10)
on the query afterwards. however then i still have the problem that the first 10 articles that are ordered by default might not be the ones i'm left with after the other filter conditions are applied and of course i would still like to have my final search results ordered. but with no limit, ordering all my results will result in this huge query as mentioned in the beginning.i'm not sure what would be a good way to improve this, but flask-whooshalchemy overwrites the
__iter__()
method of the query class (https://github.com/gyllstromk/Flask-WhooshAlchemy/blob/master/flask_whooshalchemy.py#L60) which doesn't sound like such a bad idea?The text was updated successfully, but these errors were encountered: