geode-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From n...@apache.org
Subject geode git commit: GEODE-2637: Refactored LuceneQueryFactory.setResultLimit()
Date Fri, 12 May 2017 18:55:36 GMT
Repository: geode
Updated Branches:
  refs/heads/develop 0c5011ec7 -> efbe53cba


GEODE-2637: Refactored LuceneQueryFactory.setResultLimit()

	* Renamed LuceneQueryFactory.getResult to setLimit()
	* This is done to match the cwiki documents


Project: http://git-wip-us.apache.org/repos/asf/geode/repo
Commit: http://git-wip-us.apache.org/repos/asf/geode/commit/efbe53cb
Tree: http://git-wip-us.apache.org/repos/asf/geode/tree/efbe53cb
Diff: http://git-wip-us.apache.org/repos/asf/geode/diff/efbe53cb

Branch: refs/heads/develop
Commit: efbe53cbafe30c5fb17681e22a3c83f3042e08ae
Parents: 0c5011e
Author: nabarunnag <nag@cs.wisc.edu>
Authored: Fri May 12 06:01:01 2017 -0700
Committer: nabarunnag <nag@cs.wisc.edu>
Committed: Fri May 12 06:01:01 2017 -0700

----------------------------------------------------------------------
 .../geode/cache/lucene/LuceneQueryFactory.java  |  2 +-
 .../lucene/internal/LuceneQueryFactoryImpl.java |  2 +-
 .../functions/LuceneSearchIndexFunction.java    |  5 +----
 .../geode/cache/lucene/EvictionDUnitTest.java   |  2 +-
 .../geode/cache/lucene/ExpirationDUnitTest.java |  3 +--
 .../lucene/LuceneIndexDestroyDUnitTest.java     |  2 +-
 .../cache/lucene/LuceneQueriesAccessorBase.java |  4 ++--
 .../cache/lucene/MixedObjectIndexDUnitTest.java | 20 ++++++++++----------
 .../geode/cache/lucene/PaginationDUnitTest.java |  5 ++---
 .../LuceneQueryFactoryImplJUnitTest.java        |  2 +-
 .../LuceneSearchIndexFunctionJUnitTest.java     |  2 +-
 11 files changed, 22 insertions(+), 27 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/geode/blob/efbe53cb/geode-lucene/src/main/java/org/apache/geode/cache/lucene/LuceneQueryFactory.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/LuceneQueryFactory.java
