Hi Ray,
yes it's the right place for such questions.
This is a great example of why we expose the IndexReader so far: so
that power users can do more than what we expose over simplified APIs,
be it because the feature really need low level access, or simply
because - like in this case - we didn't add a nicer/simpler API for
the feature yet.
The method getSearchFactory() was deprecated as we're trying to
simplify the API, but I'm realizing now that this would also prevent
accessing the IndexReader(s), and there definitely will always be good
reasons to need that. Another reason for deprecating accessing the
underlying search engine, is that we have plans for aggressive
automatic index sharding, and it gets complex for users if we don't
provide a good abstraction.
But accessing an IndexReader for Grouping is a very strong case, I
agree we should not take that away and created:
-
https://issues.jboss.org/browse/ISPN-5332
Also - while there will always be good reasons to access the
IndexReader - some experiments have started in Hibernate Search to
provide an higher level API to the Grouping API
-
https://github.com/hibernate/hibernate-search/pull/791
The API will have to change (for one because the method name is not
matching the returned type anymore), and we might not want to expose
the SearchIntegrator but we will expose IndexReader instances in some
way.
Thanks for your feedback! Glad it came before we actually removed it.
Sanne
On 26 March 2015 at 16:51, Raymond Rennell Douglass III
<rdouglas(a)umd.edu> wrote:
Hello all,
This is my first time mailing this list, so please let me know if this is
not the right place for this.
I use a replicated and/or distributed cache to store some Objects and it is
indexed using Infinispan’s indexing via Hibernate Search. I’m using
Infinispan 7.1.x.
I wanted to use Lucene’s GroupingSearch functionality, which I could not
find anywhere in the Infinispan or Hibernate Search docs, so I used this:
https://docs.jboss.org/infinispan/7.1/apidocs/org/infinispan/query/Search...
I wrote code like so:
SearchIntegrator searchIntegrator =
Search.getSearchManager(cache).getSearchFactory();
IndexReader reader =
searchIntegrator.getIndexReaderAccessor().open(ENTITY_CLASSES);
IndexSearcher searcher = new IndexSearcher(reader);
String groupedBy = ...;
GroupingSearch groupingSearch = new GroupingSearch(groupedBy);
TopGroups<BytesRef> result = groupingSearch.search(searcher, query, offset,
limit);
I noticed in the javadocs for the getSearchFactory method that it’s
deprecated (maybe just in Infinispan 7.0?). So I wanted to ask:
1. Is there are better way to perform a grouping search?
2. Will this API be available in future Infinispan versions?
I personally think access to an IndexReader is very helpful for those
strange edge cases to run custom Lucene queries.
Thanks,
--
Ray Douglass
_______________________________________________
infinispan-dev mailing list
infinispan-dev(a)lists.jboss.org
https://lists.jboss.org/mailman/listinfo/infinispan-dev