Hi,

I think stock example from official ref guide will do the trick.
Please see :
https://cwiki.apache.org/confluence/display/solr/Tokenizers#Tokenizers-RegularExpressionPatternTokenizer

<fieldType name="comma_split" class="solr.TextField" positionIncrementGap="100">
   <analyzer>
   <tokenizer class="solr.PatternTokenizerFactory" pattern="\s*,\s*"/>
   </analyzer>
</fieldType>


Ahmet


On Tuesday, May 17, 2016 8:31 AM, SRINI SOLR <srini.s...@gmail.com> wrote:
Hi Ahmet / Team -
Thanks for your quick response...

Can you please help me out on this PatternTokenizer configuration.......
Here we are using configuration as below ...

<field name="category" type="text_general" indexed="true" stored="true" />

<fieldType name="text_general" class="solr.TextField"
positionIncrementGap="100">
<analyzer type="index">
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.StopFilterFactory" ignoreCase="true"
words="stopwords.txt" enablePositionIncrements="true" />
<filter class="solr.LowerCaseFilterFactory"/>
</analyzer>
<analyzer type="query">
<tokenizer class="solr.StandardTokenizerFactory"/>
<filter class="solr.StopFilterFactory" ignoreCase="true"
words="stopwords.txt" enablePositionIncrements="true" />
<filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt"
ignoreCase="true" expand="true"/>
<filter class="solr.LowerCaseFilterFactory"/>
</analyzer>
</fieldType>

And also - I have made changes to the field value so that it is separated
by space instead of commas and indexed the data as such... And now I was
able to retrieve the expected results.

But Still Can you help me out in achieving the results using the comma as
you suggested.

Thanks & Regards


On Mon, May 16, 2016 at 5:50 PM, Ahmet Arslan <iori...@yahoo.com.invalid>
wrote:

> Hi,
>
> Its all about how you tokenize the category field.
> It looks like you are using a string type, which does not tokenize at all
> (e.g. verbatim)
> Please use a PatterTokenizer and configure it so that it splits on comma.
>
> Ahmet
>
>
>
> On Monday, May 16, 2016 2:11 PM, SRINI SOLR <srini.s...@gmail.com> wrote:
> Hi Team -
> Can you please help me out on the following ...
>
> I have a following field in the solr document which has the comma seperated
> values like below ..
>
> <category>1,456,768,345</category>  doc1
> <category>456</category>                 doc2
> <category>1,456</category>              doc3
>
> So - Here I need to filter the search docs which contains category is
> 456...
> when i do like following ...
>
> fq=category:456
>
> it is returning only one document doc2 which has only category is 456.
> <category>456</category>
>
> But I need other two also which as this category 456....
>
> Can you please help me out to achieve this ...
>
>
> Thanks & Regards
>

Reply via email to