Begin forwarded message:

From: chase.seibert+opensubscriber@gmail.com
Date:  June 3, 2009 09:21:21  PDT
To: emmanuel@hibernate.org
Subject: Re: Re: [hibernate-dev] HSearch: Using sharding and avoiding query on multiple shards
Reply-To: chase.seibert+opensubscriber@gmail.com

Emmanuel,

Regarding HSEARCH-251, and http://www.opensubscriber.com/message/hibernate-dev@lists.jboss.org/9770383.html

Being able to query just a single shard or subset of shards would be awesome. I was thinking of a similar API:

IndexShardingStrategy:
public DirectoryProvider<?>[]
getDirectoryProviderForShard(int shardNum);

FullTextQuery:
public void enableShardFilter(int shardNum);
public void enableShardFilters(int[] shardNums);

FullTextQuery.buildSearcher() would need to be modified to call getDirectoryProviderForShard() for each shardNum if shardNums are set, otherwise it should continue to use getDirectoryProvidersForAllShards();

Calling this API from a consumer's stand-point would look like:
FullTextQuery fullTextQuery = fullTextSession.createFullTextQuery(luceneQuery, entityClass);
fullTextQuery.enableShardFilter(5);
fullTextQuery.list();

This could be changed to pass named shards easily. I could prototype this and submit a .patch if you are interested.

 -Chase

--
This message was sent on behalf of chase.seibert+opensubscriber@gmail.com at openSubscriber.com
http://www.opensubscriber.com/message/hibernate-dev@lists.jboss.org/9800518.html