You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by marotosg <ma...@gmail.com> on 2016/01/06 14:43:14 UTC

Count multivalued field issue

Hi,

I am trying to add a new field to my schema to add the number of items of a
multivalued field.
I am using solr 4.11

These are my fields on *schema.xml*
<field name="EmailListS" type="textWildcardSearch" indexed="true"
multiValued="true" stored="true" />  
<field name="EmailListCountD" type="int" indexed="true"  stored="true" />  

Here is the update done to my *solrconfig.xml*. I created an
updateRequestProcessorChain 
and add it to the update handler

<updateHandler class="solr.DirectUpdateHandler2">
        <lst name="defaults">
		<str name="update.chain">countfields</str>
	</lst>
</updateHandler>

<updateRequestProcessorChain name="countfields">
   <processor class="solr.CloneFieldUpdateProcessorFactory">
     <str name="source">EmailListS</str>
     <str name="dest">EmailListCountD</str>
   </processor>
   <processor class="solr.CountFieldValuesUpdateProcessorFactory">
     <str name="fieldName">EmailListCountD</str>
   </processor>
   <processor class="solr.DefaultValueUpdateProcessorFactory">
     <str name="fieldName">EmailListCountD</str>
     <int name="value">0</int>
   </processor>
   <processor class="solr.LogUpdateProcessorFactory" />
   <processor class="solr.RunUpdateProcessorFactory" />
 </updateRequestProcessorChain>

Am I doing somwthing wrong here?

Thanks for your help.




--
View this message in context: http://lucene.472066.n3.nabble.com/Count-multivalued-field-issue-tp4248878.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Count multivalued field issue

Posted by Binoy Dalal <bi...@gmail.com>.
You haven't given any name to your update handler. How are you planning to
call it?

On Wed, 6 Jan 2016, 19:41 GW <th...@gmail.com> wrote:

> When dealing with Solr data you need to decide whether or not to go
> programming.
>
> when I want to count a multi-value I go programming.
>
>
> $count = array_count($array);
>
>
>
> On 6 January 2016 at 08:43, marotosg <ma...@gmail.com> wrote:
>
> > Hi,
> >
> > I am trying to add a new field to my schema to add the number of items
> of a
> > multivalued field.
> > I am using solr 4.11
> >
> > These are my fields on *schema.xml*
> > <field name="EmailListS" type="textWildcardSearch" indexed="true"
> > multiValued="true" stored="true" />
> > <field name="EmailListCountD" type="int" indexed="true"  stored="true" />
> >
> > Here is the update done to my *solrconfig.xml*. I created an
> > updateRequestProcessorChain
> > and add it to the update handler
> >
> > <updateHandler class="solr.DirectUpdateHandler2">
> >         <lst name="defaults">
> >                 <str name="update.chain">countfields</str>
> >         </lst>
> > </updateHandler>
> >
> > <updateRequestProcessorChain name="countfields">
> >    <processor class="solr.CloneFieldUpdateProcessorFactory">
> >      <str name="source">EmailListS</str>
> >      <str name="dest">EmailListCountD</str>
> >    </processor>
> >    <processor class="solr.CountFieldValuesUpdateProcessorFactory">
> >      <str name="fieldName">EmailListCountD</str>
> >    </processor>
> >    <processor class="solr.DefaultValueUpdateProcessorFactory">
> >      <str name="fieldName">EmailListCountD</str>
> >      <int name="value">0</int>
> >    </processor>
> >    <processor class="solr.LogUpdateProcessorFactory" />
> >    <processor class="solr.RunUpdateProcessorFactory" />
> >  </updateRequestProcessorChain>
> >
> > Am I doing somwthing wrong here?
> >
> > Thanks for your help.
> >
> >
> >
> >
> > --
> > View this message in context:
> >
> http://lucene.472066.n3.nabble.com/Count-multivalued-field-issue-tp4248878.html
> > Sent from the Solr - User mailing list archive at Nabble.com.
> >
>
-- 
Regards,
Binoy Dalal

Re: Count multivalued field issue

Posted by GW <th...@gmail.com>.
When dealing with Solr data you need to decide whether or not to go
programming.

when I want to count a multi-value I go programming.


