Home | About | Sematext search-lucene.com search-hadoop.com
 Search Lucene and all its subprojects:

Switch to Threaded View
Solr, mail # user - Urgent:Partial Search not Working


Copy link to this message
-
Re: Urgent:Partial Search not Working
Jack Krupansky 2012-07-04, 19:12
You need to apply the edge n-gram filter only at index time, not at query
time. So, you need to specify two analyzers for these field types, an
"index" and a "query" analyzer. They should be roughly the same, but the
"query" analyzer would not have the edge n-gram filter since you are
accepting the single n-gram given by the user and then matching it against
the full list of n-grams that are in the index.

It is unfortunate that the wiki example is misleading. Just as bad, we don't
have an example in the example schema.

Basically, take a "text" field type that you like from the Solr example
schema and then add the edge n-gram filter to its "index" analyzer, probably
as the last token filter. I would note that the edge n-gram filter will
interact with the stemming filter, but there is not much you can do other
than try different stemmers and experiment with whether stemming should be
before or after the edge n-gram filter. I suspect that having stemming after
edge n-gram may be better.

-- Jack Krupansky

-----Original Message-----
From: jayakeerthi s
Sent: Wednesday, July 04, 2012 1:41 PM
To: [EMAIL PROTECTED] ; [EMAIL PROTECTED]
Subject: Re: Urgent:Partial Search not Working

Could anyone please reply the solution to this

On Wed, Jul 4, 2012 at 7:18 PM, jayakeerthi s <[EMAIL PROTECTED]>wrote:

> All,
>
> I am using apache-solr-4.0.0-ALPHA and trying to configure the Partial
> search on two fields.
>
> Keywords using to search are
> The value inside the search ProdSymbl is M1.6X0.35 9P
>
> and I willl have to get the results if I search for M1.6 or X0.35 (Partial
> of the search value).
>
>
> I have tried using  both NGramTokenizerFactory and
> solr.EdgeNGramFilterFactory
>  in the schema.xml
>
> <!-- bigram -->
>               <!--          <fieldType name="bigram"
> class="solr.TextField" positionIncrementGap="100">
>                           <analyzer type="index">
>          <tokenizer class="solr.NGramTokenizerFactory" minGramSize="3"
> maxGramSize="15" />
>           <filter class="solr.LowerCaseFilterFactory"/>
>    </analyzer>
>      <analyzer type="query">
>           <tokenizer class="solr.WhitespaceTokenizerFactory" />
>           <filter class="solr.LowerCaseFilterFactory"/>
>       </analyzer>
>
>                         </fieldType> -->
>
>                         <fieldType name="bigram" class="solr.TextField"
> omitNorms="false">
>   <analyzer>
>     <tokenizer class="solr.StandardTokenizerFactory"/>
>     <filter class="solr.StandardFilterFactory"/>
>     <filter class="solr.LowerCaseFilterFactory"/>
>     <filter class="solr.EdgeNGramFilterFactory" minGramSize="2"
> maxGramSize="15" side="front"/>
>   </analyzer>
>                       </fieldType>
>
>
>
> Fields I have configured as
>
>   <field name="prodsymbl" type="bigraml" indexed="true" stored="true"
> multiValued="true"/>
>    <field name="measure1" type="bigram" indexed="true" stored="true"
> multiValued="true"/>
>
> Copy field as
>
> <copyField source="prodsymbl" dest="text"/>
>    <copyField source="measure1" dest="text"/>
>
>
>
> Please let me know IF I and missing anything, this is kind of Urgent
> requirement needs to be addressed at the earliest, Please help.
>
>
> Thanks in advance,
>
> Jay
>