Closed mahara closed 9 years ago
This is not supported. It could probably be implemented, but Lucene does not support a query like this natively. Probably the approach would be to generate a Boolean query testing a field against each distinct value in the collection.
The best work around at the moment is probably something like:
var query = session.Query();
var docs = ids.Select(i => query.Where(d => d.Id == i).SingleOrDefault()).ToList();
This would execute a single query for each id instead of executing them all in a single query. Without profiling I'm not sure how much advantage there would be to try to do them all in a single query.
IC.
Yup, that's what basically I'm doing, querying document per its ID. I'm just looking for if there were any better and performant way in doing that.
Thanks for the clarification!
Hi,
I have an issue with
Contains()
given the following LINQ:where
ids
is a list/collection of document ID to be queried.Is this a supported scenario?
Here's the exception details: