http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f189ff52/gemfire-core/build.gradle ---------------------------------------------------------------------- diff --cc gemfire-core/build.gradle index 185be12,b44525c..80761ed --- a/gemfire-core/build.gradle +++ b/gemfire-core/build.gradle @@@ -11,61 -11,63 +11,59 @@@ configurations } dependencies { + // Source Dependencies + // External provided files("${System.getProperty('java.home')}/../lib/tools.jar") - compile 'antlr:antlr:2.7.7' - compile 'com.fasterxml.jackson.core:jackson-annotations:2.2.0' - compile 'com.fasterxml.jackson.core:jackson-core:2.2.0' - compile 'com.fasterxml.jackson.core:jackson-databind:2.2.0' - compile 'com.google.code.findbugs:annotations:3.0.0' - compile 'commons-io:commons-io:2.3' - compile 'commons-logging:commons-logging:1.1.1' - compile 'commons-modeler:commons-modeler:2.0' - compile 'it.unimi.dsi:fastutil:7.0.2' - compile 'javax.activation:activation:1.1.1' - compile 'javax.mail:javax.mail-api:1.4.5' - compile 'javax.resource:javax.resource-api:1.7' - compile 'javax.servlet:javax.servlet-api:3.1.0' - compile 'javax.transaction:javax.transaction-api:1.2' - compile 'mx4j:mx4j:3.0.1' - compile 'mx4j:mx4j-remote:3.0.1' - compile 'mx4j:mx4j-tools:3.0.1' - compile 'net.java.dev.jna:jna:4.0.0' - compile 'net.sourceforge.jline:jline:1.0.S2-B' - compile 'org.eclipse.jetty:jetty-http:9.2.3.v20140905' - compile 'org.eclipse.jetty:jetty-io:9.2.3.v20140905' - compile 'org.eclipse.jetty:jetty-security:9.2.3.v20140905' - compile 'org.eclipse.jetty:jetty-server:9.2.3.v20140905' - compile 'org.eclipse.jetty:jetty-servlet:9.2.3.v20140905' - compile 'org.eclipse.jetty:jetty-util:9.2.3.v20140905' - compile 'org.eclipse.jetty:jetty-webapp:9.2.3.v20140905' - compile 'org.eclipse.jetty:jetty-xml:9.2.3.v20140905' - compile 'org.fusesource.jansi:jansi:1.8' - compile 'org.apache.logging.log4j:log4j-api:2.1' - compile 'org.apache.logging.log4j:log4j-core:2.1' - runtime 'org.apache.logging.log4j:log4j-slf4j-impl:2.1' - runtime 'org.apache.logging.log4j:log4j-jcl:2.1' - runtime 'org.apache.logging.log4j:log4j-jul:2.1' - compile 'org.slf4j:slf4j-api:1.7.7' - compile 'org.springframework.data:spring-data-commons:1.9.1.RELEASE' - provided 'org.springframework.data:spring-data-gemfire:1.5.1.RELEASE' - compile 'org.springframework:spring-tx:3.2.12.RELEASE' - compile 'org.springframework.shell:spring-shell:1.0.0.RELEASE' - compile 'org.xerial.snappy:snappy-java:1.1.1.6' - provided 'org.apache.hadoop:hadoop-common:2.4.1' - provided 'org.apache.hadoop:hadoop-annotations:2.4.1' - provided 'org.apache.hadoop:hadoop-hdfs:2.4.1' - provided 'org.apache.hadoop:hadoop-mapreduce-client-core:2.4.1' - compile 'org.apache.hbase:hbase:0.94.27' - provided 'commons-lang:commons-lang:2.5' - provided 'com.google.guava:guava:11.0.2' - compile 'io.netty:netty-all:4.0.4.Final' - - testRuntime 'org.apache.hadoop:hadoop-auth:2.4.1' - testRuntime 'commons-collections:commons-collections:3.2.1' - testRuntime 'commons-configuration:commons-configuration:1.6' - testRuntime 'commons-io:commons-io:2.1' - testRuntime 'log4j:log4j:1.2.17' - + compile 'antlr:antlr:' + project.'antlr.version' + compile 'com.fasterxml.jackson.core:jackson-annotations:' + project.'jackson.version' + compile 'com.fasterxml.jackson.core:jackson-core:' + project.'jackson.version' + compile 'com.fasterxml.jackson.core:jackson-databind:' + project.'jackson.version' + compile 'com.google.code.findbugs:annotations:' + project.'annotations.version' + provided 'com.google.guava:guava:' + project.'guava.version' + compile 'commons-io:commons-io:' + project.'commons-io.version' + provided 'commons-lang:commons-lang:' + project.'commons-lang.version' + compile 'commons-logging:commons-logging:' + project.'commons-logging.version' + compile 'commons-modeler:commons-modeler:' + project.'commons-modeler.version' + compile 'io.netty:netty-all:' + project.'netty-all.version' + compile 'it.unimi.dsi:fastutil:' + project.'fastutil.version' + compile 'javax.activation:activation:' + project.'activation.version' + compile 'javax.mail:javax.mail-api:' + project.'javax.mail-api.version' + compile 'javax.resource:javax.resource-api:' + project.'javax.resource-api.version' + compile 'javax.servlet:javax.servlet-api:' + project.'javax.servlet-api.version' + compile 'javax.transaction:javax.transaction-api:' + project.'javax.transaction-api.version' + compile 'mx4j:mx4j:' + project.'mx4j.version' + compile 'mx4j:mx4j-remote:' + project.'mx4j.version' + compile 'mx4j:mx4j-tools:' + project.'mx4j.version' + compile 'net.java.dev.jna:jna:' + project.'jna.version' + compile 'net.sourceforge.jline:jline:' + project.'jline.version' + provided 'org.apache.hadoop:hadoop-common:' + project.'hadoop.version' + provided 'org.apache.hadoop:hadoop-annotations:' + project.'hadoop.version' + provided 'org.apache.hadoop:hadoop-hdfs:' + project.'hadoop.version' + provided 'org.apache.hadoop:hadoop-mapreduce-client-core:' + project.'hadoop.version' + compile 'org.apache.hbase:hbase:' + project.'hbase.version' + compile 'org.apache.logging.log4j:log4j-api:' + project.'log4j.version' + compile 'org.apache.logging.log4j:log4j-core:' + project.'log4j.version' + runtime 'org.apache.logging.log4j:log4j-slf4j-impl:' + project.'log4j.version' + runtime 'org.apache.logging.log4j:log4j-jcl:' + project.'log4j.version' + runtime 'org.apache.logging.log4j:log4j-jul:' + project.'log4j.version' - compile 'org.apache.lucene:lucene-analyzers-common:' + project.'lucene.version' - compile 'org.apache.lucene:lucene-core:' + project.'lucene.version' - compile 'org.apache.lucene:lucene-queries:' + project.'lucene.version' - compile 'org.apache.lucene:lucene-queryparser:' + project.'lucene.version' + compile 'org.eclipse.jetty:jetty-http:' + project.'jetty.version' + compile 'org.eclipse.jetty:jetty-io:' + project.'jetty.version' + compile 'org.eclipse.jetty:jetty-security:' + project.'jetty.version' + compile 'org.eclipse.jetty:jetty-server:' + project.'jetty.version' + compile 'org.eclipse.jetty:jetty-servlet:' + project.'jetty.version' + compile 'org.eclipse.jetty:jetty-util:' + project.'jetty.version' + compile 'org.eclipse.jetty:jetty-webapp:' + project.'jetty.version' + compile 'org.eclipse.jetty:jetty-xml:' + project.'jetty.version' + compile 'org.fusesource.jansi:jansi:' + project.'jansi.version' + compile 'org.slf4j:slf4j-api:' + project.'slf4j-api.version' + compile 'org.springframework.data:spring-data-commons:' + project.'spring-data-commons.version' + provided 'org.springframework.data:spring-data-gemfire:' + project.'spring-data-gemfire.version' + compile 'org.springframework:spring-tx:' + project.'springframework.version' + compile 'org.springframework.shell:spring-shell:' + project.'spring-shell.version' + compile 'org.xerial.snappy:snappy-java:' + project.'snappy-java.version' + compile 'org.apache.hbase:hbase:' + project.'hbase.version' + + compile project(':gemfire-common') compile project(':gemfire-jgroups') compile project(':gemfire-joptsimple') compile project(':gemfire-json')
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f189ff52/gemfire-core/src/main/java/com/gemstone/gemfire/cache/GemFireCache.java ---------------------------------------------------------------------- diff --cc gemfire-core/src/main/java/com/gemstone/gemfire/cache/GemFireCache.java index f5ad158,c7cce3c..9425706 --- a/gemfire-core/src/main/java/com/gemstone/gemfire/cache/GemFireCache.java +++ b/gemfire-core/src/main/java/com/gemstone/gemfire/cache/GemFireCache.java @@@ -18,8 -27,7 +27,6 @@@ import com.gemstone.gemfire.LogWriter import com.gemstone.gemfire.cache.client.ClientCache; import com.gemstone.gemfire.cache.client.ClientCacheFactory; import com.gemstone.gemfire.cache.control.ResourceManager; - import com.gemstone.gemfire.cache.hdfs.HDFSStore; - import com.gemstone.gemfire.cache.hdfs.HDFSStoreFactory; -import com.gemstone.gemfire.cache.lucene.LuceneService; import com.gemstone.gemfire.cache.wan.GatewaySenderFactory; import com.gemstone.gemfire.distributed.DistributedSystem; import com.gemstone.gemfire.pdx.PdxSerializer; @@@ -252,20 -260,10 +259,4 @@@ public interface GemFireCache extends R * @since 6.6 */ public Properties getInitializerProps(); -- -- /** - * Returns the HDFSStore by name or <code>null</code> if no HDFSStore is - * found. - * - * @param name the name of the HDFSStore to find. - * Returns the LuceneService singleton instance. - * @since 8.5 -- */ - public HDFSStore findHDFSStore(String name); - - /** - * Creates a {@link HDFSStoreFactory} for creating a {@link HDFSStore} - * - * @return the HDFS store factory - */ - public HDFSStoreFactory createHDFSStoreFactory(); - - public LuceneService getLuceneService(); } http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f189ff52/gemfire-core/src/main/java/com/gemstone/gemfire/cache/asyncqueue/internal/AsyncEventQueueFactoryImpl.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f189ff52/gemfire-core/src/main/java/com/gemstone/gemfire/cache/asyncqueue/internal/AsyncEventQueueImpl.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f189ff52/gemfire-core/src/main/java/com/gemstone/gemfire/internal/DataSerializableFixedID.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f189ff52/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/BucketRegion.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f189ff52/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/GemFireCacheImpl.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f189ff52/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/InternalCache.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f189ff52/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/LocalRegion.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f189ff52/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/PartitionedRegionDataStore.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f189ff52/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/extension/SimpleExtensionPoint.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f189ff52/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/wan/AbstractGatewaySender.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f189ff52/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/wan/GatewaySenderAttributes.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f189ff52/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/xmlcache/CacheCreation.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f189ff52/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/xmlcache/DefaultEntityResolver2.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f189ff52/gemfire-core/src/main/java/com/gemstone/gemfire/internal/cache/xmlcache/PivotalEntityResolver.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f189ff52/gemfire-core/src/main/java/com/gemstone/gemfire/internal/util/concurrent/CopyOnWriteHashMap.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f189ff52/gemfire-core/src/main/java/com/gemstone/gemfire/internal/util/concurrent/CopyOnWriteWeakHashMap.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f189ff52/gemfire-core/src/test/java/com/gemstone/gemfire/internal/cache/extension/mock/DestroyMockCacheExtensionFunction.java ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f189ff52/gemfire-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/LuceneIndex.java ---------------------------------------------------------------------- diff --cc gemfire-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/LuceneIndex.java index fc9752a,0000000..49b74b1 mode 100644,000000..100644 --- a/gemfire-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/LuceneIndex.java +++ b/gemfire-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/LuceneIndex.java @@@ -1,49 -1,0 +1,58 @@@ - /*========================================================================= - * Copyright (c) 2002-2014 Pivotal Software, Inc. All Rights Reserved. - * This product is protected by U.S. and international copyright - * and intellectual property laws. Pivotal products are covered by - * more patents listed at http://www.pivotal.io/patents. - *======================================================================== ++/* ++ * Licensed to the Apache Software Foundation (ASF) under one or more ++ * contributor license agreements. See the NOTICE file distributed with ++ * this work for additional information regarding copyright ownership. ++ * The ASF licenses this file to You under the Apache License, Version 2.0 ++ * (the "License"); you may not use this file except in compliance with ++ * the License. You may obtain a copy of the License at ++ * ++ * http://www.apache.org/licenses/LICENSE-2.0 ++ * ++ * Unless required by applicable law or agreed to in writing, software ++ * distributed under the License is distributed on an "AS IS" BASIS, ++ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ++ * See the License for the specific language governing permissions and ++ * limitations under the License. + */ + +package com.gemstone.gemfire.cache.lucene; + +import java.util.Map; + +import org.apache.lucene.analysis.Analyzer; + + +/** + * An lucene index is built over the data stored in a GemFire Region. + * <p> + * An index is specified using a index name, field names, region name. + * <p> + * The index name and region name together uniquely identifies the lucene index. + * <p> + * + * @author Xiaojian Zhou + * @since 8.5 + */ +public interface LuceneIndex { + + /** + * @return the index name of this index + */ + public String getName(); + + /** + * @return the region name for this index + */ + public String getRegionPath(); + + /** + * @return the indexed field names in a Set + */ + public String[] getFieldNames(); + + /** + * @return the field to analyzer map + */ + public Map<String, Analyzer> getFieldAnalyzerMap(); + +} http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f189ff52/gemfire-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/LuceneQuery.java ---------------------------------------------------------------------- diff --cc gemfire-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/LuceneQuery.java index 09d3a07,0000000..e10b686 mode 100644,000000..100644 --- a/gemfire-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/LuceneQuery.java +++ b/gemfire-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/LuceneQuery.java @@@ -1,29 -1,0 +1,45 @@@ ++/* ++ * Licensed to the Apache Software Foundation (ASF) under one or more ++ * contributor license agreements. See the NOTICE file distributed with ++ * this work for additional information regarding copyright ownership. ++ * The ASF licenses this file to You under the Apache License, Version 2.0 ++ * (the "License"); you may not use this file except in compliance with ++ * the License. You may obtain a copy of the License at ++ * ++ * http://www.apache.org/licenses/LICENSE-2.0 ++ * ++ * Unless required by applicable law or agreed to in writing, software ++ * distributed under the License is distributed on an "AS IS" BASIS, ++ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ++ * See the License for the specific language governing permissions and ++ * limitations under the License. ++ */ +package com.gemstone.gemfire.cache.lucene; + +/** + * Provides wrapper object of Lucene's Query object and execute the search. + * <p>Instances of this interface are created using + * {@link LuceneQueryFactory#create}. + * + */ +public interface LuceneQuery<K, V> { + /** + * Execute the search and get results. + */ + public LuceneQueryResults<K, V> search(); + + /** + * Get page size setting of current query. + */ + public int getPageSize(); + + /** + * Get limit size setting of current query. + */ + public int getLimit(); + + /** + * Get projected fields setting of current query. + */ + public String[] getProjectedFieldNames(); +} http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f189ff52/gemfire-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/LuceneQueryFactory.java ---------------------------------------------------------------------- diff --cc gemfire-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/LuceneQueryFactory.java index eea4b88,0000000..6604926 mode 100644,000000..100644 --- a/gemfire-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/LuceneQueryFactory.java +++ b/gemfire-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/LuceneQueryFactory.java @@@ -1,83 -1,0 +1,99 @@@ ++/* ++ * Licensed to the Apache Software Foundation (ASF) under one or more ++ * contributor license agreements. See the NOTICE file distributed with ++ * this work for additional information regarding copyright ownership. ++ * The ASF licenses this file to You under the Apache License, Version 2.0 ++ * (the "License"); you may not use this file except in compliance with ++ * the License. You may obtain a copy of the License at ++ * ++ * http://www.apache.org/licenses/LICENSE-2.0 ++ * ++ * Unless required by applicable law or agreed to in writing, software ++ * distributed under the License is distributed on an "AS IS" BASIS, ++ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ++ * See the License for the specific language governing permissions and ++ * limitations under the License. ++ */ +package com.gemstone.gemfire.cache.lucene; + +import org.apache.lucene.queryparser.classic.ParseException; + +/** + * Factory for creating instances of {@link LuceneQuery}. + * To get an instance of this factory call {@link LuceneService#createLuceneQueryFactory}. + * <P> + * To use this factory configure it with the <code>set</code> methods and then + * call {@link #create} to produce a {@link LuceneQuery} instance. + * + * @author Xiaojian Zhou + * @since 8.5 + */ +public interface LuceneQueryFactory { + + /** + * Default query result limit is 100 + */ + public static final int DEFAULT_LIMIT = 100; + + /** + * Default page size of result is 0, which means no pagination + */ + public static final int DEFAULT_PAGESIZE = 0; + + /** + * Set page size for a query result. The default page size is 0 which means no pagination. + * If specified negative value, throw IllegalArgumentException + * @param pageSize + * @return itself + */ + LuceneQueryFactory setPageSize(int pageSize); + + /** + * Set max limit of result for a query + * If specified limit is less or equal to zero, throw IllegalArgumentException + * @param limit + * @return itself + */ + 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 understandable syntax. + * + * @param regionName region name + * @param indexName index name + * @param queryString query string in lucene QueryParser's syntax + * @param K the key type in the query results + * @param V the value type in the query results + * @return LuceneQuery object + * @throws ParseException + */ + public <K, V> LuceneQuery<K, V> create(String indexName, String regionName, String queryString) + throws ParseException; + + /** + * Creates a wrapper object for Lucene's Query object. This {@link LuceneQuery} builder method could be used in + * advanced cases, such as cases where Lucene's Query object construction needs Lucene's API over query string. The + * {@link QueryDeserializer} will be used to re-construct the Lucene Query object on remote hosts. + * + * @param indexName index name + * @param regionName region name + * @param provider constructs and provides a Lucene Query object + * @param K the key type in the query results + * @param V the value type in the query results + * @return LuceneQuery object + */ + public <K, V> LuceneQuery<K, V> create(String indexName, String regionName, LuceneQueryProvider provider); +} http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f189ff52/gemfire-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/LuceneResultStruct.java ---------------------------------------------------------------------- diff --cc gemfire-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/LuceneResultStruct.java index 6ed0b99,0000000..1cf3c7c mode 100644,000000..100644 --- a/gemfire-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/LuceneResultStruct.java +++ b/gemfire-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/LuceneResultStruct.java @@@ -1,45 -1,0 +1,61 @@@ ++/* ++ * Licensed to the Apache Software Foundation (ASF) under one or more ++ * contributor license agreements. See the NOTICE file distributed with ++ * this work for additional information regarding copyright ownership. ++ * The ASF licenses this file to You under the Apache License, Version 2.0 ++ * (the "License"); you may not use this file except in compliance with ++ * the License. You may obtain a copy of the License at ++ * ++ * http://www.apache.org/licenses/LICENSE-2.0 ++ * ++ * Unless required by applicable law or agreed to in writing, software ++ * distributed under the License is distributed on an "AS IS" BASIS, ++ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ++ * See the License for the specific language governing permissions and ++ * limitations under the License. ++ */ +package com.gemstone.gemfire.cache.lucene; + + +/** + * <p> + * Abstract data structure for one item in query result. + * + * @author Xiaojian Zhou + * @since 8.5 + */ +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 + * + * @return key + * @throws IllegalArgumentException If this struct does not contain key + */ + public K getKey(); + + /** + * Return value of the entry + * + * @return value the whole domain object + * @throws IllegalArgumentException If this struct does not contain value + */ + public V getValue(); + + /** + * Return score of the query + * + * @return score + * @throws IllegalArgumentException If this struct does not contain score + */ + public float getScore(); +} + http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f189ff52/gemfire-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/LuceneService.java ---------------------------------------------------------------------- diff --cc gemfire-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/LuceneService.java index 6c629de,0000000..6bbb4fd mode 100644,000000..100644 --- a/gemfire-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/LuceneService.java +++ b/gemfire-lucene/src/main/java/com/gemstone/gemfire/cache/lucene/LuceneService.java @@@ -1,110 -1,0 +1,126 @@@ ++/* ++ * Licensed to the Apache Software Foundation (ASF) under one or more ++ * contributor license agreements. See the NOTICE file distributed with ++ * this work for additional information regarding copyright ownership. ++ * The ASF licenses this file to You under the Apache License, Version 2.0 ++ * (the "License"); you may not use this file except in compliance with ++ * the License. You may obtain a copy of the License at ++ * ++ * http://www.apache.org/licenses/LICENSE-2.0 ++ * ++ * Unless required by applicable law or agreed to in writing, software ++ * distributed under the License is distributed on an "AS IS" BASIS, ++ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ++ * See the License for the specific language governing permissions and ++ * limitations under the License. ++ */ +package com.gemstone.gemfire.cache.lucene; + +import java.util.Collection; +import java.util.Map; + +import org.apache.lucene.analysis.Analyzer; + +import com.gemstone.gemfire.cache.Cache; +import com.gemstone.gemfire.cache.GemFireCache; +import com.gemstone.gemfire.cache.lucene.internal.LuceneServiceImpl; +import com.gemstone.gemfire.internal.cache.extension.Extensible; + +/** + * LuceneService instance is a singleton for each cache. It will be created in cache + * constructor and get its reference via {@link GemFireCache#getLuceneService()}. + * + * It provides handle for managing the {@link LuceneIndex} and create the {@link LuceneQuery} + * via {@link LuceneQueryFactory} + * + * </p> + * Example: <br> + * + * <pre> + * At client and server JVM, initializing cache will create the LuceneServiceImpl object, + * which is a singleton at each JVM. + * + * At each server JVM, for data region to create index, create the index on fields with default analyzer: + * LuceneIndex index = luceneService.createIndex(indexName, regionName, "field1", "field2", "field3"); + * or create index on fields with specified analyzer: + * LuceneIndex index = luceneService.createIndex(indexName, regionName, analyzerPerField); + * + * We can also create index via cache.xml or gfsh. + * + * At client side, create query and run the search: + * + * LuceneQuery query = luceneService.createLuceneQueryFactory().setLimit(200).setPageSize(20) + * .setResultTypes(SCORE, VALUE, KEY).setFieldProjection("field1", "field2") + * .create(indexName, regionName, querystring, analyzer); + * + * The querystring is using lucene's queryparser syntax, such as "field1:zhou* AND field2:[email protected]" + * + * LuceneQueryResults results = query.search(); + * + * If pagination is not specified: + * List list = results.getNextPage(); // return all results in one getNextPage() call + * or if paging is specified: + * if (results.hasNextPage()) { + * List page = results.nextPage(); // return resules page by page + * } + * + * The item of the list is either the domain object or instance of {@link LuceneResultStruct} + * </pre> + * + * @author Xiaojian Zhou + * + */ +public interface LuceneService { + + /** + * Create a lucene index using default analyzer. + * + * @param indexName + * @param regionPath + * @param fields + * @return LuceneIndex object + */ + public void createIndex(String indexName, String regionPath, String... fields); + + /** + * Create a lucene index using specified analyzer per field + * + * @param indexName index name + * @param regionPath region name + * @param analyzerPerField analyzer per field map + * @return LuceneIndex object + * @deprecated TODO This feature is not yet implemented + */ + @Deprecated + public void createIndex(String indexName, String regionPath, + Map<String, Analyzer> analyzerPerField); + + /** + * Destroy the lucene index + * + * @param index index object + * @deprecated TODO This feature is not yet implemented + */ + @Deprecated + public void destroyIndex(LuceneIndex index); + + /** + * Get the lucene index object specified by region name and index name + * @param indexName index name + * @param regionPath region name + * @return LuceneIndex object + */ + public LuceneIndex getIndex(String indexName, String regionPath); + + /** + * get all the lucene indexes. + * @return all index objects in a Collection + */ + public Collection<LuceneIndex> getAllIndexes(); + + /** + * create LuceneQueryFactory + * @return LuceneQueryFactory object + */ + public LuceneQueryFactory createLuceneQueryFactory(); +} http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/f189ff52/settings.gradle ----------------------------------------------------------------------
