You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@couchdb.apache.org by GitBox <gi...@apache.org> on 2018/08/17 12:48:20 UTC
[GitHub] wohali commented on issue #1565: Range values in query to complex
key view seem to be ignored
wohali commented on issue #1565: Range values in query to complex key view seem to be ignored
URL: https://github.com/apache/couchdb/issues/1565#issuecomment-413854755
Indexes work closer to the way you say in your follow-up post. If you want to limit by gender, country, and city, those items must be _first_ in your compound key. However, the remaining items are just sorted by ICU order, so anything that falls inbetween `["male","Argentina","Buenos Aires","Mar","Fru"]` and `["male","Argentina","Buenos Aires","Mar\u9999","Fru\u9999"]` *alphabetically* will match. This will include `["male","Argentina","Buenos Aires","Mar123","Jan"] because it sorts (by ICU sort order) inbetween the two keys you've provided. You can't provide what you are suggesting as a prefix limitation on the sub-keys, sorry.
You may also want to look at [Mango Indexes](http://docs.couchdb.org/en/stable/api/database/find.html) as an alternative to doing this with JS views. You may find them easier to use (though you will still need to create multiple indexes to achieve what you want). Note that using the operators such as "$regex" will cause a full table scan. You will want to investigate partial indexes to achieve what you desire, assuming you know up front you will always want to do sub-searches under known values of various keys.
The other option is full-text search with clouseau/dreyfus, but this is challenging to setup and install right now.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services