I'm using Infinispan with 6.0.2 with Hibernate Search 4.4.0.
In the begining, after I execute a query like
CacheQuery cq = SearchManager.getQuery(query,Hibernate.class).projection("id");
I use the cq.list()
to get "id".
But now the number of results reaches 300.000, because of the designing fo DB(cant change), the duplicate id is almost 29,000.
I wrote this to get "id":
for(int i=0;i<listObject.size();i++)
{
Object[] rdf = (Object[])listObject.get(i);
if(!result.contains((String) rdf[0]))
result.add((String) rdf[0]);
}
But even if I parallel this part, it also takes a long time.
Does there is a function to remove duplicate id for the query in Hibernate like the DISTINCT does in SQL?