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 Guilleret Florian <gu...@gmail.com> on 2017/08/17 12:41:35 UTC

EdgeNGramFilterFactory did not work

Hi,

I want to got this use :

My document got SKU. Like : 27VAN670

When i query 27VAN670 solr return my document well.

But when i query 27VAN solr return 0 document;

So someone telle me to use EdgeNGramFilterFactory.

With SOLR Api I add new Field Type :

{
          "add-field-type" : {
             "name":"textNgram2",
             "class":"solr.TextField",
             "positionIncrementGap":"100",
             "analyzer" : {
                "tokenizer":{
                   "class":"solr.StandardTokenizerFactory" },
                "filters":[{
                   "class":"solr.EdgeNGramFilterFactory",
                   "minGramSize":"1",
                   "maxGramSize":"15"
                   }]}
           }

        }

And I also create a new Field :

{
              "add-field":{
                 "name":"textNgramStr2",
                 "type":"textNgram2",
                 "stored":true,
                 "indexed":true
                  }
            }

Now in SOLR admin I cans saw my new textNgramStr2. And when I update
my document in solr I put SKU of my product in textNgramStr2.

But solr still found nothing when I request 27VAN

Can someone help me on that ?

Re: EdgeNGramFilterFactory did not work

Posted by Erick Erickson <er...@gmail.com>.
Have you explored eDismax? You specify what fields you want the query
distributed over, often in solrconfig.xml in a request handler.

Best,
Erick

On Mon, Aug 21, 2017 at 5:46 AM, Guilleret Florian
<gu...@gmail.com> wrote:
> Ok perfect I will do that then i have only 5-6 field so its ok.
>
> Thank you for your help !
>
> Guilleret Florian <http://www.girodmedical.com/>
> Tel : +33 6 21 28 43 06
>
> 2017-08-21 13:32 GMT+02:00 Junte Zhang <Ju...@localsearch.ch>:
>
>> Unfortunately not. I would recommend not to use a catch-all field (saves
>> storage!), but list all the fields you consider "fulltext" in your
>> application in a disjunction query. This should not come at the expensive
>> of performance, unless you have a huge amount of fields. Then it should
>> work.
>>
>> /JZ
>>
>> -----Original Message-----
>> From: Guilleret Florian [mailto:guilleret.florian@gmail.com]
>> Sent: Monday, August 21, 2017 11:21 AM
>> To: solr-user@lucene.apache.org
>> Subject: Re: EdgeNGramFilterFactory did not work
>>
>> Yes i use the catch all field like :
>>
>> <copyField source="*" dest="_text_"/>
>>
>> And you rights when I request solr like = this ?df=textNgramStr2 it works
>> perfectly.
>>
>> But is there a way to still use the catch all field ? Because i have other
>> file like name and description who are only in the _text_ and not in
>> textNgramStr2
>>
>> Kind regards
>>
>> Guilleret Florian <http://www.girodmedical.com/> Tel : +33 6 21 28 43 06
>>
>> 2017-08-21 11:07 GMT+02:00 Junte Zhang <Ju...@localsearch.ch>:
>>
>> > You have to specify the field where you specified this field analyzer
>> > in your request. If you use the catch all field by omitting the field,
>> > it does not use your filter factory.
>> >
>> > /JZ
>> >
>> > -----Original Message-----
>> > From: Guilleret Florian [mailto:guilleret.florian@gmail.com]
>> > Sent: Thursday, August 17, 2017 2:42 PM
>> > To: solr-user@lucene.apache.org
>> > Subject: EdgeNGramFilterFactory did not work
>> >
>> > Hi,
>> >
>> > I want to got this use :
>> >
>> > My document got SKU. Like : 27VAN670
>> >
>> > When i query 27VAN670 solr return my document well.
>> >
>> > But when i query 27VAN solr return 0 document;
>> >
>> > So someone telle me to use EdgeNGramFilterFactory.
>> >
>> > With SOLR Api I add new Field Type :
>> >
>> > {
>> >           "add-field-type" : {
>> >              "name":"textNgram2",
>> >              "class":"solr.TextField",
>> >              "positionIncrementGap":"100",
>> >              "analyzer" : {
>> >                 "tokenizer":{
>> >                    "class":"solr.StandardTokenizerFactory" },
>> >                 "filters":[{
>> >                    "class":"solr.EdgeNGramFilterFactory",
>> >                    "minGramSize":"1",
>> >                    "maxGramSize":"15"
>> >                    }]}
>> >            }
>> >
>> >         }
>> >
>> > And I also create a new Field :
>> >
>> > {
>> >               "add-field":{
>> >                  "name":"textNgramStr2",
>> >                  "type":"textNgram2",
>> >                  "stored":true,
>> >                  "indexed":true
>> >                   }
>> >             }
>> >
>> > Now in SOLR admin I cans saw my new textNgramStr2. And when I update
>> > my document in solr I put SKU of my product in textNgramStr2.
>> >
>> > But solr still found nothing when I request 27VAN
>> >
>> > Can someone help me on that ?
>> >
>>