$count = array_count($array);



On 6 January 2016 at 08:43, marotosg <ma...@gmail.com> wrote:

> Hi,
>
> I am trying to add a new field to my schema to add the number of items of a
> multivalued field.
> I am using solr 4.11
>
> These are my fields on *schema.xml*
> <field name="EmailListS" type="textWildcardSearch" indexed="true"
> multiValued="true" stored="true" />
> <field name="EmailListCountD" type="int" indexed="true"  stored="true" />
>
> Here is the update done to my *solrconfig.xml*. I created an
> updateRequestProcessorChain
> and add it to the update handler
>
> <updateHandler class="solr.DirectUpdateHandler2">
>         <lst name="defaults">
>                 <str name="update.chain">countfields</str>
>         </lst>
> </updateHandler>
>
> <updateRequestProcessorChain name="countfields">
>    <processor class="solr.CloneFieldUpdateProcessorFactory">
>      <str name="source">EmailListS</str>
>      <str name="dest">EmailListCountD</str>
>    </processor>
>    <processor class="solr.CountFieldValuesUpdateProcessorFactory">
>      <str name="fieldName">EmailListCountD</str>
>    </processor>
>    <processor class="solr.DefaultValueUpdateProcessorFactory">
>      <str name="fieldName">EmailListCountD</str>
>      <int name="value">0</int>
>    </processor>
>    <processor class="solr.LogUpdateProcessorFactory" />
>    <processor class="solr.RunUpdateProcessorFactory" />
>  </updateRequestProcessorChain>
>
> Am I doing somwthing wrong here?
>
> Thanks for your help.
>
>
>
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/Count-multivalued-field-issue-tp4248878.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>

Re: Count multivalued field issue

Posted by Jack Krupansky <ja...@gmail.com>.
Out of curiosity, where did you get your example code from - so we can
assure that it gets corrected?

Here's a valid example, from de-dupe:

<requestHandler name="/update" class="solr.UpdateRequestHandler" >
  <lst name="defaults">
    <str name="update.chain">dedupe</str>
  </lst>
...
</requestHandler>

Note it is the request handler for "/update", not the "update handler."

See:
https://cwiki.apache.org/confluence/display/solr/De-Duplication

It is unfortunate that such an example is not given in the actual update
request processor doc, which only shows an example for the Solr Cell
request handler:
https://cwiki.apache.org/confluence/display/solr/Update+Request+Processors

If that still doesn't work, be sure to provide detail of what the symptom
is rather than simply saying that it doesn't work.


-- Jack Krupansky

On Wed, Jan 6, 2016 at 8:43 AM, marotosg <ma...@gmail.com> wrote:

> Hi,
>
> I am trying to add a new field to my schema to add the number of items of a
> multivalued field.
> I am using solr 4.11
>
> These are my fields on *schema.xml*
> <field name="EmailListS" type="textWildcardSearch" indexed="true"
> multiValued="true" stored="true" />
> <field name="EmailListCountD" type="int" indexed="true"  stored="true" />
>
> Here is the update done to my *solrconfig.xml*. I created an
> updateRequestProcessorChain
> and add it to the update handler
>
> <updateHandler class="solr.DirectUpdateHandler2">
>         <lst name="defaults">
>                 <str name="update.chain">countfields</str>
>         </lst>
> </updateHandler>
>
> <updateRequestProcessorChain name="countfields">
>    <processor class="solr.CloneFieldUpdateProcessorFactory">
>      <str name="source">EmailListS</str>
>      <str name="dest">EmailListCountD</str>
>    </processor>
>    <processor class="solr.CountFieldValuesUpdateProcessorFactory">
>      <str name="fieldName">EmailListCountD</str>
>    </processor>
>    <processor class="solr.DefaultValueUpdateProcessorFactory">
>      <str name="fieldName">EmailListCountD</str>
>      <int name="value">0</int>
>    </processor>
>    <processor class="solr.LogUpdateProcessorFactory" />
>    <processor class="solr.RunUpdateProcessorFactory" />
>  </updateRequestProcessorChain>
>
> Am I doing somwthing wrong here?
>
> Thanks for your help.
>
>
>
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/Count-multivalued-field-issue-tp4248878.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>