[infinispan-dev] Flexible indexing - an idea

Emmanuel Bernard emmanuel at hibernate.org
Tue Sep 29 05:14:20 EDT 2009


On 29 sept. 09, at 11:05, Manik Surtani wrote:

>
> On 29 Sep 2009, at 09:47, Sanne Grinovero wrote:
>
>> IMHO even having just a couple (String mime-type, byte[] mp3)
>> makes up a good POJO, and makes it easy to add more info
>> you'll likely need in future.
>
> Right, this is what I think as well.  So in the case of web caching,
> you may have a byte[] and some metadata (K/V pairs), but what you
> would cache is probably a custom object of yours- something like:
>
> MIMEObject {
> 	@Indexed String mimeType;
> 	byte[] content;
> }
>
> I guess the tricky bit would be representing an arbitrary-length
> dictionary of metadata as indexable fields?  Is this what you are
> getting at, Mic?

you can index Maps and use a custom bridge to map a String key to a  
field in lucene. This is fairly standard HSearch procedure.

BTW your example should read

> @Indexed @ProvidedId
> class MIMEObject {
> 	@Field String mimeType;
> 	byte[] content;
> }





More information about the infinispan-dev mailing list