b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/LuceneQueryFactory.java
index 5cf794a..6236d12 100644
--- a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/LuceneQueryFactory.java
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/LuceneQueryFactory.java
@@ -57,7 +57,7 @@ public interface LuceneQueryFactory {
    * @return itself
    * @throws IllegalArgumentException if the value is less than or equal to zero.
    */
-  LuceneQueryFactory setResultLimit(int limit);
+  LuceneQueryFactory setLimit(int limit);
 
   /**
    * Creates a query based on a query string which is parsed by Lucene's

http://git-wip-us.apache.org/repos/asf/geode/blob/efbe53cb/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneQueryFactoryImpl.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneQueryFactoryImpl.java
b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneQueryFactoryImpl.java
index 5c088dc..f3e4f10 100644
--- a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneQueryFactoryImpl.java
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/LuceneQueryFactoryImpl.java
@@ -41,7 +41,7 @@ public class LuceneQueryFactoryImpl implements LuceneQueryFactory {
   }
 
   @Override
-  public LuceneQueryFactory setResultLimit(int limit) {
+  public LuceneQueryFactory setLimit(int limit) {
     if (limit <= 0) {
       throw new IllegalArgumentException("Limit is <= 0: " + limit);
     }

http://git-wip-us.apache.org/repos/asf/geode/blob/efbe53cb/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/functions/LuceneSearchIndexFunction.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/functions/LuceneSearchIndexFunction.java
b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/functions/LuceneSearchIndexFunction.java
index d9dfbec..06df285 100755
--- a/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/functions/LuceneSearchIndexFunction.java
+++ b/geode-lucene/src/main/java/org/apache/geode/cache/lucene/internal/cli/functions/LuceneSearchIndexFunction.java
@@ -15,11 +15,9 @@
 
 package org.apache.geode.cache.lucene.internal.cli.functions;
 
-import java.util.ArrayList;
 import java.util.HashSet;
 import java.util.List;
 import java.util.Set;
-import java.util.stream.Collectors;
 
 import org.apache.geode.cache.Cache;
 import org.apache.geode.cache.CacheFactory;
@@ -35,7 +33,6 @@ import org.apache.geode.cache.lucene.internal.cli.LuceneIndexDetails;
 import org.apache.geode.cache.lucene.internal.cli.LuceneIndexInfo;
 import org.apache.geode.cache.lucene.internal.cli.LuceneQueryInfo;
 import org.apache.geode.cache.lucene.internal.cli.LuceneSearchResults;
-import org.apache.geode.cache.query.RegionNotFoundException;
 import org.apache.geode.internal.InternalEntity;
 
 /**
@@ -74,7 +71,7 @@ public class LuceneSearchIndexFunction<K, V> extends FunctionAdapter
implements
             + queryInfo.getRegionPath());
       }
       final LuceneQuery<K, V> query = luceneService.createLuceneQueryFactory()
-          .setResultLimit(queryInfo.getLimit()).create(queryInfo.getIndexName(),
+          .setLimit(queryInfo.getLimit()).create(queryInfo.getIndexName(),
               queryInfo.getRegionPath(), queryInfo.getQueryString(), queryInfo.getDefaultField());
       if (queryInfo.getKeysOnly()) {
         query.findKeys().forEach(key -> result.add(new LuceneSearchResults(key.toString())));

http://git-wip-us.apache.org/repos/asf/geode/blob/efbe53cb/geode-lucene/src/test/java/org/apache/geode/cache/lucene/EvictionDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/EvictionDUnitTest.java
b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/EvictionDUnitTest.java
index 1eac799..9a1510c 100644
--- a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/EvictionDUnitTest.java
+++ b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/EvictionDUnitTest.java
@@ -122,7 +122,7 @@ public class EvictionDUnitTest extends LuceneQueriesAccessorBase {
     accessor.invoke(() -> {
       LuceneService luceneService = LuceneServiceProvider.get(getCache());
       LuceneQuery<Integer, TestObject> query = luceneService.createLuceneQueryFactory()
-          .setResultLimit(100).create(INDEX_NAME, REGION_NAME, "world", "text");
+          .setLimit(100).create(INDEX_NAME, REGION_NAME, "world", "text");
       List<LuceneResultStruct<Integer, TestObject>> resultList = query.findResults();
       assertEquals(NUM_BUCKETS, resultList.size());
     });

http://git-wip-us.apache.org/repos/asf/geode/blob/efbe53cb/geode-lucene/src/test/java/org/apache/geode/cache/lucene/ExpirationDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/ExpirationDUnitTest.java
b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/ExpirationDUnitTest.java
index 92c7370..22c050d 100644
--- a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/ExpirationDUnitTest.java
+++ b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/ExpirationDUnitTest.java
@@ -30,7 +30,6 @@ import org.junit.experimental.categories.Category;
 import org.junit.runner.RunWith;
 
 import java.util.Collection;
-import java.util.List;
 import java.util.concurrent.TimeUnit;
 import java.util.stream.IntStream;
 import junitparams.JUnitParamsRunner;
@@ -73,7 +72,7 @@ public class ExpirationDUnitTest extends LuceneQueriesAccessorBase {
         .atMost(EXPIRATION_TIMEOUT_SEC + EXTRA_WAIT_TIME_SEC, TimeUnit.SECONDS).until(()
-> {
           LuceneService luceneService = LuceneServiceProvider.get(getCache());
           LuceneQuery<Integer, TestObject> luceneQuery = luceneService.createLuceneQueryFactory()
-              .setResultLimit(100).create(INDEX_NAME, REGION_NAME, "world", "text");
+              .setLimit(100).create(INDEX_NAME, REGION_NAME, "world", "text");
 
           Collection luceneResultList = null;
           try {

http://git-wip-us.apache.org/repos/asf/geode/blob/efbe53cb/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneIndexDestroyDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneIndexDestroyDUnitTest.java
b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneIndexDestroyDUnitTest.java
index 16ac116..67adfb9 100644
--- a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneIndexDestroyDUnitTest.java
+++ b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneIndexDestroyDUnitTest.java
@@ -572,7 +572,7 @@ public class LuceneIndexDestroyDUnitTest extends LuceneDUnitTest {
   private void executeQuery(String indexName, String queryString, String field,
       int expectedResultsSize) throws LuceneQueryException {
     LuceneService luceneService = LuceneServiceProvider.get(getCache());
-    LuceneQuery query = luceneService.createLuceneQueryFactory().setResultLimit(expectedResultsSize)
+    LuceneQuery query = luceneService.createLuceneQueryFactory().setLimit(expectedResultsSize)
         .create(indexName, REGION_NAME, queryString, field);
     Collection results = query.findValues();
     assertEquals(expectedResultsSize, results.size());

http://git-wip-us.apache.org/repos/asf/geode/blob/efbe53cb/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneQueriesAccessorBase.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneQueriesAccessorBase.java
b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneQueriesAccessorBase.java
index 241d374..9568ab8 100644
--- a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneQueriesAccessorBase.java
+++ b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/LuceneQueriesAccessorBase.java
@@ -98,8 +98,8 @@ public class LuceneQueriesAccessorBase extends LuceneDUnitTest {
 
       LuceneService service = LuceneServiceProvider.get(cache);
       LuceneQuery<Integer, TestObject> query;
-      query = service.createLuceneQueryFactory().setResultLimit(1000).setPageSize(1000)
-          .create(INDEX_NAME, REGION_NAME, queryString, defaultField);
+      query = service.createLuceneQueryFactory().setLimit(1000).setPageSize(1000).create(INDEX_NAME,
+          REGION_NAME, queryString, defaultField);
       Collection<?> results = query.findKeys();
 
       assertEquals(expectedResultsSize, results.size());

http://git-wip-us.apache.org/repos/asf/geode/blob/efbe53cb/geode-lucene/src/test/java/org/apache/geode/cache/lucene/MixedObjectIndexDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/MixedObjectIndexDUnitTest.java
b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/MixedObjectIndexDUnitTest.java
index affccde..949ce25 100644
--- a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/MixedObjectIndexDUnitTest.java
+++ b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/MixedObjectIndexDUnitTest.java
@@ -65,7 +65,7 @@ public class MixedObjectIndexDUnitTest extends LuceneQueriesAccessorBase
{
 
     accessor.invoke(() -> {
       LuceneService luceneService = LuceneServiceProvider.get(getCache());
-      LuceneQuery luceneQuery = luceneService.createLuceneQueryFactory().setResultLimit(100)
+      LuceneQuery luceneQuery = luceneService.createLuceneQueryFactory().setLimit(100)
           .create(INDEX_NAME, REGION_NAME, "world", "text");
       List resultList = luceneQuery.findResults();
       int objectType_1_count = 0;
@@ -108,13 +108,13 @@ public class MixedObjectIndexDUnitTest extends LuceneQueriesAccessorBase
{
 
     accessor.invoke(() -> {
       LuceneService luceneService = LuceneServiceProvider.get(getCache());
-      LuceneQuery luceneQueryForTextField = luceneService.createLuceneQueryFactory()
-          .setResultLimit(100).create(INDEX_NAME, REGION_NAME, "world", "text");
+      LuceneQuery luceneQueryForTextField = luceneService.createLuceneQueryFactory().setLimit(100)
+          .create(INDEX_NAME, REGION_NAME, "world", "text");
       List luceneResults = luceneQueryForTextField.findResults();
       validateObjectResultCounts(luceneResults, TestObject.class, NUM_BUCKETS,
           TestObjectWithSameFieldName.class, NUM_BUCKETS, TestObjectWithNoCommonField.class,
0);
 
-      luceneQueryForTextField = luceneService.createLuceneQueryFactory().setResultLimit(100)
+      luceneQueryForTextField = luceneService.createLuceneQueryFactory().setLimit(100)
           .create(INDEX_NAME, REGION_NAME, "world", "data");
       luceneResults = luceneQueryForTextField.findResults();
       validateObjectResultCounts(luceneResults, TestObject.class, 0,
@@ -149,8 +149,8 @@ public class MixedObjectIndexDUnitTest extends LuceneQueriesAccessorBase
{
 
     accessor.invoke(() -> {
       LuceneService luceneService = LuceneServiceProvider.get(getCache());
-      LuceneQuery luceneQueryForTextField = luceneService.createLuceneQueryFactory()
-          .setResultLimit(100).create(INDEX_NAME, REGION_NAME, "world", "text");
+      LuceneQuery luceneQueryForTextField = luceneService.createLuceneQueryFactory().setLimit(100)
+          .create(INDEX_NAME, REGION_NAME, "world", "text");
       List luceneResults = luceneQueryForTextField.findResults();
       validateObjectResultCounts(luceneResults, TestObject.class, NUM_BUCKETS,
           TestObjectWithSameFieldName.class, NUM_BUCKETS, TestObjectWithNoCommonField.class,
0);
@@ -184,8 +184,8 @@ public class MixedObjectIndexDUnitTest extends LuceneQueriesAccessorBase
{
     accessor.invoke(() -> {
       LuceneService luceneService = LuceneServiceProvider.get(getCache());
 
-      LuceneQuery luceneQueryForTextField = luceneService.createLuceneQueryFactory()
-          .setResultLimit(100).create(INDEX_NAME, REGION_NAME, "world", "text");
+      LuceneQuery luceneQueryForTextField = luceneService.createLuceneQueryFactory().setLimit(100)
+          .create(INDEX_NAME, REGION_NAME, "world", "text");
 
       List luceneResults = luceneQueryForTextField.findResults();
       validateObjectResultCounts(luceneResults, TestObject.class, NUM_BUCKETS,
@@ -194,7 +194,7 @@ public class MixedObjectIndexDUnitTest extends LuceneQueriesAccessorBase
{
 
       FloatRangeQueryProvider floatRangeQueryProvider =
           new FloatRangeQueryProvider("text", 999.0f, 999.2f);
-      luceneQueryForTextField = luceneService.createLuceneQueryFactory().setResultLimit(100)
+      luceneQueryForTextField = luceneService.createLuceneQueryFactory().setLimit(100)
           .create(INDEX_NAME, REGION_NAME, floatRangeQueryProvider);
 
       luceneResults = luceneQueryForTextField.findResults();
@@ -203,7 +203,7 @@ public class MixedObjectIndexDUnitTest extends LuceneQueriesAccessorBase
{
           TestObjectSameFieldNameButDifferentDataTypeInteger.class, 0);
 
       IntRangeQueryProvider intRangeQueryProvider = new IntRangeQueryProvider("text", 1000,
1000);
-      luceneQueryForTextField = luceneService.createLuceneQueryFactory().setResultLimit(100)
+      luceneQueryForTextField = luceneService.createLuceneQueryFactory().setLimit(100)
           .create(INDEX_NAME, REGION_NAME, intRangeQueryProvider);
 
       luceneResults = luceneQueryForTextField.findResults();

http://git-wip-us.apache.org/repos/asf/geode/blob/efbe53cb/geode-lucene/src/test/java/org/apache/geode/cache/lucene/PaginationDUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/PaginationDUnitTest.java
b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/PaginationDUnitTest.java
index 11d5cd0..7268258 100644
--- a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/PaginationDUnitTest.java
+++ b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/PaginationDUnitTest.java
@@ -26,7 +26,6 @@ import org.apache.geode.cache.Region;
 import org.apache.geode.test.dunit.Assert;
 import org.apache.geode.test.dunit.SerializableRunnableIF;
 import org.apache.geode.test.junit.categories.DistributedTest;
-import org.junit.Ignore;
 import org.junit.Test;
 import org.junit.experimental.categories.Category;
 import org.junit.runner.RunWith;
@@ -79,7 +78,7 @@ public class PaginationDUnitTest extends LuceneQueriesAccessorBase {
       Cache cache = getCache();
       LuceneService service = LuceneServiceProvider.get(cache);
       LuceneQuery<Integer, TestObject> query;
-      query = service.createLuceneQueryFactory().setResultLimit(1000).setPageSize(PAGE_SIZE)
+      query = service.createLuceneQueryFactory().setLimit(1000).setPageSize(PAGE_SIZE)
           .create(INDEX_NAME, REGION_NAME, "world", "text");
       PageableLuceneQueryResults<Integer, TestObject> pages = query.findPages();
       assertTrue(pages.hasNext());
@@ -121,7 +120,7 @@ public class PaginationDUnitTest extends LuceneQueriesAccessorBase {
       Cache cache = getCache();
       LuceneService service = LuceneServiceProvider.get(cache);
       LuceneQuery<Integer, TestObject> query;
-      query = service.createLuceneQueryFactory().setResultLimit(1000).setPageSize(PAGE_SIZE)
+      query = service.createLuceneQueryFactory().setLimit(1000).setPageSize(PAGE_SIZE)
           .create(INDEX_NAME, REGION_NAME, "world", "text");
       PageableLuceneQueryResults<Integer, TestObject> pages = query.findPages();
       assertTrue(pages.hasNext());

http://git-wip-us.apache.org/repos/asf/geode/blob/efbe53cb/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/LuceneQueryFactoryImplJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/LuceneQueryFactoryImplJUnitTest.java
b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/LuceneQueryFactoryImplJUnitTest.java
index ccc5bb7..8c00eb2 100644
--- a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/LuceneQueryFactoryImplJUnitTest.java
+++ b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/LuceneQueryFactoryImplJUnitTest.java
@@ -43,7 +43,7 @@ public class LuceneQueryFactoryImplJUnitTest {
     when(cache.getRegion(any())).thenReturn(region);
     LuceneQueryFactoryImpl f = new LuceneQueryFactoryImpl(cache);
     f.setPageSize(5);
-    f.setResultLimit(25);
+    f.setLimit(25);
     LuceneQuery<Object, Object> query =
         f.create("index", "region", new StringQueryProvider("test", DEFAULT_FIELD));
     assertEquals(25, query.getLimit());

http://git-wip-us.apache.org/repos/asf/geode/blob/efbe53cb/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/cli/functions/LuceneSearchIndexFunctionJUnitTest.java
----------------------------------------------------------------------
diff --git a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/cli/functions/LuceneSearchIndexFunctionJUnitTest.java
b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/cli/functions/LuceneSearchIndexFunctionJUnitTest.java
index 36efede..d774d7b 100644
--- a/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/cli/functions/LuceneSearchIndexFunctionJUnitTest.java
+++ b/geode-lucene/src/test/java/org/apache/geode/cache/lucene/internal/cli/functions/LuceneSearchIndexFunctionJUnitTest.java
@@ -93,7 +93,7 @@ public class LuceneSearchIndexFunctionJUnitTest {
 
     doReturn(mock(LuceneIndex.class)).when(service).getIndex(anyString(), anyString());
     doReturn(mockQueryFactory).when(service).createLuceneQueryFactory();
-    doReturn(mockQueryFactory).when(mockQueryFactory).setResultLimit(anyInt());
+    doReturn(mockQueryFactory).when(mockQueryFactory).setLimit(anyInt());
     doReturn(mockQuery).when(mockQueryFactory).create(any(), any(), any(), any());
     when(mockQuery.findPages()).thenReturn(pageableLuceneQueryResults);
     when(pageableLuceneQueryResults.hasNext()).thenReturn(true).thenReturn(false);


Mime
View raw message