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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]