Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>First, you'll need to make sure that you store the fields you are indexing. This is required so you can get the <em>index results</em> back, instead of the <em>documents</em> that matched the index.</p> <p>Add this to the bottom of your index definition:</p> <pre><code>StoreAllFields(FieldStorage.Yes); </code></pre> <p>Or if you want to be more verbose, (perhaps your index is doing other things also):</p> <pre><code>Store(x =&gt; x.Game, FieldStorage.Yes); Store(x =&gt; x.Member, FieldStorage.Yes); Store(x =&gt; x.List, FieldStorage.Yes); </code></pre> <p>When you query this, you'll need to tell Raven to send you back the index entries, by using <code>ProjectFromIndexFieldsInto</code> <a href="http://ravendb.net/docs/2.5/client-api/querying/results-transformation/project-from-index-fields-into" rel="nofollow">as described here</a>.</p> <p>Next, you need to realize that you aren't creating any single index entry that will match your query. The multimap index is creating <em>separate</em> entries in the index for each map. If you want to combine them in your results, you'll need to use an <a href="http://ravendb.net/docs/2.5/client-api/querying/intersection" rel="nofollow">intersection query</a>.</p> <p>Putting this together, your query should look like this:</p> <pre><code>var q = session.Query&lt;TradingIndex.Result, TradingIndex&gt;() .Where(g =&gt; g.Game.In(gamesIWant) &amp;&amp; g.List == TradingIndex.ListType.Tradelist &amp;&amp; g.Member != me.Id) .Intersect() .Where(g =&gt; g.Game.In(gamesITrade) &amp;&amp; g.List == TradingIndex.ListType.Wishlist &amp;&amp; g.Member != me.Id) .ProjectFromIndexFieldsInto&lt;TradingIndex.Result&gt;(); </code></pre> <p><a href="https://gist.github.com/mj1856/7284038" rel="nofollow">Full test in this GIST</a>.</p>
    singulars
    1. This table or related slice is empty.
    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.
 

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