: Exactly, and the question is how to populate at index time a boolean field
: based on the content of another one ?
: My initial idea was to make a copy of the initial field  - and 'filter' it
: to a boolean value (by specifying some analyzer in schema.xml)  - but , as I
: said, I might miss some basic Solr ideas.

your theory makes sense, but implementing it with an analyzer probably 
isn't the best choice:  analyzers only work on TextFields, and it would 
make a lot more sense for this to be a BooleanField

I would suggest using some update processors for this...

https://wiki.apache.org/solr/UpdateRequestProcessor

Starting with Solr 4.0 there is a toolkit of easy to re-use 
UpdateProcessorFactories for dealing with field values.  What you are 
describing could be done fairly easily by using the 
CloneFieldUpdateProcessorFactory + RegexReplaceUpdateProcessorFactory + 
DefaultValueUpdateProcessorFactory...

https://lucene.apache.org/solr/api-4_0_0-BETA/org/apache/solr/update/processor/CloneFieldUpdateProcessorFactory.html
https://lucene.apache.org/solr/api-4_0_0-BETA/org/apache/solr/update/processor/RegexReplaceProcessorFactory.html
https://lucene.apache.org/solr/api-4_0_0-BETA/org/apache/solr/update/processor/DefaultValueUpdateProcessorFactory.html

Something like this would probably work...

  <processor class="solr.CloneFieldUpdateProcessorFactory">
   <arr name="source">
    <str>specialField</str>
   </arr>
   <str name="dest">hasValueOfSpecialField</str>
  </processor>
  <processor class="solr.RegexReplaceProcessorFactory">
   <str name="fieldName">hasValueOfSpecialField</str>
   <str name="pattern">.+</str>
   <str name="replacement">true</str>
 </processor>
 <processor class="solr.DefaultValueUpdateProcessorFactory">
   <str name="fieldName">hasValueOfSpecialField</str>
   <str name="value">false</str>
 </processor>


...but you may have to tinker.

-Hoss

Reply via email to