3 Replies Latest reply on Feb 9, 2012 1:33 PM by Sanne Grinovero

    How to query Remote Cache

    Srinivas ht Newbie

      Hi,

       

           I am new to Infinispan. I am able to query local cache, but when I convert the code from Cache with Remote Cache using Hotrod clinet. I am not able to get the handle for Search Manager instance.

           I figured out that because Search.getSearchManager() take a instance for a Cache and not remote Cache instance.

       

           I am developing a application in Client/Server mode. I am having one instance of Hotrod Server and 2 Hotrod clients. I am able to add Items (instance of car class)to the cache (cache.put api)from both the     

           clients and able to get Item from the cache (using cache.get).

       

           But I am not able to find a way to query the remote cache and get list of Items from the cache say list of car were cubicCapacity > 2000 and cubicCapacity < 4000

       

           Below is the code which I have taken from Github for storing in Remote Cache.

       

      @Indexed

      @ProvidedId

      public class Car {

       

       

          @Field(analyze = Analyze.NO)

          private String color;

          @Field(store = Store.YES)

          private String make;

          @Field(analyze = Analyze.NO)

          private int cubicCapacity;

       

       

          public Car(String make, String color, int cubicCapacity){

              this.color = color;

              this.make = make;

              this.cubicCapacity = cubicCapacity;

          }

       

       

          public String getColor(){

              return this.color;

          }

       

       

          public String getMake(){

              return this.make;

          }

       

       

          public int getCubicCapacity(){

              return this.cubicCapacity;

          }

       

       

          @Override

          public String toString() {

              return "Car{" + "color=" + color + "make=" + make + "cubicCapacity=" +

                      cubicCapacity + '}';

          }

       

       

          Can someone help me as how to achieve this.

        • 1. Re: How to query Remote Cache
          Sanne Grinovero Master

          Hello,

          I'm sorry but indexing and full text search is not supported via a remote cache!

           

          Some options:

          - you don't use the client/server approach but have your "client" connect as any other data node.

          - you write your own remoting connection and add all the features - including queries - you might need.

          - you help us adding this feature to Hot Rod ;-) We're looking into this anyway, but some help with coding or just directions of what you would need most would be great.

          • 2. Re: How to query Remote Cache
            Srinivas ht Newbie

            Thanks Sanne for the reply. Currently I am using an inmemory DB and I palnning to replace it with Infinispan. I have a Database Access Layer (DAL) were the instance of in-memory DB is running.

            I have mutiple module in my application that perform DB operations. Currently I have my DAL as REST web service. So I was thinking to use Infinispan in Client/Server mode instead of having a REST call.

            Can you tell me in which version of infinispan query on Remote Cache will be avaliable (like current query feature on local cache).

            • 3. Re: How to query Remote Cache
              Sanne Grinovero Master

              Currently I am using an inmemory DB and I palnning to replace it with Infinispan. I have a Database Access Layer (DAL) were the instance of in-memory DB is running.

              I have mutiple module in my application that perform DB operations. Currently I have my DAL as REST web service. So I was thinking to use Infinispan in Client/Server mode instead of having a REST call.

              So it looks like you could easily replace it changing the DAL and keeping the REST api for the time being? I would suggest to try so.

               

               

              Can you tell me in which version of infinispan query on Remote Cache will be avaliable (like current query feature on local cache).

              I can't make promises on the schedule, it should be Infinispan 6.0.

              1 of 1 people found this helpful