lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Elschot <paul.elsc...@xs4all.nl>
Subject Re: Searching repeating fields
Date Fri, 23 Jun 2006 07:15:13 GMT
On Thursday 22 June 2006 21:18, Subodh Damle wrote:
> Hi all.
> 
> We've been using Lucene to index our dynamic data structure and so far 
> Lucene has been flexible enough to accommodate our requirements.
> 
> Now we have this requirement about searching repeating fields, whose 
> implementation is not clear.
> 
> Our data records have a dynamic tree-like structure :
> e.g. a portion of record will look like:
> -company-data
> --- financial-data
> ------revenue-info
> --------year
> --------amount
> 
> For above record portion we create Lucene fields 
> "/company-data/financial-data/revenue-info/year" and 
> "/company-data/financial-data/revenue-info/amount"
> 
> Here, the 'revenue-info' is a repeating node, so we can have records like :
> Record 1
> ---financial-data
> ------revenue-info
> --------year = 2000
> --------amount = 1000000
> ------revenue-info
> --------year = 2001
> --------amount = 2000000
> 
> Record 2
> ---financial-data
> ------revenue-info
> --------year = 2000
> --------amount = 2000000
> 
> 
> Now, we need to find records where 'year=2000' and 'amount=2000000' -- 
> only those **belonging to same revenue-info node**.

Other than enumerating field names one can also add a seperator
term between the repeating "fields" and use a search a single "field"
by requiring that the separator does not occur in the match,
roughly like:

SpanNotQuery(SpanNearQuery(term1, term2), separatorterm)

where each term is a SpanTermQuery in the Lucene field,
not the same as the repeating "field" above.

Regards,
Paul Elschot

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


Mime
View raw message