[email protected]
[Top] [All Lists]

RE: Can Lucene tells which field matched ?

Subject: RE: Can Lucene tells which field matched ?
From: "Ulrich Vachon"
Date: Thu, 6 Nov 2008 11:55:07 +0100
Hi Daan,

Can we have an exemple of your implementation?

Ulrich VACHON 

-----Message d'origine-----
De : Daan de Wit [mailto:[email protected]] 
Envoyé : jeudi 6 novembre 2008 11:35
À : [email protected]
Objet : RE: Can Lucene tells which field matched ?


I have implemented such a solution using the query explanation.
IndexSearcher has an explain(Query query, int document) method that returns an 
Explanation object, on the Explanation object you can ask if it is a match with 
#isMatch(). You still need to repeat this for each found document though.


> -----Original Message-----
> From: Dora [mailto:[email protected]]
> Sent: donderdag 6 november 2008 10:19
> To: [email protected]
> Subject: Can Lucene tells which field matched ?
> Hi
> I am new to Lucene and working on a search module for some XML data:
> I need to provide a "search all" able to look in all xml fields.
> Apparently Lucene (2.4.0) does not provide such a "search all"
> and
> I have to build a query with my search field associated to all
> elements.
> Assuming that I am searching in a address book (fictive example for
> illustration) which is made of contacts (my lucene documents)
> several fields like name, address, city, ...
> So my search for "paul" inside my addressbook will look like:
> name:paul OR address:paul OR city:paul and so on...
> Lucene will then tell me which contacts match my query, but is there a
> to know which field(s) matched the request ?
> The goal is to display the XML with the matching fields highlighted.
> I did not found anything like this in Lucene, so I seems that the only
> is to perform a additional search field by field...
> So if I have 100 fields per document (I told you my address book was a 
> fictive example, the XML I am working on are a little bit more
> and
> get 100 results that I want ot display in a list, this mean that I
> need to perform 10000 additional searches request...
> Please tell me that there is a better way to do the job...
> --
> View this message in context: http://www.nabble.com/Can-Lucene-tells-
> which-field-matched---tp20357552p20357552.html
> Sent from the Lucene - Java Users mailing list archive at Nabble.com.
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]

[email protected]----
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

[email protected]_____
Cet e-mail a été scanné par MessageLabs Email Security System.
Pour plus d'informations, visitez http://www.messagelabs.com/email 

To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

<Prev in Thread] Current Thread [Next in Thread>