Hi Dan, Thanks for the reply. I moved the Lucene query logic to Geode Function and now the query is working as expected.
Regards, Aj On Tue, Apr 7, 2020 at 12:52 AM Dan Smith <dsm...@pivotal.io> wrote: > Your custom query code does need to be on the server in order for this to > work. Specifically, this lambda is your LuceneQueryProvider, which needs to > be serializable in some way (Serializable, DataSerializable, etc.) and the > code need to be on the server: > index -> { > return IntPoint.newRangeQuery("age", 25, 35); > } > > > In your case, the lambda is capturing the surrounding class, > CustomerServiceImplTest, which is why you are getting an error about > CustomerServiceImplTest not being serializable. > > -Dan > > On Mon, Apr 6, 2020 at 2:16 PM vas aj <vasudevan.a...@gmail.com> wrote: > >> Hi team, >> >> Do I need to write & deploy a custom Geode Function in order to run the >> dynamic Lucene query? >> Can I get some help, please? >> >> I need to somehow execute a dynamic lucene query on Geode cluster. >> I am able to run successfully a static lucene query using the >> standard Lucene's StandardQueryParser, though. >> >> Regards, >> Ajay Vasudevan >> >> On Sun, Apr 5, 2020 at 5:29 PM vas aj <vasudevan.a...@gmail.com> wrote: >> >>> ++ Dev team >>> >>> Hi team, >>> >>> I am trying to execute Lucene query from Geode cache-client with the >>> following : >>> >>> class CustomerServiceImplTest { >>>> @Inject CustomerServiceGemfireConfiguration >>>> customerServiceGemfireConfiguration; >>>> @Test >>>> void getAllInterestedCustomers() throws Exception { >>>> LuceneService luceneService = >>>> CustomerServiceGemfireConfiguration.getLuceneService(); >>>> String title = "John"; >>>> LuceneQuery<Long, Customer> luceneQuery = >>>> luceneService >>>> .createLuceneQueryFactory() >>>> .setLimit(50) >>>> .create( >>>> "customerLuceneIndex", >>>> "customers", >>>> index -> { >>>> return IntPoint.newRangeQuery("age", 25, 35); >>>> }); >>>> Collection<Customer> allInterestedCustomers = >>>> luceneQuery.findValues(); >>>> System.out.println("all Customers => " + allInterestedCustomers); >>>> } >>>> } >>> >>> >>> I get the below error at luceneQuery.findValues() while executing it. >>> Can someone help me? >>> >>> org.apache.geode.cache.client.ServerOperationException: remote server on >>>> 192.168.0.3(24550:loner):38432:0d2d154b: While performing a remote >>>> executeRegionFunction >>>> at >>>> org.apache.geode.cache.client.internal.ExecuteRegionFunctionOp$ExecuteRegionFunctionOpImpl.processResponse(ExecuteRegionFunctionOp.java:437) >>>> at >>>> org.apache.geode.cache.client.internal.AbstractOp.processResponse(AbstractOp.java:222) >>>> at >>>> org.apache.geode.cache.client.internal.AbstractOp.attemptReadResponse(AbstractOp.java:195) >>>> at >>>> org.apache.geode.cache.client.internal.AbstractOp.attempt(AbstractOp.java:382) >>>> at >>>> org.apache.geode.cache.client.internal.AbstractOpWithTimeout.attempt(AbstractOpWithTimeout.java:45) >>>> at >>>> org.apache.geode.cache.client.internal.ConnectionImpl.execute(ConnectionImpl.java:263) >>>> at >>>> org.apache.geode.cache.client.internal.pooling.PooledConnection.execute(PooledConnection.java:353) >>>> at >>>> org.apache.geode.cache.client.internal.OpExecutorImpl.executeWithPossibleReAuthentication(OpExecutorImpl.java:750) >>>> at >>>> org.apache.geode.cache.client.internal.OpExecutorImpl.execute(OpExecutorImpl.java:138) >>>> at >>>> org.apache.geode.cache.client.internal.PoolImpl.execute(PoolImpl.java:787) >>>> at >>>> org.apache.geode.cache.client.internal.ExecuteRegionFunctionOp.execute(ExecuteRegionFunctionOp.java:90) >>>> at >>>> org.apache.geode.cache.client.internal.ServerRegionProxy.executeFunction(ServerRegionProxy.java:687) >>>> at >>>> org.apache.geode.internal.cache.execute.ServerRegionFunctionExecutor.executeOnServer(ServerRegionFunctionExecutor.java:206) >>>> at >>>> org.apache.geode.internal.cache.execute.ServerRegionFunctionExecutor.executeFunction(ServerRegionFunctionExecutor.java:158) >>>> at >>>> org.apache.geode.internal.cache.execute.ServerRegionFunctionExecutor.execute(ServerRegionFunctionExecutor.java:390) >>>> at >>>> org.apache.geode.internal.cache.execute.ServerRegionFunctionExecutor.execute(ServerRegionFunctionExecutor.java:351) >>>> at >>>> org.apache.geode.cache.lucene.internal.LuceneQueryImpl.findTopEntries(LuceneQueryImpl.java:121) >>>> at >>>> org.apache.geode.cache.lucene.internal.LuceneQueryImpl.findPages(LuceneQueryImpl.java:99) >>>> at >>>> org.apache.geode.cache.lucene.internal.LuceneQueryImpl.findResults(LuceneQueryImpl.java:85) >>>> at >>>> org.apache.geode.cache.lucene.internal.LuceneQueryImpl.findValues(LuceneQueryImpl.java:78) >>>> at >>>> CustomerServiceImplTest.getAllInterestedCustomers(CustomerServiceImplTest.java:35) >>>> >>>> *Caused by: java.lang.ClassNotFoundException: **CustomerServiceImplTest >>>> <<<< Why should the test class be loaded in Geode server ?* >>>> at java.net.URLClassLoader.findClass(URLClassLoader.java:382) >>>> at java.lang.ClassLoader.loadClass(ClassLoader.java:424) >>>> ... >>>> ... >>>> >>> >>> Regards >>> Aj Vas >>> >>