Given a document structure that has say 15 properties, and 3 IEnumerable properties where every such property can have upto 20 values..
when I have 50,000 such documents in raven, given the user can build a criteria by providing values against 7 or so properties..
and say 30 unique searches are performed repeatedly most often, and on an average a user will page through five pages for each search performed.
Now say I find 7000 results matching some criteria constructed by the user, if I choose to retrieve all the 7000 ids matching the criteria (continually skip take to retrieve all I imagine), and then hash the criteria and use it as a key to store the 7000 values in memcached, then when the same criteria is searched for again, I can simply retrieve the ids from the cache, get the 10 ids for the page the user is on, and load results by id from raven. Also when they page, I can choose to not perform the same search again with skip and take, but simply go to the cache and get ids for the next page go to raven for load.
In other words for every criteria not searched before, we perform the search, retrieve matching ids, cache them against the criteria hashed as key, then when a user pages that search result or another user performs the same search, we simply go to raven to load by ids that we can retrieve from memcached by looking up the hashed criteria as key.
Does this approach give me any dividends over just doing the search all the time, skip take when required to page, and let raven do the magic of reusing dynamic indexes when searches are reused?
Note: I am using the LINQ api.
You are talking about building your own index. It doesn’t matter if you use memcached or whatever technology to store your index, it will be just that -> an index.
Lucene.NET has been heavily optimized to be very fast on queries like the one you described, so chances are low you will do better. You need consider very difficult scenarious like stale indexes, concurrency etc. Even if you could do better, is it really worth? I mean wouldn’t it be much cheaper just to put another CPU into your machine if you want your searches to perform faster?
To be clear – yes, I absolutely do think you should use the standard LINQ api and let RavenDB create dynamic indexes. If they are used really that often, RavenDB will promote them as permanent indexes very soon.