Answer to myself: using the solr.KeywordTokenizerFactory and solr.WordDelimiterFilterFactory can preserve the original phone number and can add a token without containing spaces.
input: "12345 67890" tokens: "12345 67890", "12345", "67890", "1234567890" Two advantages: I don't need another field and the highlighter works as aspected. Best Regards. > Gesendet: Donnerstag, 05. Juni 2014 um 09:14 Uhr > Von: "jay list" <jay.l...@web.de> > An: solr-user@lucene.apache.org > Betreff: Fw: highlighting on hl.alternateField (copyField target) doesnt > highlight > > Anybody knowing this issue? > > > Gesendet: Dienstag, 03. Juni 2014 um 09:11 Uhr > > Von: "jay list" <jay.l...@web.de> > > An: solr-user@lucene.apache.org > > Betreff: highlighting on hl.alternateField (copyField target) doesnt > > highlight > > > > > > 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 >