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 Dmitriy Shvadskiy <ds...@gmail.com> on 2014/01/31 21:17:43 UTC

Solr 4.x EdgeNGramFilterFactory and highlighting

Hello,

We are using EdgeNGramFilterFactory to provide partial match on the search
phrase for type ahead/autocomplete. Field type definition

<fieldType name="edgytext" class="solr.TextField" positionIncrementGap="100"
>
 <analyzer type="index">
   <tokenizer class="solr.StandardTokenizerFactory"/>

   <filter class="solr.WordDelimiterFilterFactory"
                generateWordParts="1"
                generateNumberParts="1"
                catenateWords="1"
                catenateNumbers="1"
                catenateAll="0"
                preserveOriginal="0"
				splitOnCaseChange="0"
				splitOnNumerics="0"
            />
   <filter class="solr.LowerCaseFilterFactory"/>
   <filter class="solr.EdgeNGramFilterFactory" minGramSize="1"
maxGramSize="25" side="front" />
 </analyzer>
 <analyzer type="query">
   <tokenizer class="solr.StandardTokenizerFactory"/>
   <filter class="solr.WordDelimiterFilterFactory"
                generateWordParts="1"
                generateNumberParts="1"
                catenateWords="1"
                catenateNumbers="1"
                catenateAll="0"
                preserveOriginal="0"
				splitOnCaseChange="0"
				splitOnNumerics="0"
            />
   <filter class="solr.LowerCaseFilterFactory"/>
 </analyzer>
</fieldType>

Field is defined as following
<field name="ac_source_id" 	type="edgytext" indexed="true"  stored="true" 
multiValued="false" termVectors="true" termPositions="true"
termOffsets="true"/> 

Query string
q=22&qt=%2Fedismax&qf=ac_source_id&fl=ac_source_id&hl=true&hl.mergeContiguous=true&hl.useFastVectorHighlighter=true&hl.fl=ac_source_id

This is what comes back in highlighting response
<arr name="ac_source_id">
  <str><em>2282372</em></str>
</arr>

What I expect is <em>22</em>82372 as it was in Solr 3.6. Also I noticed when
I run Analysis on the field start and end positions are the same even though
EdgeNGramFilterFactory generates multiple ngrams (see image attached). 
Questions:
1. How do I accomplish highlighting on partial match in Solr 4.x?
2. Did behavior of EdgeNGramFilterFactory change between 3.6 and 4.x.
Highlighting on partial match works fine in Solr 3.6

Thank you,
Dmitriy Shvadskiy
<http://lucene.472066.n3.nabble.com/file/n4114748/Solr_Analysis.png> 



--
View this message in context: http://lucene.472066.n3.nabble.com/Solr-4-x-EdgeNGramFilterFactory-and-highlighting-tp4114748.html
Sent from the Solr - User mailing list archive at Nabble.com.