[infinispan-dev] Flexible indexing - an idea
Michael Neale
michael.neale at gmail.com
Tue Sep 29 03:50:23 EDT 2009
Hi All.
I have been looking over the Infinispan query module by Navin.
As this is built on Hibernate Search - (and correct me if wrong) the
indexing happens on pojos fields.
This is great for most of the cases, but for my ulterior motive (which
I will reveal in another email) I would like to deal with certain
object types differently. So lets for instance take a media file like
MP3, if I was storing it in the cache -I would know when I go to the
index it that I have an instance of something that has extra data I
would like to index (ie its not really a pojo): at that point I can
extract whatever data out of the "rich" object (meta data, or whatnot)
and stick that in the Work object for HS to do its thing on (say based
on known MIME types, as one instance).
I have tried out something like this, by messing with the
QueryInterceptor (and the tests):
So I would propose some mechanism to register for the QueryInterceptor
a surrogate class for indexing purposes (which while only take effect
when it gets asked) - so when it calls addToIndexes(value, key) -
then if if a surrogate is available it will create it, and pass it to
searchFactory.getWorker().performWork(new Work(surrogate... etc... -
where the surrogate is created based on the value type (as well as its
contents) - and thus searching will return what I want (as opposed to
nothing).
Q1: Does this even make sense? Should I just be pushing a "surrogate"
type object into the cache in the first place (doesn't feel right-
changing what I would store for the purposes of indexing)?
Q2: Is there any way we can query heterogenous caches ie caches like
Cache<String, SomeParent> where there are many children of SomeParent.
(so in a query we would declare we are only interested in specific
instances types? )
Thoughts?
--
Michael D Neale
home: www.michaelneale.net
blog: michaelneale.blogspot.com
More information about the infinispan-dev
mailing list