Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<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>
 

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