You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Adriano Labate <la...@verticali.com> on 2003/06/03 14:21:35 UTC

Field where the search term has been found?

If a do a multi field search, is it possible to know the field name
where
the search term has been found?

In my case I have documents containing several fields and I search for
a term
in all or a part of these fields.

What I would like to know is the name of the field(s) where the term
has been
found, so that I can then display for example:

"Organization: ... bla bla TERM bla bla ..."
"Category: TERM"

Any suggestions?

Regards,
Adriano Labate




---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-user-help@jakarta.apache.org


Re: Field where the search term has been found?

Posted by Anthony Eden <me...@anthonyeden.com>.
I cannot find a way to do this via the API.

In addition to knowing which fields matched it would be good to be able 
to say where the match position starts and ends in each field.  This 
would make it easy to display search results with highlighted terms.

Sincerely,
Anthony Eden

Adriano Labate wrote:
> If a do a multi field search, is it possible to know the field name 
> where the search term has been found?
> 
> In my case I have documents containing several fields and I search
> for a term in all or a part of these fields.
> 
> What I would like to know is the name of the field(s) where the term 
> has been found, so that I can then display for example:
> 
> "Organization: ... bla bla TERM bla bla ..." "Category: TERM"
> 
> Any suggestions?
> 
> Regards, Adriano Labate
> 
> 
> 
> 
> ---------------------------------------------------------------------
>  To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org 
> For additional commands, e-mail: lucene-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-user-help@jakarta.apache.org


Re: Field where the search term has been found?

Posted by Victor Hadianto <vi...@nuix.com.au>.
On Tue, 3 Jun 2003 10:21 pm, Adriano Labate wrote:
> If a do a multi field search, is it possible to know the field name
> where
> the search term has been found?

I believe there is no easy way to do this. I had to implement a similar 
functionality by adding explainTerm() method on Weight interface. The 
implementation is, unfotunately, pretty horrendous by using the Explanation 
API. 

This achieve my purpose to explain what term matches given a query and given a 
document, from this list of terms you can then retrieve the field names.


> Adriano Labate

Victor Hadianto


---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-user-help@jakarta.apache.org