lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Libbrecht <>
Subject Re: How to know the matched field?
Date Mon, 23 Mar 2009 10:35:13 GMT
Thanks Erick,

I browsed but no full answer yet.

The closest seems to be the explain method with which I could find the  
exact term-query or prefix-query that matched it, so I would be able  
to find the name of the field. I am still left with iterating through  
the (stored) fields and try to find the individual fields that matched.

I could also make a token-stream with all fields' contents and find  
the field (the fragment) which gets the best score with  
(provided query is "rewritten" so that no prefixquery appears anymore,  

Sounds doable but please confirm this is a correct usage of  
QueryScorer, I am feeling a bit unsafe here.


Le 22-mars-09 à 22:22, Erick Erickson a écrit :

> Try searching the mail archives, the searchable archive is linked to
> off the Wiki. This topic has been discussed multiple times but I  
> forget
> the solutions...
> On Sun, Mar 22, 2009 at 4:30 PM, Paul Libbrecht  
> <> wrote:
>> in an auto-completion task, I would like to show to the user the  
>> field
>> that's been matched against the query in the found document.
>> Typically, my documents have multiple fields for each field-name  
>> and I
>> would like the index's findings to give me the field used. How can  
>> I do
>> that?
>> It seems to me a task of the highlighter (or of the QueryScorer?)  
>> but I am
>> actually not interested into extracting the fragment found just to  
>> know the
>> exact field found.
>> thanks in advance
>> paul

View raw message