On Mar 8, 2014, at 1:12 AM, archit agarwal <[email protected]> wrote:

> 1. location (Can choose multiple)
> 2. Price (range)
> 3. move in date (range)

It's hard to query on multiple independent ranges like this. The best you can 
do is to query on one of the ranges, then manually filter the results by the 
other(s). To decide which criterion to index, consider which one is the best at 
narrowing in on the desired documents. (The same issue comes up with relational 
databases, it's just that SQL will do the in-memory filtering for you, so you 
don't have to think about this until you try to figure out why your query is 
slow.)

What I would do is
        emit([location, price], moveInDate)

Then for each given location I'd query by
        startKey=[location, minPrice]
        endKey=[location, maxPrice]
and then filter the results by comparing the value (the moveInDate) against the 
date range.

But it's possible that it would be more efficient to let the view index the 
moveInDate instead, and manually filter the price range.

--Jens

-- 
You received this message because you are subscribed to the Google Groups 
"Couchbase Mobile" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/mobile-couchbase/56BEC1F9-1786-4EA6-8DB4-460AE8E2856D%40couchbase.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to