3 Replies Latest reply on Feb 24, 2012 8:15 PM by nkzhangni

    A question about index and query

    nkzhangni

      There are two cache in my cluster, one cache put data and one cache using getClusteredQuery API to search.

       

      When putting 100 entries, the query work well.

       

      But when putting 200 or 300 or more data, the query can not work, the log is as following:

       

      Exception in thread "main" java.lang.IndexOutOfBoundsException: Index: 149, Size: 149

          at java.util.ArrayList.RangeCheck(ArrayList.java:547)

          at java.util.ArrayList.get(ArrayList.java:322)

          at org.infinispan.query.clustered.DistributedIterator.current(DistributedIterator.java:138)

          at org.infinispan.query.clustered.DistributedIterator.next(DistributedIterator.java:114)

          at org.infinispan.query.clustered.ClusteredCacheQueryImpl.list(ClusteredCacheQueryImpl.java:136)

          at start.Start.main(Start.java:68)

       

      My query code is:

      QueryParser queryParser = new QueryParser(Version.LUCENE_30, "userName", new StandardAnalyzer(Version.LUCENE_30));

             

              Query luceneQuery =queryParser.parse("wf");;

       

            CacheQuery query12 = searchManager.getClusteredQuery(luceneQuery);

             

              System.out.println("start query....");

              List<Object> objectList = query12.list();

              System.out.println("query result is:");

              if (objectList.size() == 0)

              {

                  System.out.println("no data");

              }

             

              for (Object value : objectList)

              {

                  MetricValue mvalue = (MetricValue)value;

                  System.out.println(mvalue);

              }

       

      My configuration is:

      <infinispan xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

          xsi:schemaLocation="urn:infinispan:config:5.1 http://www.infinispan.org/schemas/infinispan-config-5.1.xsd"

          xmlns="urn:infinispan:config:5.1">

       

          <global>

              <transport

                  transportClass="org.infinispan.remoting.transport.jgroups.JGroupsTransport">

                  <properties>

                      <property name="configurationFile" value="jgroups.xml" />

                  </properties>

              </transport>

              <serialization marshallerClass="org.infinispan.marshall.VersionAwareMarshaller" />

          </global>

       

          <default>

              <!-- Configure a synchronous replication cache -->

              <clustering mode="distribution">

                  <sync />

                  <hash numOwners="2" />

              </clustering>

       

          </default>

         <namedCache name="yunhua">

         <indexing enabled="true"  indexLocalOnly="true" >

               <properties>

                  <property name="hibernate.search.default.directory_provider" value="ram" /> 

                  <property name="hibernate.search.lucene_version" value="LUCENE_30" />

                        

               </properties>

            </indexing> 

         </namedCache>

       

      </infinispan>