Note that there are some explanatory texts on larger screens.

plurals
  1. POCan I search Solr documents by member of a multi-value field?
    primarykey
    data
    text
    <p>I have a set of Solr documents containing (among other fields) multi-value fields with percentage data or -1 if the value is null, e.g.</p> <pre><code>&lt;doc&gt; ... &lt;arr name="alpha"&gt; &lt;float&gt;0.23&lt;/float&gt; &lt;float&gt;0.23&lt;/float&gt; &lt;float&gt;0.43&lt;/float&gt; &lt;/arr&gt; &lt;arr name="beta"&gt; &lt;float&gt;0.52&lt;/float&gt; &lt;float&gt;-1.0&lt;/float&gt; &lt;float&gt;0.34&lt;/float&gt; &lt;/arr&gt; &lt;arr name="gamma"&gt; &lt;float&gt;-1.0&lt;/float&gt; &lt;float&gt;-1.0&lt;/float&gt; &lt;float&gt;-1.0&lt;/float&gt; &lt;/arr&gt; ... &lt;/doc&gt; </code></pre> <p>I need to find documents where a multi-value field contains or doesn't contain a certain member for a complete set of test cases. If I can get either of the queries below to work, it would be a tremendous help to locate a particular document out of several hundred thousand:</p> <p>1) Can I find a document where <em>none</em> of the members of a specific multi-value field meet a certain criterion? (The above doc would be returned if I queried for "alpha has no members matching -1".)</p> <p>2) Can I find a document where <em>at least one</em> of the members of a specific multi-value field meets a certain criterion? (The above doc would be returned if I queried for "alpha has least one member > 0" or "beta has at least one member > 0".)</p> <p>I'm assuming that a query like <code>alpha:[0 TO 1]</code> doesn't work because the field is an array instead of a scalar. A definitive answer of "This is impossible" is just as useful as an answer of "Here's how you do it" -- thanks in advance.</p> <p><em>EDIT</em>: As with so many problems, the answer is "recheck your assumptions" -- specifically, the developer who generated our documents turned off indexing on the percentage fields.</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. 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