Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Contains is indeed not yet supported (Perhaps it should be, but that's another matter entirely - we only really add support for various operators when its asked for)</p> <p>As for multiple queries against Any, I assume you're trying to do dynamic data and you want to achieve something like</p> <pre><code>"X OR Y OR Z" </code></pre> <p>That's a tricky one, and the LINQ provider by default will aggregate those multiple WHERE clauses with AND, so your example looks like</p> <pre><code>"X AND Y AND Z" </code></pre> <p>Which will obviously never be the case.</p> <p>Your best option for this one is to drop down to the Lucene query (at least for now) and do something like this:</p> <pre><code>var results = s.Advanced.LuceneQuery&lt;Item&gt;() .Where(string.Format("Tags,:({0})", string.Join(" OR ", tags))); </code></pre> <p>Make sense?</p> <p>The query above will look something like</p> <pre><code>"Tags,:(X OR Y OR Z)" </code></pre> <p><em>Note: "Tags," informs RavenDB that Tags is an array</em></p> <p>Okay, [edit]!</p> <p>The easiest way to get what you actually <em>want</em> is to do something along these lines</p> <pre><code> new IndexDefinition&lt;Item, Item&gt;() { Map = docs =&gt; from doc in docs select new { Tags = doc.Tags }, Indexes = {{ x =&gt; x.Tags, FieldIndexing.Analyzed }} }.ToIndexDefinition(store.Conventions)); </code></pre> <p>Then to query for your ands, you can do something like this:</p> <pre><code> var results = s.Advanced.LuceneQuery&lt;Item, WhateverYouCalledThatIndex&gt;() .Where(string.Format("Tags:({0})", string.Join(" AND ", tags))); </code></pre> <p>Now, things to be aware of</p> <pre><code> Tags = doc.Tags </code></pre> <p>Will serialize that entire array into one giant blob, as it's just strings that will work for this example.</p> <p>I am looking at better ways of expressing this, it is unlikely that we'll come up with a LINQ-ish way of doing this, as it doesn't really map across very well - but it <em>is</em> an answer that will work :)</p> <p>I think I'd quite like to be able to at least do</p> <pre><code> Map = docs =&gt; from doc in docs select new { Tags = String.Join(" ", doc.Tags) }, </code></pre> <p>(This won't work so don't try it), but it is a bit more explicit about what you want to achieve.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload