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 ed...@xs4all.nl on 2004/05/25 10:51:00 UTC

Which searched words are found in a document

Hi,

I have the following question:
Is there an easy way to see which words from a query were found in a
resulting document?

So if I search for 'cat OR dog' and get a result document with only 'cat'
in it. I would like to ask the searcher object or something to tell me
that for the result document 'cat' was the only word found.

I did see it is somehow possible with the explain method, but this does
not give a clean answer.
I can also get the contents of the document and do an indexof for each
search term but there could be quite a lot in our case.

Any suggestions?

Thanks,

Edvard Scheffers



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


RE: Which searched words are found in a document

Posted by Edvard Scheffers <ed...@xs4all.nl>.
I looked at the highlighter code, but the query term extracter retrieves
the terms from the original query. While I only want the found terms, the
best way is probably to parse the result of the explain method.

Edvard

> Take a look at the highlighter code, you could implement this on the front
> end while processing the page.
>
> Nader
>
> -----Original Message-----
> From: edvard_eid@xs4all.nl [mailto:edvard_eid@xs4all.nl]
> Sent: Tuesday, May 25, 2004 10:51 AM
> To: lucene-user@jakarta.apache.org
> Subject: Which searched words are found in a document
>
>
> Hi,
>
> I have the following question:
> Is there an easy way to see which words from a query were found in a
> resulting document?
>
> So if I search for 'cat OR dog' and get a result document with only 'cat'
> in
> it. I would like to ask the searcher object or something to tell me that
> for
> the result document 'cat' was the only word found.
>
> I did see it is somehow possible with the explain method, but this does
> not
> give a clean answer. I can also get the contents of the document and do an
> indexof for each search term but there could be quite a lot in our case.
>
> Any suggestions?
>
> Thanks,
>
> Edvard Scheffers
>
>
>
> ---------------------------------------------------------------------
> 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
>
>
>


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


RE: Which searched words are found in a document

Posted by "Nader S. Henein" <ns...@bayt.net>.
Take a look at the highlighter code, you could implement this on the front
end while processing the page.

Nader

-----Original Message-----
From: edvard_eid@xs4all.nl [mailto:edvard_eid@xs4all.nl] 
Sent: Tuesday, May 25, 2004 10:51 AM
To: lucene-user@jakarta.apache.org
Subject: Which searched words are found in a document


Hi,

I have the following question:
Is there an easy way to see which words from a query were found in a
resulting document?

So if I search for 'cat OR dog' and get a result document with only 'cat' in
it. I would like to ask the searcher object or something to tell me that for
the result document 'cat' was the only word found.

I did see it is somehow possible with the explain method, but this does not
give a clean answer. I can also get the contents of the document and do an
indexof for each search term but there could be quite a lot in our case.

Any suggestions?

Thanks,

Edvard Scheffers



---------------------------------------------------------------------
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