Hi

You need to expand the field as below. Store the document and its
associated values as one document.

Document  Field-A   Stored-Field
D1               a1             1,2
D2               a2              3,10

Other alternative approach is to store these fields external to Lucene, may
be in database or key-value-store and fetch it on demand.

Regards
Aditya
www.findbestopensource.com -- we have collection of more than 1 million
open source projects



On Thu, Oct 3, 2013 at 4:42 AM, Alice Wong <airwayw...@gmail.com> wrote:

> Hello,
>
> We would like to index some documents. Each field of a document may have
> multiple values. And for each (field,value) pair there are some associated
> values. These associated values are just for retrieving, not searching.
>
> For example, a document D could have a field named A. This field has two
> values a1 and a2.
>
> It is easy to index D, adding term a1 and a2 to field A, so either query
> "A=a1" or "A=a2" will return D.
>
> Assuming we have other values associated with (A,a1) and (A,a2) for D. We
> would like to retrieve these associated values depending on whether "A=a1"
> or "A=a2" is queried.
>
> For example, if query "A=a1" returns D, we would like to return values 1
> and 2. And if query "A=a2" returns D, we want to return values 3 and 10.
>
> Is it possible to do this with Lucene? Initially we want to hack postings
> to return associated values, but this seems quite complex.
>
> Thanks!
>

Reply via email to