I'm trying to retrieve documents based on this query:
var importantBacklogItems = _session.Query<BacklogItem>().Where(bli => bli.BusinessValue >= BusinessValue.L);
the BusinessValue enum:
public enum BusinessValue
{
XL = 5,
L = 4,
M = 3,
S = 2,
XS = 1
}
This should yield 6 documents out of 8, but I'm getting all 8 as a result.
If run the same query on a collection in memory, I get the correct results as expected (6 documents):
So, this fails:
[Test]
public void All_backlogItems_with_a_BusinessValue_equal_or_higher_than_Large()
{
var importantBacklogItems = _session.Query<BacklogItem>().Where(bli => bli.BusinessValue >= BusinessValue.L);
Assert.AreEqual(6, importantBacklogItems.Count());
}
This works:
[Test]
public void All_backlogItems_with_a_BusinessValue_equal_or_higher_than_Large_On_a_collection_in_memory()
{
var allbacklogitems = _session.Query<BacklogItem>().ToList();
var importantBacklogItems = allbacklogitems.Where(bli => bli.BusinessValue >= BusinessValue.L);
Assert.AreEqual(6, importantBacklogItems.Count());
}
So, I partially know why this is happening: RavenDB is not (and cannot) use the int values of my enum (they are not stored in the document). Question is: (how) can I make sure RavenDB is acting the same as the default Linq provider.
btw, is there a way to see the Lucene queries that are send to RavenDB?