[infinispan-dev] Flexible indexing - an idea

Manik Surtani manik at jboss.org
Tue Sep 29 05:25:45 EDT 2009


On 29 Sep 2009, at 10:14, Emmanuel Bernard wrote:

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

Cool - should be easy then!

> BTW your example should read
>
>> @Indexed @ProvidedId
>> class MIMEObject {
>> 	@Field String mimeType;
>> 	byte[] content;
>> }

Ah yes, that's the one!  ;)

--
Manik Surtani
manik at jboss.org
Lead, Infinispan
Lead, JBoss Cache
http://www.infinispan.org
http://www.jbosscache.org







More information about the infinispan-dev mailing list