Dear Robert and Anton,
Thanks a lot for the help! I want to page data sets about 50 items per
page ordered by DateTimeProperty desc or asc.
Joining two queries works that as far as I understand I don't have to
iterate and only sort it according to time and pick the 50 most
relevant (depending on viewing newest or oldest) and I also could use
index entities. Listing apartments this way is a feature craigslist
has
http://sfbay.craigslist.org/hhh/
It only has 1 range filter and categories for the number of rooms.
I want to implement a similar function when all my search does so far
is
category + location. For a first version I care more that it displays
the correct results and then we
can evaluate which solution to build on. My somewhat messy attempt to
query datastore
is pasted you're welcome to have a look at:
http://pastebin.com/NVu31XGN
Thanks!
Niklas
On Jan 2, 6:18 pm, Robert Kluin <
robert.kl...@gmail.com> wrote:
> Niklas,
> That is something that would be extremely difficult to do with one
> query, given how indexes work. On the backend, your indexes look
> something like this:
>
> [your app id]|[namespace]|Apartment|rooms:[rooms value]|cost:[cost
> value]|modified
>
> That is why App Engine requires the values of rooms and cost to be
> 'fixed' (not a range). Those values are stored ordered so that
> range-scans (ie inequality filters) can be run.
>
> That's why binning the data like Anton was suggesting is a good
> solution, when it is possible. Often times it is not possible or it
> is impractical.
>
> For some use cases it may be possible to construct your own 'index
> entities' then join the results in memory to produce a result set. In
> general, to do that efficiently, you need to know something about the
> data or have small result sets.
>
> Robert
>