Hello,
 
im trying to implement a user friendly search for phone numbers. These numbers 
consist out of two digit-tokens like "12345 67890".
 
Finally I want the highlighting for the phone number in the search result, 
without any concerns about was this search result hit by field  tel  or 
copyField  tel2.
 
The field tel is splitted by a StandardTokenizer in two tokens "12345" AND 
"67890".
And I want to catch up those people, who enter "1234567890" without any space.
I use copyField  tel2  to a solr.PatternReplaceCharFilterFactory to eliminate 
non digits followed by a solr.KeywordTokenizerFactory.
 
In both cases the search hits as expected.
 
The highlighter works well for  tel  or  tel2,  but I want the highlight always 
on field  tel!
Using  f.tel.hl.alternateField=tel2  is returning the field value wihtout any 
highlighting.
 
<lst name="params">
 <str name="q">tel2:1234567890</str>
 <str name="f.tel.hl.alternateField">tel2</str>
 <str name="hl">true</str>
 <str name="hl.requireFieldMatch">true</str>
 <str name="hl.simple.pre"><em></str>
 <str name="hl.simple.post"></em></str>
 <str name="hl.fl">tel,tel2</str>
 <str name="fl">tel,tel2</str>
 <str name="wt">xml</str>
 <str name="fq">typ:person</str>
</lst>

...

<result name="response" numFound="1" start="0">
 <doc>
  <str name="uid">user1</str>
  <str name="tel">12345 67890</str>
  <str name="tels">12345 67890</str></doc>
</result>

...

<lst name="highlighting">
 <lst name="user1">
  <arr name="tel">
   <str>123456 67890</str> <!-- here should be a highlight -->
  </arr>
  <arr name="tels">
   <str><em>123456 67890</em></str>
  </arr>
 </lst>
</lst>

Any idea? Or do I have to change my velocity macros, always looking for a 
different highlighted field?
Best Regards

Reply via email to