public void testGetDirectoryProvidersForQuery() { FullTextFilterImpl filter = new FullTextFilterImpl(); filter.setName("customer"); filter.setParameter("customerID", 5); // customerID == 5 should correspond to just a single shard instance DirectoryProvider[] providers = shardStrategy.getDirectoryProvidersForQuery(new FullTextFilterImpl[] {filter}); assertTrue(providers.length == 1); // create a dummy document for the same customerID, and make sure the shard it would be // indexed on matches the shard returned by getDirectoryProvidersForQuery() Document document = new Document(); document.add(new Field("customerID", "5", Field.Store.NO, Field.Index.NOT_ANALYZED)); assertTrue( providers[0].equals( shardStrategy.getDirectoryProviderForAddition(null, null, null, document))); }