Re: EdgeNGramFilterFactory did not work

Posted by Guilleret Florian <gu...@gmail.com>.
Ok perfect I will do that then i have only 5-6 field so its ok.

Thank you for your help !

Guilleret Florian <http://www.girodmedical.com/>
Tel : +33 6 21 28 43 06

2017-08-21 13:32 GMT+02:00 Junte Zhang <Ju...@localsearch.ch>:

> Unfortunately not. I would recommend not to use a catch-all field (saves
> storage!), but list all the fields you consider "fulltext" in your
> application in a disjunction query. This should not come at the expensive
> of performance, unless you have a huge amount of fields. Then it should
> work.
>
> /JZ
>
> -----Original Message-----
> From: Guilleret Florian [mailto:guilleret.florian@gmail.com]
> Sent: Monday, August 21, 2017 11:21 AM
> To: solr-user@lucene.apache.org
> Subject: Re: EdgeNGramFilterFactory did not work
>
> Yes i use the catch all field like :
>
> <copyField source="*" dest="_text_"/>
>
> And you rights when I request solr like = this ?df=textNgramStr2 it works
> perfectly.
>
> But is there a way to still use the catch all field ? Because i have other
> file like name and description who are only in the _text_ and not in
> textNgramStr2
>
> Kind regards
>
> Guilleret Florian <http://www.girodmedical.com/> Tel : +33 6 21 28 43 06
>
> 2017-08-21 11:07 GMT+02:00 Junte Zhang <Ju...@localsearch.ch>:
>
> > You have to specify the field where you specified this field analyzer
> > in your request. If you use the catch all field by omitting the field,
> > it does not use your filter factory.
> >
> > /JZ
> >
> > -----Original Message-----
> > From: Guilleret Florian [mailto:guilleret.florian@gmail.com]
> > Sent: Thursday, August 17, 2017 2:42 PM
> > To: solr-user@lucene.apache.org
> > Subject: EdgeNGramFilterFactory did not work
> >
> > Hi,
> >
> > I want to got this use :
> >
> > My document got SKU. Like : 27VAN670
> >
> > When i query 27VAN670 solr return my document well.
> >
> > But when i query 27VAN solr return 0 document;
> >
> > So someone telle me to use EdgeNGramFilterFactory.
> >
> > With SOLR Api I add new Field Type :
> >
> > {
> >           "add-field-type" : {
> >              "name":"textNgram2",
> >              "class":"solr.TextField",
> >              "positionIncrementGap":"100",
> >              "analyzer" : {
> >                 "tokenizer":{
> >                    "class":"solr.StandardTokenizerFactory" },
> >                 "filters":[{
> >                    "class":"solr.EdgeNGramFilterFactory",
> >                    "minGramSize":"1",
> >                    "maxGramSize":"15"
> >                    }]}
> >            }
> >
> >         }
> >
> > And I also create a new Field :
> >
> > {
> >               "add-field":{
> >                  "name":"textNgramStr2",
> >                  "type":"textNgram2",
> >                  "stored":true,
> >                  "indexed":true
> >                   }
> >             }
> >
> > Now in SOLR admin I cans saw my new textNgramStr2. And when I update
> > my document in solr I put SKU of my product in textNgramStr2.
> >
> > But solr still found nothing when I request 27VAN
> >
> > Can someone help me on that ?
> >
>

RE: EdgeNGramFilterFactory did not work

Posted by Junte Zhang <Ju...@localsearch.ch>.
Unfortunately not. I would recommend not to use a catch-all field (saves storage!), but list all the fields you consider "fulltext" in your application in a disjunction query. This should not come at the expensive of performance, unless you have a huge amount of fields. Then it should work.

/JZ

-----Original Message-----
From: Guilleret Florian [mailto:guilleret.florian@gmail.com] 
Sent: Monday, August 21, 2017 11:21 AM
To: solr-user@lucene.apache.org
Subject: Re: EdgeNGramFilterFactory did not work

Yes i use the catch all field like :

<copyField source="*" dest="_text_"/>

And you rights when I request solr like = this ?df=textNgramStr2 it works perfectly.

But is there a way to still use the catch all field ? Because i have other file like name and description who are only in the _text_ and not in
textNgramStr2

Kind regards

Guilleret Florian <http://www.girodmedical.com/> Tel : +33 6 21 28 43 06

2017-08-21 11:07 GMT+02:00 Junte Zhang <Ju...@localsearch.ch>:

