Mike,

Thanks for the information, You are right, my problem is my default
search field (searchall) is not stored. The searchall field is a multi
valued field(a combination of TITLE and a few other fields).I have a
separate field TITLE, which is stored, so I thought that field should be
highlighted automatically if hl.fl is absent, I didn't know the default
search field will be used until now. After I store the searchall field,
I saw the TITLE information in searchall field is displayed in the
highlighting element when hl.fl is absent. (See example below)

- <lst name="highlighting">

  - <lst name="id1">

    - <arr name="searchall">

        <str><em>Senior</em> Event Manager</str> 

      </arr>

    </lst>

  </lst>

  

So if I need to search a string in field f1, f2, f3 and highlight them
in the response, I have to append hl.fl=f1,f2,f3 to my query. Is this
the only solution?  I thought of using searchall field, but the problem
is the highlight element doesn't tell which value belongs to which
field, as you can see in the example above, I can't tell the Senior
Event Manager is from TITLE or other fields. 

 

Thanks for all the help

Xuesong

 

 

-----Original Message-----

From: Mike Klaas [mailto:[EMAIL PROTECTED] 

Sent: Friday, June 01, 2007 11:43 AM

To: solr-user@lucene.apache.org

Subject: Re: question about highlight field

 

 

On 1-Jun-07, at 9:37 AM, Xuesong Luo wrote:

 

> Hi, there,

> 

> I have a question about how to use the highlight field(hl.fl),  

> below is

> my test result. As you can see, if I don't use hl.fl in the query, the

> highlighting element in the result only shows the id information. I  

> have

> to add the field name (hl.fl=TITLE) to the query to see the field

> information. Is that the correct behavior? If there are multiple  

> fields

> that could contain the search string, I have to add all of them to

> hl.fl?

 

Highlighting uses the following fields:

 

1. hl.fl, if present, will define all fields to be highlighted.  You  

can highlight fields that were not part of the query (as you  

demonstrate below)

2. if hl.fl is absent and qt=standard, the default search field is  

highlighted (set in schema.xml or df= parameter

3. if hl.fl is absent and qt=dismax, the query fields are used (qf=)

 

Note that every field to be highlighted must be stored.  If not, it  

will not be present in the output (perhaps that is what you are  

seeing in your example).

 

Finally, all terms are highlighted in all highlight fields.  If you  

query searches for different terms in different fields and you want  

this exactitude to carry forth in your highlighting, specify  

hl.requireFieldMatch=true.

 

-Mike

 

Reply via email to