Hello! I have a document of about 30k records which have the following key-value attributes:
{
“text1”: "SomethingText1"
“description”: “Description”
“manufacturer”: “Manufacturer”
“purposeId”: "183"
“color”: “Red”
“format”: “SomeFormat”
“name”: “SomeName”
“additional”: “true”
“outdoor”: “false”
}
My app needs to perform 2 queries. First query would be: “Get all the record that have a “purposeId” of 184 OR “additional” == true OR “outdoor” == false”. I can do this by creating a view which emits the purposeId, additional and outdoor keys. Second query would be a full text search similar to this: “text1 CONTAINS[c] %@ OR name CONTAINS[c] %@ OR manufacturer CONTAINS[c] %@ OR color CONTAINS[c] %@ OR description CONTAINS[c] %@”. I’ve managed to do it by creating a view that emits CBLTextKey and by using a “fullTextQuery”. The problem i’m having is that in some circumstance i need to combine these two queries, something similar to this: "Get all records that have a “purposeId” of 184 and “text1 CONTAINS[c] %@”. Building too many views is pretty costly because i have a lot data. Also filtering through the results of a view is pretty costly. I don’t know what’s the best way of doing or if there is even a way.
Thanks