The Raven query returns 0 results for the collection.

I have a basic circuit

Post {
    Labels: [
        { Text: "Mine" }
        { Text: "Incomplete" }
    ]
}

And I turn to the raven to request all messages from BOTH "Mine" and "Incomplete".

queryable.Where(candidate => candidate.Labels.Any(label => label.Text == "Mine"))
    .Where(candidate => candidate.Labels.Any(label => label.Text == "Incomplete"));

This results in a raven request (from the Raven server console)

Query: (Labels,Text:Incomplete) AND (Labels,Text:Mine)
Time: 3 ms
Index: Temp/XWrlnFBeq8ENRd2SCCVqUQ==
Results: 0 returned out of 0 total.

Why is this? If I ask for a JUST containing "Incomplete", I get 1 result. If I ask for a JUST containing "Mine", I get the same result - so WHY when I ask for both of them, I get 0 results?

EDIT:

Ok, so I got a little further. An "automatically generated index" looks like this:

from doc in docs.FeedAnnouncements
from docLabelsItem in ((IEnumerable<dynamic>)doc.Labels).DefaultIfEmpty()
select new { CreationDate = doc.CreationDate, Labels_Text = docLabelsItem.Text }

So, I THINK that the query basically tested the SAME label for two different values. Bad

I changed it to this:

from doc in docs.FeedAnnouncements
from docLabelsItem1 in ((IEnumerable<dynamic>)doc.Labels).DefaultIfEmpty()
from docLabelsItem2 in ((IEnumerable<dynamic>)doc.Labels).DefaultIfEmpty()
select new { CreationDate = doc.CreationDate, Labels1_Text = docLabelsItem1.Text, Labels2_Text = docLabelsItem2.Text }

Now my request (in Raven Studio) is Labels1_Text:Mine AND Labels2_Text:IncompleteWORKS!

phantom (Labels1_Text Labels2_Text) Linq?

+3
1

, . 2 , .

, :

from doc in docs.FeedAnnouncements
select new { Labels_Text = doc.Labels.Select(x=>x.Text)}

, .

+1

All Articles