> You have to specify the field where you specified this field analyzer 
> in your request. If you use the catch all field by omitting the field, 
> it does not use your filter factory.
>
> /JZ
>
> -----Original Message-----
> From: Guilleret Florian [mailto:guilleret.florian@gmail.com]
> Sent: Thursday, August 17, 2017 2:42 PM
> To: solr-user@lucene.apache.org
> Subject: EdgeNGramFilterFactory did not work
>
> Hi,
>
> I want to got this use :
>
> My document got SKU. Like : 27VAN670
>
> When i query 27VAN670 solr return my document well.
>
> But when i query 27VAN solr return 0 document;
>
> So someone telle me to use EdgeNGramFilterFactory.
>
> With SOLR Api I add new Field Type :
>
> {
>           "add-field-type" : {
>              "name":"textNgram2",
>              "class":"solr.TextField",
>              "positionIncrementGap":"100",
>              "analyzer" : {
>                 "tokenizer":{
>                    "class":"solr.StandardTokenizerFactory" },
>                 "filters":[{
>                    "class":"solr.EdgeNGramFilterFactory",
>                    "minGramSize":"1",
>                    "maxGramSize":"15"
>                    }]}
>            }
>
>         }
>
> And I also create a new Field :
>
> {
>               "add-field":{
>                  "name":"textNgramStr2",
>                  "type":"textNgram2",
>                  "stored":true,
>                  "indexed":true
>                   }
>             }
>
> Now in SOLR admin I cans saw my new textNgramStr2. And when I update 
> my document in solr I put SKU of my product in textNgramStr2.
>
> But solr still found nothing when I request 27VAN
>
> Can someone help me on that ?
>

Re: EdgeNGramFilterFactory did not work

Posted by Guilleret Florian <gu...@gmail.com>.
Yes i use the catch all field like :

<copyField source="*" dest="_text_"/>

And you rights when I request solr like = this ?df=textNgramStr2 it works
perfectly.

But is there a way to still use the catch all field ? Because i have other
file like name and description who are only in the _text_ and not in
textNgramStr2

Kind regards

Guilleret Florian <http://www.girodmedical.com/>
Tel : +33 6 21 28 43 06

2017-08-21 11:07 GMT+02:00 Junte Zhang <Ju...@localsearch.ch>:

> You have to specify the field where you specified this field analyzer in
> your request. If you use the catch all field by omitting the field, it does
> not use your filter factory.
>
> /JZ
>
> -----Original Message-----
> From: Guilleret Florian [mailto:guilleret.florian@gmail.com]
> Sent: Thursday, August 17, 2017 2:42 PM
> To: solr-user@lucene.apache.org
> Subject: EdgeNGramFilterFactory did not work
>
> Hi,
>
> I want to got this use :
>
> My document got SKU. Like : 27VAN670
>
> When i query 27VAN670 solr return my document well.
>
> But when i query 27VAN solr return 0 document;
>
> So someone telle me to use EdgeNGramFilterFactory.
>
> With SOLR Api I add new Field Type :
>
> {
>           "add-field-type" : {
>              "name":"textNgram2",
>              "class":"solr.TextField",
>              "positionIncrementGap":"100",
>              "analyzer" : {
>                 "tokenizer":{
>                    "class":"solr.StandardTokenizerFactory" },
>                 "filters":[{
>                    "class":"solr.EdgeNGramFilterFactory",
>                    "minGramSize":"1",
>                    "maxGramSize":"15"
>                    }]}
>            }
>
>         }
>
> And I also create a new Field :
>
> {
>               "add-field":{
>                  "name":"textNgramStr2",
>                  "type":"textNgram2",
>                  "stored":true,
>                  "indexed":true
>                   }
>             }
>
> Now in SOLR admin I cans saw my new textNgramStr2. And when I update my
> document in solr I put SKU of my product in textNgramStr2.
>
> But solr still found nothing when I request 27VAN
>
> Can someone help me on that ?
>

RE: EdgeNGramFilterFactory did not work

Posted by Junte Zhang <Ju...@localsearch.ch>.
You have to specify the field where you specified this field analyzer in your request. If you use the catch all field by omitting the field, it does not use your filter factory.

/JZ

-----Original Message-----
From: Guilleret Florian [mailto:guilleret.florian@gmail.com] 
Sent: Thursday, August 17, 2017 2:42 PM
To: solr-user@lucene.apache.org
Subject: EdgeNGramFilterFactory did not work

Hi,

I want to got this use :

My document got SKU. Like : 27VAN670

When i query 27VAN670 solr return my document well.

But when i query 27VAN solr return 0 document;

So someone telle me to use EdgeNGramFilterFactory.

With SOLR Api I add new Field Type :

{
          "add-field-type" : {
             "name":"textNgram2",
             "class":"solr.TextField",
             "positionIncrementGap":"100",
             "analyzer" : {
                "tokenizer":{
                   "class":"solr.StandardTokenizerFactory" },
                "filters":[{
                   "class":"solr.EdgeNGramFilterFactory",
                   "minGramSize":"1",
                   "maxGramSize":"15"
                   }]}
           }

        }

And I also create a new Field :

{
              "add-field":{
                 "name":"textNgramStr2",
                 "type":"textNgram2",
                 "stored":true,
                 "indexed":true
                  }
            }

Now in SOLR admin I cans saw my new textNgramStr2. And when I update my document in solr I put SKU of my product in textNgramStr2.

But solr still found nothing when I request 27VAN

Can someone help me on that ?