-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LIMIT statement functionality #2
Comments
Peter, this is a good idea. I am not sure of the details at this time MyIndex.objects.filter(content__search='keyword')[:20] Would limit to the first 20 results. This could be added to the Sphinx backend. MyIndex.objects.filter(content__search='keyword')[20:40] The above would start at 20, and return 40 records. |
I learned something new here :) getitem() and slice objects I think your recommended implementation is elegant. I have a lot of |
Please do. |
Apparently Sphinx does not support the OFFSET keyword. This is what is used to perform a query that starts at a particular index, therefore the following is not valid:
But, this is valid:
It would be nice if Sphinx supported OFFSET in addition to LIMIT, however, we can probably do some hackery to emulate it in the SphinxSQLCompiler. More research is needed. |
Opened issue upstream. |
In the meantime, could you add simple LIMIT functionality? Also, I think django-sphinx-db should return max_matches items by default, not 20. If people want, they can still limit it using slicing, but otherwise it will confuse people. |
SQR-5028 еще один фикс связанный с претставление текста запроса SphinxQu...
The default sphinx configuration returns 20 results, it would be nice to be able to configure that from django methods on the fly.
something like:
MyIndex.objects.filter(content__serach, limit=40)
I was thinking something similar for the offset functionality, but I don't know if the RT indexes support that yet.
The text was updated successfully, but these errors were encountered: