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 gnandre <ar...@gmail.com> on 2020/07/01 15:05:39 UTC

Downsides to applying to WordDelimiterFilter twice in analyzer chain

Hi,

To satisfy one use-case, I need to apply WordDelimiterFilter with
splitOnCaseChange
with 0 once and then with 1 again. Are there some downsides to this
approach?

Use-case is to be able to match results when indexed content is my.camelCase
and search query is camelcase.

Re: Downsides to applying to WordDelimiterFilter twice in analyzer chain

Posted by Erick Erickson <er...@gmail.com>.
Consider something other than WhitespaceTokenizer. In this case
the tokenizer would split on the period and it’d work. I don’t know
whether that would fit the rest of your problem space or not though.

But to answer your original question, no there’s no a-priori reason you
can’t have WordDelimiter(Graph)FilterFactory twice, but I suspect
better tokenization is a more robust answer.

Best,
Erick

> On Jul 1, 2020, at 3:11 PM, gnandre <ar...@gmail.com> wrote:
> 
> Here are links to images for the Analysis tab.
> 
> https://pasteboard.co/JfFTYu6.png
> https://pasteboard.co/JfFUYXf.png
> 
> 
> On Wed, Jul 1, 2020 at 3:03 PM gnandre <ar...@gmail.com> wrote:
> I am doing that already but it does not help.
> 
> Here is the complete analyzer chain.
> 
>   <fieldType name="text_en" class="solr.TextField" positionIncrementGap="100">
> 
>       
> <analyzer type="index">
> 
>         
> <tokenizer class="solr.WhitespaceTokenizerFactory"/>
> 
>         
> <filter class="solr.WordDelimiterFilterFactory" protected="protect.txt" preserveOriginal="1"  generateWordParts="1" generateNumberParts="1" catenateWords="1" catenateNumbers="1" catenateAll="0" splitOnCaseChange="1"/>
> 
>         
> <filter class="solr.LowerCaseFilterFactory"/>
> 
>         
> <filter class="solr.ICUNormalizer2FilterFactory" name="nfkc" mode="compose"/>
> 
>         
> <filter class="solr.SynonymFilterFactory" synonyms="synonyms_en.txt" ignoreCase="true" expand="true"/>
> 
>         
> <filter class="solr.KStemFilterFactory"/>
> 
>         
> <filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
> 
>       
> </analyzer>
> 
>       
> <analyzer type="query">
> 
>         
> <tokenizer class="solr.WhitespaceTokenizerFactory"/>
> 
>         
> <filter class="solr.WordDelimiterFilterFactory" protected="protect.txt" preserveOriginal="1"  generateWordParts="1" generateNumberParts="1" catenateWords="1" catenateNumbers="1" catenateAll="0" splitOnCaseChange="1"/>
> 
>         
> <filter class="solr.LowerCaseFilterFactory"/>
> 
>         
> <filter class="solr.ICUNormalizer2FilterFactory" name="nfkc" mode="compose"/>
>         <filter class="solr.SynonymFilterFactory" synonyms="synonyms_en_query.txt" ignoreCase="true" expand="true"/>
> 
>         
> <filter class="solr.KStemFilterFactory"/>
> 
>         
> <filter class="solr.RemoveDuplicatesTokenFilterFactory"/>
> 
>       
> </analyzer>
> 
>   
> </fieldType>  
> 
> 
> 
> 
> 
> On Wed, Jul 1, 2020 at 12:29 PM Erick Erickson <er...@gmail.com> wrote:
> Why not just specify preserveOriginal and follow by a lowerCaseFilter and
> use one wordDelimiterFilterFactory?
> 
> Best,
> Erick
> 
> > On Jul 1, 2020, at 11:05 AM, gnandre <ar...@gmail.com> wrote:
> > 
> > Hi,
> > 
> > To satisfy one use-case, I need to apply WordDelimiterFilter with
> > splitOnCaseChange
> > with 0 once and then with 1 again. Are there some downsides to this
> > approach?
> > 
> > Use-case is to be able to match results when indexed content is my.camelCase
> > and search query is camelcase.
> 


Re: Downsides to applying to WordDelimiterFilter twice in analyzer chain

Posted by gnandre <ar...@gmail.com>.
Here are links to images for the Analysis tab.

https://pasteboard.co/JfFTYu6.png
https://pasteboard.co/JfFUYXf.png


On Wed, Jul 1, 2020 at 3:03 PM gnandre <ar...@gmail.com> wrote:

> I am doing that already but it does not help.
>
> Here is the complete analyzer chain.
>
> <fieldType name="text_en" class="solr.TextField" positionIncrementGap=
> "100"> <analyzer type="index"> <tokenizer class=
> "solr.WhitespaceTokenizerFactory"/> <filter class=
> "solr.WordDelimiterFilterFactory" protected="protect.txt" preserveOriginal
> ="1" generateWordParts="1" generateNumberParts="1" catenateWords="1"
> catenateNumbers="1" catenateAll="0" splitOnCaseChange="1"/> <filter class=
> "solr.LowerCaseFilterFactory"/> <filter class=
> "solr.ICUNormalizer2FilterFactory" name="nfkc" mode="compose"/> <filter
> class="solr.SynonymFilterFactory" synonyms="synonyms_en.txt" ignoreCase=
> "true" expand="true"/> <filter class="solr.KStemFilterFactory"/> <filter
> class="solr.RemoveDuplicatesTokenFilterFactory"/> </analyzer> <analyzer
> type="query"> <tokenizer class="solr.WhitespaceTokenizerFactory"/> <filter
> class="solr.WordDelimiterFilterFactory" protected="protect.txt"
> preserveOriginal="1" generateWordParts="1" generateNumberParts="1"
> catenateWords="1" catenateNumbers="1" catenateAll="0" splitOnCaseChange=
> "1"/> <filter class="solr.LowerCaseFilterFactory"/> <filter class=
> "solr.ICUNormalizer2FilterFactory" name="nfkc" mode="compose"/> <filter
> class="solr.SynonymFilterFactory" synonyms="synonyms_en_query.txt"
> ignoreCase="true" expand="true"/> <filter class="solr.KStemFilterFactory"
> /> <filter class="solr.RemoveDuplicatesTokenFilterFactory"/> </analyzer>
> </fieldType>
>
> [image: image.png]
>
> [image: image.png]
>
> On Wed, Jul 1, 2020 at 12:29 PM Erick Erickson <er...@gmail.com>
> wrote:
>
>> Why not just specify preserveOriginal and follow by a lowerCaseFilter and
>> use one wordDelimiterFilterFactory?
>>
>> Best,
>> Erick
>>
>> > On Jul 1, 2020, at 11:05 AM, gnandre <ar...@gmail.com> wrote:
>> >
>> > Hi,
>> >
>> > To satisfy one use-case, I need to apply WordDelimiterFilter with
>> > splitOnCaseChange
>> > with 0 once and then with 1 again. Are there some downsides to this
>> > approach?
>> >
>> > Use-case is to be able to match results when indexed content is
>> my.camelCase
>> > and search query is camelcase.
>>
>>

Re: Downsides to applying to WordDelimiterFilter twice in analyzer chain

Posted by gnandre <ar...@gmail.com>.
I am doing that already but it does not help.

Here is the complete analyzer chain.

<fieldType name="text_en" class="solr.TextField" positionIncrementGap="100">
<analyzer type="index"> <tokenizer class="solr.WhitespaceTokenizerFactory"/>
<filter class="solr.WordDelimiterFilterFactory" protected="protect.txt"
preserveOriginal="1" generateWordParts="1" generateNumberParts="1"
catenateWords="1" catenateNumbers="1" catenateAll="0" splitOnCaseChange="1"
/> <filter class="solr.LowerCaseFilterFactory"/> <filter class=
"solr.ICUNormalizer2FilterFactory" name="nfkc" mode="compose"/> <filter
class="solr.SynonymFilterFactory" synonyms="synonyms_en.txt" ignoreCase=
"true" expand="true"/> <filter class="solr.KStemFilterFactory"/> <filter
class="solr.RemoveDuplicatesTokenFilterFactory"/> </analyzer> <analyzer type
="query"> <tokenizer class="solr.WhitespaceTokenizerFactory"/> <filter class
="solr.WordDelimiterFilterFactory" protected="protect.txt" preserveOriginal=
"1" generateWordParts="1" generateNumberParts="1" catenateWords="1"
catenateNumbers="1" catenateAll="0" splitOnCaseChange="1"/> <filter class=
"solr.LowerCaseFilterFactory"/> <filter class=
"solr.ICUNormalizer2FilterFactory" name="nfkc" mode="compose"/> <filter
class="solr.SynonymFilterFactory" synonyms="synonyms_en_query.txt"
ignoreCase="true" expand="true"/> <filter class="solr.KStemFilterFactory"/>
<filter class="solr.RemoveDuplicatesTokenFilterFactory"/> </analyzer> </
fieldType>

[image: image.png]

[image: image.png]

On Wed, Jul 1, 2020 at 12:29 PM Erick Erickson <er...@gmail.com>
wrote:

> Why not just specify preserveOriginal and follow by a lowerCaseFilter and
> use one wordDelimiterFilterFactory?
>
> Best,
> Erick
>
> > On Jul 1, 2020, at 11:05 AM, gnandre <ar...@gmail.com> wrote:
> >
> > Hi,
> >
> > To satisfy one use-case, I need to apply WordDelimiterFilter with
> > splitOnCaseChange
> > with 0 once and then with 1 again. Are there some downsides to this
> > approach?
> >
> > Use-case is to be able to match results when indexed content is
> my.camelCase
> > and search query is camelcase.
>
>

Re: Downsides to applying to WordDelimiterFilter twice in analyzer chain

Posted by Erick Erickson <er...@gmail.com>.
Why not just specify preserveOriginal and follow by a lowerCaseFilter and
use one wordDelimiterFilterFactory?

Best,
Erick

> On Jul 1, 2020, at 11:05 AM, gnandre <ar...@gmail.com> wrote:
> 
> Hi,
> 
> To satisfy one use-case, I need to apply WordDelimiterFilter with
> splitOnCaseChange
> with 0 once and then with 1 again. Are there some downsides to this
> approach?
> 
> Use-case is to be able to match results when indexed content is my.camelCase
> and search query is camelcase.