lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Giulio Cesare Solaroli <>
Subject How to extract matching terms for a document given a query
Date Wed, 16 Jun 2004 17:28:18 GMT
Hi all,

I would like to implement a kind of term highlighter, but my setup
does not allow me to use the highlighter available in the sandbox.

The reason the current highlighter is not suitable for me, is that the
content of the document is not stored in the index, nor it is easily
reachable from the search application (I use Lucene to index a huge DB
and I don't want to replicate the whole content into Lucene, as it is
already stored into the DB).

The frontend application (that has no visibility on the Lucene index)
invoke the search application through Xml-Rpc; the search application
returns a list of document ID matching the query, and the frontend
application loads the whole documents from its own DB.

Given this layout, I would like the search application to return,
associated with each document ID, also the list of (weighted) terms
that did match the query; with this additional information, the
frontend application could process the document to highlight the
matching terms.

I have tried to look through out the documentation, but I have not
found anything usefull.

What I was looking for was a method "matchingTerms" defined on
Searcher (or IndexSearcher):
Term[] matchingTerms(Query aQuery, int doc)

The closest thing I have found is the "explain" method defined in
IndexSearcher; is this the best starting point to achieve what I am
looking for, or is there any cheaper way to get the same information?

Thank you very much for your attention.


Giulio Cesare Solaroli

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message