Good point, I haven't thought about it. It makes sense to use
requireFieldMatch in my case.

One more question about using wildcard. I found if wildcard is used in
the query, the highlight elements only shows unique id, it won't display
the field information(See below, the arr section in blue is returned).
Is this the designed behavior? 

 

 

?q=TITLE:consult*&hl=on&hl.fl=TITLE

 

<lst name="highlighting">

 <lst name="id1">

  <arr name="TITLE">

    <str><em>Consult</em>ant</str> 

  </arr>

 </lst>

</lst>

 

 

Thanks

Xuesong

 

-----Original Message-----
From: Chris Hostetter [mailto:[EMAIL PROTECTED] 
Sent: Tuesday, June 05, 2007 12:02 PM
To: solr-user@lucene.apache.org


Subject: RE: question about highlight field

 

 

: 1. search on different fields

: 2. highlight the query string in searching fields, not default search

 

: I think the only option I have is to use standard request handler and

: specify which field I want to search and add the same field to hl.fl,

: something similar to ?q=TITLE:consult*&hl=on&hl.fl=TITLE, right?

 

pretty much, if you want to ensure that your highlighting only aplies to

things that actauly result in query matches, set
hl.requireFieldMatch=true

that way in queries like this...

 

   ?q=DEK:albino+TITLE:elephant&hl=on&hl.fl=TITLE,DEK

 

...the word elephant won't be highlighted in the DEK field, and the word

albino won't be highlighted in the TITLE field.

 

 

 

 

-Hoss

 

Reply via email to