In the case of text:"G-Money", the term is analyzed by Solr into the phrase "g money", which matches in the text field, but will not match for a string field containing the literal text "G-Money". But when you query cr_fristname:"G-Money", the term is not tokenized by the Solr analyzer because it is a value for a "string" field, and a literal match occurs in the string field "cr_fristname". I think that fully accounts for the behavior you see.

You might consider having a cr_fristname_text field which is tokenized text with a copyField from cr_fristname that fully supports highlighting of text terms.

BTW, I presume that should be "first" name, not "frist" name.

-- Jack Krupansky

-----Original Message----- From: TJ Tong
Sent: Tuesday, May 15, 2012 11:15 AM
To: solr-user@lucene.apache.org
Subject: Re: Urgent! Highlighting not working as expected

Hi Jack,

Thanks for your reply. I did not specify dismax when query with highlighting
enabled: q=text:"G-Money"&hl=true&hl.fl=*, that was the whole query string I
sent. What puzzled me is that the "string" field "cr_firstname" was copied
to text, but it was not highlighted. But if I use
q=cr_fristname:"G-Money"&hl=true&hl.fl=*, it will be highlighted. I attached
my solrconfig.xml here, could you please take a look? Thanks again!
http://lucene.472066.n3.nabble.com/file/n3983883/solrconfig.xml
solrconfig.xml

--
View this message in context: http://lucene.472066.n3.nabble.com/Urgent-Highlighting-not-working-as-expected-tp3983755p3983883.html Sent from the Solr - User mailing list archive at Nabble.com.

Reply via email to