lucene-solr-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jack Krupansky" <>
Subject Re: Documents with multiple values in a certain field
Date Tue, 11 Jun 2013 15:06:01 GMT
The Solr Javadoc has an example:

I have a more complete example (plus others) in the book:

Example - Store a count of the values of a named multivalued field in 
another field

  <updateRequestProcessorChain name="count-features">
    <processor class="solr.CloneFieldUpdateProcessorFactory">
      <str name="source">features</str>
      <str name="dest">features_count_i</str>
    <processor class="solr.CountFieldValuesUpdateProcessorFactory">
      <str name="fieldName">features_count_i</str>
    <processor class="solr.DefaultValueUpdateProcessorFactory">
      <str name="fieldName">features_count_i</str>
      <int name="value">0</int>
    <processor class="solr.LogUpdateProcessorFactory" />
    <processor class="solr.RunUpdateProcessorFactory" />

Note the use of the Default Value Update processor to assure that the 
"features_count_i" has a numeric value of "0" if
there were no input values for the "features" field.

Index content:

  -H 'Content-type:application/json' -d '
  [{"id": "doc-1",
    "title_s": "Hello World",
    "features": ["Fast", "Cheap", "Flexible", "Reliable", "X"]}]'


  "title_s":"Hello World",

-- Jack Krupansky

-----Original Message----- 
From: Alexandre Rafalovitch
Sent: Tuesday, June 11, 2013 8:28 AM
Subject: Re: Documents with multiple values in a certain field

I believe the usual solution is to pre-calculate that by using
UpdateRequestProcessor (probably:
CountFieldValuesUpdateProcessorFactory ).

Personal blog:
- Time is the quality of nature that keeps events from happening all
at once. Lately, it doesn't seem to be working.  (Anonymous  - via GTD

On Tue, Jun 11, 2013 at 5:43 AM, Silvio Hermann <> 
> Hello,
> is there a way to get all documents where a certain field has multiple
> entries?
> best,
> Silvio 

View raw message