Infinispan query - null values in the query results
jeetu Feb 22, 2013 7:00 PMHi,
I have been trying to get the infinispan querying work for my POC. I am using the infinispan 5.1.8.Final for my implementation.
I have an object called QCInventory.java which is indexed and has @providedId annotation.
There are some fields in the pojo which are annotated with @Field and all of them are set to no anlyzing. I dont want to be analyzed as my requirement is to match the values as provided in the input.
I ran some queries by putting 10 QCInventory.java objects in cache with the key as the serviceId ( a field value in QCInventory pojo and is unique for each pojo) and value as the corresponding QCInventory object.
When the query is serviceId:123485 which should match exactly one pojo, the result size of CacheQuery is 1 but when i try to display that match using .list() method, it gives me a null value.
Similarly when the query is enterpriseId:24769 ( all the pojos in cache has the same enterpriseId value), the result size is 10, but when i list them using the .list() method, 7 of them are null values and 3 of them are the pojos.
Need to know why am i getting those null values as part of the .list() method. The QcInventory pojo looks like this.
@Indexed
@ProvidedId
public class Qcinventory implements Serializable{
/**
*
*/
private static final long serialVersionUID = 146546358216584L;
@Field(analyze = Analyze.NO) String serviceId;
@Field(analyze = Analyze.NO) String enterpriseId;
}
I am calling the query like this:
SearchManager sm = Search.getSearchManager(cache);
QueryBuilder qb = sm.buildQueryBuilderForClass(Qcinventory.class).get();
Query q = new QueryParser(Version.LUCENE_35, "serviceId", new StandardAnalyzer(Version.LUCENE_35)).parse("serviceId:123485");
CacheQuery cq = sm.getQuery(q, Qcinventory.class);
//then loop through the objects from cq.list()
Any kind of suggestion or help will be highly appreciated.
We are evaluating infinispan querying to be used for our inventory searching capabilities. A major decision is pending on the outcome of this POC. So, expecting help as soon as possible.