This content has been marked as final.
Show 1 reply
-
1. Re: [infinispan-dev] Querying Infinispan -- Not fetching
manik Feb 18, 2010 8:38 AM (in response to vidya5678)Note that you need to create and get the QueryFactory before you put anything into the cache, otherwise all of the earlier puts will not get indexed.
E.g.,
cache = cacheMgr.getCache(); QueryHelper qh = new QueryHelper(cache, new Properties(), TestRecord.class); QueryFactory qf = new QueryFactory(cache, qh); cache.put(key, value); // repeat this multiple times. // NOW try your query. CacheQuery cq = qf.getBasicQuery("message", searchText); auditLogRecordList = cq.list(); int hits = cq.getResultSize();
As a general rule, if you intend to query stuff in the cache, you should create the QueryHelper and QueryFactory as soon as you create the cache, and before you use the cache for anything.