Skip to content

Commit

Permalink
GEODE-2543: Remove incorrectly marked deprecated methods from LuceneS…
Browse files Browse the repository at this point in the history
…ervice and LuceneQueryFactory api
  • Loading branch information
jhuynh1 committed Feb 25, 2017
1 parent da3767d commit 337f5af
Show file tree
Hide file tree
Showing 9 changed files with 4 additions and 55 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,4 @@ public interface LuceneQuery<K, V> {
*/
public int getLimit();

/**
* Get projected fields setting of current query.
*/
public String[] getProjectedFieldNames();

}
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,6 @@ public interface LuceneQueryFactory {
*/
LuceneQueryFactory setResultLimit(int limit);

/**
* Set a list of fields for result projection.
*
* @param fieldNames
* @return itself
*
* @deprecated TODO This feature is not yet implemented
*/
@Deprecated
LuceneQueryFactory setProjectionFields(String... fieldNames);

/**
* Create wrapper object for lucene's QueryParser object using default standard analyzer. The
* queryString is using lucene QueryParser's syntax. QueryParser is for easy-to-use with human
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,6 @@
*/
@Experimental
public interface LuceneResultStruct<K, V> {
/**
* Return the value associated with the given field name
*
* @param fieldName the String name of the field
* @return the value associated with the specified field
* @throws IllegalArgumentException If this struct does not have a field named fieldName
*/
public Object getProjectedField(String fieldName);

/**
* Return key of the entry
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,7 @@ public void createIndex(String indexName, String regionPath,
* Destroy the lucene index
*
* @param index index object
* @deprecated TODO This feature is not yet implemented
*/
@Deprecated
public void destroyIndex(LuceneIndex index);

/**
Expand All @@ -131,17 +129,13 @@ public void createIndex(String indexName, String regionPath,
*/
public LuceneQueryFactory createLuceneQueryFactory();

/*
/**
* wait until the current entries in cache are indexed
*
* @param indexName index name
*
* @param regionPath region name
*
* @param timeout max wait time
*
* @param unit granularity of the timeout
*
* @return if entries are flushed within timeout
*/
public boolean waitUntilFlushed(String indexName, String regionPath, long timeout, TimeUnit unit)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
public class LuceneQueryFactoryImpl implements LuceneQueryFactory {
private int limit = DEFAULT_LIMIT;
private int pageSize = DEFAULT_PAGESIZE;
private String[] projectionFields = null;
private Cache cache;

LuceneQueryFactoryImpl(Cache cache) {
Expand Down Expand Up @@ -57,14 +56,9 @@ public <K, V> LuceneQuery<K, V> create(String indexName, String regionName,
throw new IllegalArgumentException("Region not found: " + regionName);
}
LuceneQueryImpl<K, V> luceneQuery =
new LuceneQueryImpl<K, V>(indexName, region, provider, projectionFields, limit, pageSize);
new LuceneQueryImpl<K, V>(indexName, region, provider, limit, pageSize);
return luceneQuery;
}

@Override
public LuceneQueryFactory setProjectionFields(String... fieldNames) {
projectionFields = fieldNames.clone();
return this;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -47,20 +47,17 @@ public class LuceneQueryImpl<K, V> implements LuceneQuery<K, V> {
private int limit = LuceneQueryFactory.DEFAULT_LIMIT;
private int pageSize = LuceneQueryFactory.DEFAULT_PAGESIZE;
private String indexName;
// The projected fields are local to a specific index per Query object.
private String[] projectedFieldNames;
/* the lucene Query object to be wrapped here */
private LuceneQueryProvider query;
private Region<K, V> region;
private String defaultField;

public LuceneQueryImpl(String indexName, Region<K, V> region, LuceneQueryProvider provider,
String[] projectionFields, int limit, int pageSize) {
int limit, int pageSize) {
this.indexName = indexName;
this.region = region;
this.limit = limit;
this.pageSize = pageSize;
this.projectedFieldNames = projectionFields;
this.query = provider;
}

Expand Down Expand Up @@ -138,8 +135,4 @@ public int getLimit() {
return this.limit;
}

@Override
public String[] getProjectedFieldNames() {
return this.projectedFieldNames;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,6 @@ public LuceneResultStructImpl(K key, V value, float score) {
this.score = score;
}

@Override
public Object getProjectedField(String fieldName) {
throw new UnsupportedOperationException();
}

@Override
public K getKey() {
return key;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,10 @@ public void shouldCreateQueryWithCorrectAttributes() {
LuceneQueryFactoryImpl f = new LuceneQueryFactoryImpl(cache);
f.setPageSize(5);
f.setResultLimit(25);
String[] projection = new String[] {"a", "b"};
f.setProjectionFields(projection);
LuceneQuery<Object, Object> query =
f.create("index", "region", new StringQueryProvider("test", DEFAULT_FIELD));
assertEquals(25, query.getLimit());
assertEquals(5, query.getPageSize());
assertArrayEquals(projection, query.getProjectedFieldNames());

Mockito.verify(cache).getRegion(Mockito.eq("region"));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public void createMocks() {
when(execution.withCollector(any())).thenReturn(execution);
when(execution.execute(anyString())).thenReturn((ResultCollector) collector);

query = new LuceneQueryImpl<Object, Object>("index", region, provider, null, LIMIT, 20) {
query = new LuceneQueryImpl<Object, Object>("index", region, provider, LIMIT, 20) {
@Override
protected Execution onRegion() {
return execution;
Expand Down

0 comments on commit 337f5af

Please sign in to comment.