lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Sokolov <msoko...@safaribooksonline.com>
Subject Re: Associated values for a field and its value
Date Thu, 03 Oct 2013 20:49:04 GMT
On 10/02/2013 07:12 PM, Alice Wong 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!
>
Why not store a (nonindexed) text field with some internal structure 
(XML, JSON, CSV) that you can analyze after retrieving.  For example,

<D>
   <A>
      <value>a1</value>
      <associated-values>
        ... whatever you want ...
      </associated-values>
   </A>
</D>

If you use Lux (luxdb.org), which is XML query support on top of Lucene, 
you can do this all automatically, and retrieve the results with a 
simple query like:

/D[A=a1]/associated-values

plus if you want to pull out the values and manipulate them, you have 
XQuery to do it with.

-Mike

---------------------------------------------------------------------
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