Is there something fundamentally wrong with the approach I am currently using i.e. by doing multiple ranges in the keys? Because it did seem to work fine.
When you say filter manually - you mean just filter it and store it in an array or something? Because I am using CB as a datasource for a tableview. On Sunday, March 9, 2014 3:40:57 AM UTC+8, Jens Alfke wrote: > > > On Mar 8, 2014, at 1:12 AM, archit agarwal <[email protected]<javascript:>> > 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/123a93fb-2efb-447b-bee8-a5635b0103ec%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
