wohali commented on issue #1552: I need help with some queries
URL: https://github.com/apache/couchdb/issues/1552#issuecomment-412078912
 
 
   Exactly what @detroitenglish said - `$regex` will always do a full database 
scan. You can tell your query isn't using an index by making the same query 
against the `/dbname/_explain` endpoint, which will show which indexes are 
being used (and, I believe in 2.2, warns about the `$regex` operator...but I 
might be wrong.)
   
   Your options are:
   
   1. Create partial indexes using `$regex` and then query those with exact 
operators,
   1. Use `$or` to search each of the fields via an exact, `$eq` based approach
   1. Consider using the `$in` operator, but keep in mind this will still have 
to fully scan all documents in an index (thus, being faster than `$regex`, but 
will be slower than an exact-based search)
   1. Build a custom CouchDB that includes the dreyfus/clouseau support (which 
is Apache Lucene based) and do a full-text search using the `$text` operator
   
   Hopefully one of these options will help.

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to