LUCENE-3795: updating to trunk

git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/branches/lucene3795_lsp_spatial_module@1297785 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Ryan McKinley 2012-03-06 23:17:08 +00:00
commit a6af5d8181
573 changed files with 28441 additions and 18108 deletions

View File

@ -99,11 +99,7 @@
<classpathentry kind="lib" path="modules/analysis/morfologik/lib/morfologik-fsa-1.5.2.jar"/>
<classpathentry kind="lib" path="modules/analysis/morfologik/lib/morfologik-polish-1.5.2.jar"/>
<classpathentry kind="lib" path="modules/analysis/morfologik/lib/morfologik-stemming-1.5.2.jar"/>
<classpathentry kind="lib" path="modules/benchmark/lib/commons-beanutils-1.7.0.jar"/>
<classpathentry kind="lib" path="modules/benchmark/lib/commons-collections-3.1.jar"/>
<classpathentry kind="lib" path="modules/benchmark/lib/commons-compress-1.2.jar"/>
<classpathentry kind="lib" path="modules/benchmark/lib/commons-digester-1.7.jar"/>
<classpathentry kind="lib" path="modules/benchmark/lib/commons-logging-1.0.4.jar"/>
<classpathentry kind="lib" path="modules/benchmark/lib/xercesImpl-2.9.1-patched-XERCESJ-1257.jar"/>
<classpathentry kind="lib" path="solr/lib/apache-solr-noggit-r1211150.jar"/>
<classpathentry kind="lib" path="solr/lib/commons-csv-1.0-SNAPSHOT-r966014.jar"/>
@ -124,10 +120,6 @@
<classpathentry kind="lib" path="solr/example/lib/jetty-6.1.26-patched-JETTY-1340.jar"/>
<classpathentry kind="lib" path="solr/example/lib/jetty-util-6.1.26-patched-JETTY-1340.jar"/>
<classpathentry kind="lib" path="solr/example/lib/servlet-api-2.5-20081211.jar"/>
<classpathentry kind="lib" path="solr/example/lib/jsp-2.1/core-3.1.1.jar"/>
<classpathentry kind="lib" path="solr/example/lib/jsp-2.1/jsp-2.1-glassfish-2.1.v20091210.jar"/>
<classpathentry kind="lib" path="solr/example/lib/jsp-2.1/jsp-2.1-jetty-6.1.26.jar"/>
<classpathentry kind="lib" path="solr/example/lib/jsp-2.1/jsp-api-2.1-glassfish-2.1.v20091210.jar"/>
<classpathentry kind="lib" path="solr/contrib/clustering/lib/carrot2-core-3.5.0.jar"/>
<classpathentry kind="lib" path="solr/contrib/clustering/lib/hppc-0.3.3.jar"/>
<classpathentry kind="lib" path="solr/contrib/clustering/lib/jackson-core-asl-1.5.2.jar"/>
@ -167,6 +159,8 @@
<classpathentry kind="lib" path="solr/contrib/uima/lib/uimaj-core-2.3.1.jar"/>
<classpathentry kind="lib" path="solr/contrib/velocity/lib/velocity-1.6.4.jar"/>
<classpathentry kind="lib" path="solr/contrib/velocity/lib/velocity-tools-2.0.jar"/>
<classpathentry kind="lib" path="solr/contrib/velocity/lib/commons-beanutils-1.7.0.jar"/>
<classpathentry kind="lib" path="solr/contrib/velocity/lib/commons-collections-3.2.1.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View File

@ -5,8 +5,8 @@ Lucene/Solr Maven build instructions
Contents:
A. How to use nightly Jenkins-built Lucene/Solr Maven artifacts
B. How to generate Lucene Maven artifacts
C. How to generate Solr Maven artifacts
B. How to generate Maven artifacts
C. How to deploy Maven artifacts to a repository
D. How to use Maven to build Lucene/Solr
-----
@ -14,55 +14,59 @@ D. How to use Maven to build Lucene/Solr
A. How to use nightly Jenkins-built Lucene/Solr Maven artifacts
The most recently produced nightly Jenkins-built Lucene and Solr Maven
artifacts are available in Maven repository layout here:
<https://builds.apache.org/hudson/job/Lucene-Solr-Maven-trunk/lastSuccessfulBuild/artifact/maven_artifacts/>
snapshot artifacts are available in the Apache Snapshot repository here:
http://repository.apache.org/snapshots
An example POM snippet:
<project ...>
...
<repositories>
...
<repository>
<id>lucene-solr-jenkins-trunk</id>
<name>Lucene/Solr Jenkins trunk</name>
<url>https://builds.apache.org/job/Lucene-Solr-Maven-trunk/lastSuccessfulBuild/artifact/maven_artifacts</url>
<layout>default</layout>
<snapshots>
<enabled>true</enabled>
</snapshots>
<id>apache.snapshots</id>
<name>Apache Snapshot Repository</name>
<url>http://repository.apache.org/snapshots</url>
<releases>
<enabled>false</enabled>
</releases>
</repository>
B. How to generate Lucene Maven artifacts
B. How to generate Lucene/Solr Maven artifacts
1. Prerequisites: JDK 1.6+ and Ant 1.7.X
Prerequisites: JDK 1.6+ and Ant 1.7.X
2. Run the following command from the lucene/ directory:
Run 'ant generate-maven-artifacts' to create an internal Maven
repository, including POMs, binary .jars, source .jars, and javadoc
.jars.
ant generate-maven-artifacts
The above command will create an internal Maven repository under
lucene/dist/maven/, including POMs, binary .jars, source .jars,
and javadoc .jars, for Lucene Core, for the Lucene test framework,
for each contrib, and for each module under the top-level modules/
directory.
You can run the above command in four possible places: the top-level
directory; under lucene/; under solr/; or under modules/. From the
top-level directory, from lucene/, or from modules/, the internal
repository will be located at dist/maven/. From solr/, the internal
repository will be located at package/maven/.
C. How to generate Solr Maven artifacts
C. How to deploy Maven artifacts to a repository
1. Prerequisites: JDK 1.6+ and Ant 1.7.X
Prerequisites: JDK 1.6+ and Ant 1.7.X
2. Run the following from the solr/ directory:
You can deploy targets for all of Lucene/Solr, only Lucene, only Solr,
or only modules/, as in B. above. To deploy to a Maven repository, the
command is the same as in B. above, with the addition of two system
properties:
ant generate-maven-artifacts
The above command will create an internal Maven repository under
solr/package/maven/, including POMs, binary .jars, source .jars,
and javadoc .jars, for Solr Core, for the Solr test framework,
for each contrib, and for the Solr .war (for which there are no
source or javadoc .jars).
ant -Dm2.repository.id=my-repo-id \
-Dm2.repository.url=http://example.org/my/repo \
generate-maven-artifacts
The repository ID given in the above command corresponds to a <server>
entry in either your ~/.m2/settings.xml or ~/.ant/settings.xml. See
<http://maven.apache.org/settings.html#Servers> for more information.
(Note that as of version 2.1.3, Maven Ant Tasks cannot handle encrypted
passwords.)
D. How to use Maven to build Lucene/Solr

View File

@ -35,6 +35,17 @@
<module-directory>lucene/contrib/demo</module-directory>
<build-directory>../../build/contrib/demo</build-directory>
</properties>
<scm>
<connection>
scm:svn:http://svn.apache.org/repos/asf/lucene/dev/trunk/${module-directory}
</connection>
<developerConnection>
scm:svn:https://svn.apache.org/repos/asf/lucene/dev/trunk/${module-directory}
</developerConnection>
<url>
http://svn.apache.org/viewvc/lucene/dev/trunk/${module-directory}
</url>
</scm>
<dependencies>
<dependency>
<!-- lucene-test-framework dependency must be declared before lucene-core -->

View File

@ -37,6 +37,17 @@
<module-directory>lucene/contrib/highlighter</module-directory>
<build-directory>../../build/contrib/highlighter</build-directory>
</properties>
<scm>
<connection>
scm:svn:http://svn.apache.org/repos/asf/lucene/dev/trunk/${module-directory}
</connection>
<developerConnection>
scm:svn:https://svn.apache.org/repos/asf/lucene/dev/trunk/${module-directory}
</developerConnection>
<url>
http://svn.apache.org/viewvc/lucene/dev/trunk/${module-directory}
</url>
</scm>
<dependencies>
<dependency>
<!-- lucene-test-framework dependency must be declared before lucene-core -->

View File

@ -37,6 +37,17 @@
<module-directory>lucene/contrib/memory</module-directory>
<build-directory>../../build/contrib/memory</build-directory>
</properties>
<scm>
<connection>
scm:svn:http://svn.apache.org/repos/asf/lucene/dev/trunk/${module-directory}
</connection>
<developerConnection>
scm:svn:https://svn.apache.org/repos/asf/lucene/dev/trunk/${module-directory}
</developerConnection>
<url>
http://svn.apache.org/viewvc/lucene/dev/trunk/${module-directory}
</url>
</scm>
<dependencies>
<dependency>
<!-- lucene-test-framework dependency must be declared before lucene-core -->

View File

@ -35,6 +35,17 @@
<module-directory>lucene/contrib/misc</module-directory>
<build-directory>../../build/contrib/misc</build-directory>
</properties>
<scm>
<connection>
scm:svn:http://svn.apache.org/repos/asf/lucene/dev/trunk/${module-directory}
</connection>
<developerConnection>
scm:svn:https://svn.apache.org/repos/asf/lucene/dev/trunk/${module-directory}
</developerConnection>
<url>
http://svn.apache.org/viewvc/lucene/dev/trunk/${module-directory}
</url>
</scm>
<dependencies>
<dependency>
<!-- lucene-test-framework dependency must be declared before lucene-core -->

View File

@ -35,6 +35,17 @@
<module-directory>lucene/contrib/sandbox</module-directory>
<build-directory>../../build/contrib/sandbox</build-directory>
</properties>
<scm>
<connection>
scm:svn:http://svn.apache.org/repos/asf/lucene/dev/trunk/${module-directory}
</connection>
<developerConnection>
scm:svn:https://svn.apache.org/repos/asf/lucene/dev/trunk/${module-directory}
</developerConnection>
<url>
http://svn.apache.org/viewvc/lucene/dev/trunk/${module-directory}
</url>
</scm>
<dependencies>
<dependency>
<!-- lucene-test-framework dependency must be declared before lucene-core -->

View File

@ -35,6 +35,17 @@
<module-directory>lucene/core</module-directory>
<build-directory>../build/lucene-maven</build-directory>
</properties>
<scm>
<connection>
scm:svn:http://svn.apache.org/repos/asf/lucene/dev/trunk/${module-directory}
</connection>
<developerConnection>
scm:svn:https://svn.apache.org/repos/asf/lucene/dev/trunk/${module-directory}
</developerConnection>
<url>
http://svn.apache.org/viewvc/lucene/dev/trunk/${module-directory}
</url>
</scm>
<dependencies>
<dependency>
<groupId>junit</groupId>

View File

@ -31,6 +31,20 @@
<packaging>pom</packaging>
<name>Lucene parent POM</name>
<description>Lucene parent POM</description>
<properties>
<module-directory>lucene</module-directory>
</properties>
<scm>
<connection>
scm:svn:http://svn.apache.org/repos/asf/lucene/dev/trunk/${module-directory}
</connection>
<developerConnection>
scm:svn:https://svn.apache.org/repos/asf/lucene/dev/trunk/${module-directory}
</developerConnection>
<url>
http://svn.apache.org/viewvc/lucene/dev/trunk/${module-directory}
</url>
</scm>
<modules>
<module>core</module>
<module>test-framework</module>

View File

@ -35,6 +35,17 @@
<module-directory>lucene/test-framework</module-directory>
<build-directory>../build/test-framework</build-directory>
</properties>
<scm>
<connection>
scm:svn:http://svn.apache.org/repos/asf/lucene/dev/trunk/${module-directory}
</connection>
<developerConnection>
scm:svn:https://svn.apache.org/repos/asf/lucene/dev/trunk/${module-directory}
</developerConnection>
<url>
http://svn.apache.org/viewvc/lucene/dev/trunk/${module-directory}
</url>
</scm>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>

View File

@ -35,6 +35,17 @@
<module-directory>modules/analysis/common</module-directory>
<build-directory>../build/common</build-directory>
</properties>
<scm>
<connection>
scm:svn:http://svn.apache.org/repos/asf/lucene/dev/trunk/${module-directory}
</connection>
<developerConnection>
scm:svn:https://svn.apache.org/repos/asf/lucene/dev/trunk/${module-directory}
</developerConnection>
<url>
http://svn.apache.org/viewvc/lucene/dev/trunk/${module-directory}
</url>
</scm>
<dependencies>
<dependency>
<!-- lucene-test-framework dependency must be declared before lucene-core -->

View File

@ -38,6 +38,17 @@
<module-directory>modules/analysis/icu</module-directory>
<build-directory>../build/icu</build-directory>
</properties>
<scm>
<connection>
scm:svn:http://svn.apache.org/repos/asf/lucene/dev/trunk/${module-directory}
</connection>
<developerConnection>
scm:svn:https://svn.apache.org/repos/asf/lucene/dev/trunk/${module-directory}
</developerConnection>
<url>
http://svn.apache.org/viewvc/lucene/dev/trunk/${module-directory}
</url>
</scm>
<dependencies>
<dependency>
<!-- lucene-test-framework dependency must be declared before lucene-core -->

View File

@ -37,6 +37,17 @@
<module-directory>modules/analysis/kuromoji</module-directory>
<build-directory>../build/kuromoji</build-directory>
</properties>
<scm>
<connection>
scm:svn:http://svn.apache.org/repos/asf/lucene/dev/trunk/${module-directory}
</connection>
<developerConnection>
scm:svn:https://svn.apache.org/repos/asf/lucene/dev/trunk/${module-directory}
</developerConnection>
<url>
http://svn.apache.org/viewvc/lucene/dev/trunk/${module-directory}
</url>
</scm>
<dependencies>
<dependency>
<!-- lucene-test-framework dependency must be declared before lucene-core -->

View File

@ -37,6 +37,17 @@
<module-directory>modules/analysis/morfologik</module-directory>
<build-directory>../build/morfologik</build-directory>
</properties>
<scm>
<connection>
scm:svn:http://svn.apache.org/repos/asf/lucene/dev/trunk/${module-directory}
</connection>
<developerConnection>
scm:svn:https://svn.apache.org/repos/asf/lucene/dev/trunk/${module-directory}
</developerConnection>
<url>
http://svn.apache.org/viewvc/lucene/dev/trunk/${module-directory}
</url>
</scm>
<dependencies>
<dependency>
<!-- lucene-test-framework dependency must be declared before lucene-core -->

View File

@ -37,6 +37,17 @@
<module-directory>modules/analysis/phonetic</module-directory>
<build-directory>../build/phonetic</build-directory>
</properties>
<scm>
<connection>
scm:svn:http://svn.apache.org/repos/asf/lucene/dev/trunk/${module-directory}
</connection>
<developerConnection>
scm:svn:https://svn.apache.org/repos/asf/lucene/dev/trunk/${module-directory}
</developerConnection>
<url>
http://svn.apache.org/viewvc/lucene/dev/trunk/${module-directory}
</url>
</scm>
<dependencies>
<dependency>
<!-- lucene-test-framework dependency must be declared before lucene-core -->

View File

@ -35,6 +35,17 @@
<module-directory>modules/analysis/smartcn</module-directory>
<build-directory>../build/smartcn</build-directory>
</properties>
<scm>
<connection>
scm:svn:http://svn.apache.org/repos/asf/lucene/dev/trunk/${module-directory}
</connection>
<developerConnection>
scm:svn:https://svn.apache.org/repos/asf/lucene/dev/trunk/${module-directory}
</developerConnection>
<url>
http://svn.apache.org/viewvc/lucene/dev/trunk/${module-directory}
</url>
</scm>
<dependencies>
<dependency>
<!-- lucene-test-framework dependency must be declared before lucene-core -->

View File

@ -35,6 +35,17 @@
<module-directory>modules/analysis/stempel</module-directory>
<build-directory>../build/stempel</build-directory>
</properties>
<scm>
<connection>
scm:svn:http://svn.apache.org/repos/asf/lucene/dev/trunk/${module-directory}
</connection>
<developerConnection>
scm:svn:https://svn.apache.org/repos/asf/lucene/dev/trunk/${module-directory}
</developerConnection>
<url>
http://svn.apache.org/viewvc/lucene/dev/trunk/${module-directory}
</url>
</scm>
<dependencies>
<dependency>
<!-- lucene-test-framework dependency must be declared before lucene-core -->

View File

@ -39,6 +39,17 @@
<module-directory>modules/analysis/uima</module-directory>
<build-directory>../build/uima</build-directory>
</properties>
<scm>
<connection>
scm:svn:http://svn.apache.org/repos/asf/lucene/dev/trunk/${module-directory}
</connection>
<developerConnection>
scm:svn:https://svn.apache.org/repos/asf/lucene/dev/trunk/${module-directory}
</developerConnection>
<url>
http://svn.apache.org/viewvc/lucene/dev/trunk/${module-directory}
</url>
</scm>
<dependencies>
<dependency>
<!-- lucene-test-framework dependency must be declared before lucene-core -->

View File

@ -35,6 +35,17 @@
<module-directory>modules/benchmark</module-directory>
<build-directory>build</build-directory>
</properties>
<scm>
<connection>
scm:svn:http://svn.apache.org/repos/asf/lucene/dev/trunk/${module-directory}
</connection>
<developerConnection>
scm:svn:https://svn.apache.org/repos/asf/lucene/dev/trunk/${module-directory}
</developerConnection>
<url>
http://svn.apache.org/viewvc/lucene/dev/trunk/${module-directory}
</url>
</scm>
<dependencies>
<dependency>
<!-- lucene-test-framework dependency must be declared before lucene-core -->
@ -82,26 +93,10 @@
<groupId>com.ibm.icu</groupId>
<artifactId>icu4j</artifactId>
</dependency>
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-compress</artifactId>
</dependency>
<dependency>
<groupId>commons-digester</groupId>
<artifactId>commons-digester</artifactId>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</dependency>
</dependencies>
<build>
<directory>${build-directory}</directory>

View File

@ -37,6 +37,17 @@
<module-directory>modules/facet</module-directory>
<build-directory>build</build-directory>
</properties>
<scm>
<connection>
scm:svn:http://svn.apache.org/repos/asf/lucene/dev/trunk/${module-directory}
</connection>
<developerConnection>
scm:svn:https://svn.apache.org/repos/asf/lucene/dev/trunk/${module-directory}
</developerConnection>
<url>
http://svn.apache.org/viewvc/lucene/dev/trunk/${module-directory}
</url>
</scm>
<dependencies>
<dependency>
<!-- lucene-test-framework dependency must be declared before lucene-core -->

View File

@ -35,6 +35,17 @@
<module-directory>modules/grouping</module-directory>
<build-directory>build</build-directory>
</properties>
<scm>
<connection>
scm:svn:http://svn.apache.org/repos/asf/lucene/dev/trunk/${module-directory}
</connection>
<developerConnection>
scm:svn:https://svn.apache.org/repos/asf/lucene/dev/trunk/${module-directory}
</developerConnection>
<url>
http://svn.apache.org/viewvc/lucene/dev/trunk/${module-directory}
</url>
</scm>
<dependencies>
<dependency>
<!-- lucene-test-framework dependency must be declared before lucene-core -->

View File

@ -35,6 +35,17 @@
<module-directory>modules/join</module-directory>
<build-directory>build</build-directory>
</properties>
<scm>
<connection>
scm:svn:http://svn.apache.org/repos/asf/lucene/dev/trunk/${module-directory}
</connection>
<developerConnection>
scm:svn:https://svn.apache.org/repos/asf/lucene/dev/trunk/${module-directory}
</developerConnection>
<url>
http://svn.apache.org/viewvc/lucene/dev/trunk/${module-directory}
</url>
</scm>
<dependencies>
<dependency>
<!-- lucene-test-framework dependency must be declared before lucene-core -->

View File

@ -35,6 +35,17 @@
<module-directory>modules/queries</module-directory>
<build-directory>build</build-directory>
</properties>
<scm>
<connection>
scm:svn:http://svn.apache.org/repos/asf/lucene/dev/trunk/${module-directory}
</connection>
<developerConnection>
scm:svn:https://svn.apache.org/repos/asf/lucene/dev/trunk/${module-directory}
</developerConnection>
<url>
http://svn.apache.org/viewvc/lucene/dev/trunk/${module-directory}
</url>
</scm>
<dependencies>
<dependency>
<!-- lucene-test-framework dependency must be declared before lucene-core -->

View File

@ -35,6 +35,17 @@
<module-directory>modules/queryparser</module-directory>
<build-directory>build</build-directory>
</properties>
<scm>
<connection>
scm:svn:http://svn.apache.org/repos/asf/lucene/dev/trunk/${module-directory}
</connection>
<developerConnection>
scm:svn:https://svn.apache.org/repos/asf/lucene/dev/trunk/${module-directory}
</developerConnection>
<url>
http://svn.apache.org/viewvc/lucene/dev/trunk/${module-directory}
</url>
</scm>
<dependencies>
<dependency>
<!-- lucene-test-framework dependency must be declared before lucene-core -->

View File

@ -35,6 +35,17 @@
<module-directory>modules/suggest</module-directory>
<build-directory>build</build-directory>
</properties>
<scm>
<connection>
scm:svn:http://svn.apache.org/repos/asf/lucene/dev/trunk/${module-directory}
</connection>
<developerConnection>
scm:svn:https://svn.apache.org/repos/asf/lucene/dev/trunk/${module-directory}
</developerConnection>
<url>
http://svn.apache.org/viewvc/lucene/dev/trunk/${module-directory}
</url>
</scm>
<dependencies>
<dependency>
<!-- lucene-test-framework dependency must be declared before lucene-core -->

View File

@ -90,13 +90,13 @@
<inceptionYear>2000</inceptionYear>
<scm>
<connection>
scm:svn:http://svn.apache.org/repos/asf/lucene/dev/trunk/${module-directory}
scm:svn:http://svn.apache.org/repos/asf/lucene/dev/trunk
</connection>
<developerConnection>
scm:svn:https://svn.apache.org/repos/asf/lucene/dev/trunk/${module-directory}
scm:svn:https://svn.apache.org/repos/asf/lucene/dev/trunk
</developerConnection>
<url>
http://svn.apache.org/viewvc/lucene/dev/trunk/${module-directory}
http://svn.apache.org/viewvc/lucene/dev/trunk
</url>
</scm>
<licenses>
@ -130,21 +130,11 @@
<artifactId>guava</artifactId>
<version>r05</version>
</dependency>
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
<version>1.7.0</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.6</version>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
<version>3.2.1</version>
</dependency>
<dependency>
<groupId>commons-digester</groupId>
<artifactId>commons-digester</artifactId>
@ -315,21 +305,6 @@
<artifactId>jetty-util</artifactId>
<version>${patched.jetty.version}</version>
</dependency>
<dependency>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jsp-2.1-glassfish</artifactId>
<version>2.1.v20091210</version>
</dependency>
<dependency>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jsp-2.1-jetty</artifactId>
<version>${jetty.version}</version>
</dependency>
<dependency>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jsp-api-2.1-glassfish</artifactId>
<version>2.1.v20091210</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>jcl-over-slf4j</artifactId>

View File

@ -33,8 +33,19 @@
<description>Apache Solr Analysis Extras</description>
<properties>
<module-directory>solr/contrib/analysis-extras</module-directory>
<build-directory>../../build/contrib/analysis-extras</build-directory>
<build-directory>../../build/contrib/solr-analysis-extras</build-directory>
</properties>
<scm>
<connection>
scm:svn:http://svn.apache.org/repos/asf/lucene/dev/trunk/${module-directory}
</connection>
<developerConnection>
scm:svn:https://svn.apache.org/repos/asf/lucene/dev/trunk/${module-directory}
</developerConnection>
<url>
http://svn.apache.org/viewvc/lucene/dev/trunk/${module-directory}
</url>
</scm>
<dependencies>
<dependency>
<!-- lucene-test-framework dependency must be declared before lucene-core -->

View File

@ -33,8 +33,19 @@
<description>Apache Solr Clustering</description>
<properties>
<module-directory>solr/contrib/clustering</module-directory>
<build-directory>../../build/contrib/clustering</build-directory>
<build-directory>../../build/contrib/solr-clustering</build-directory>
</properties>
<scm>
<connection>
scm:svn:http://svn.apache.org/repos/asf/lucene/dev/trunk/${module-directory}
</connection>
<developerConnection>
scm:svn:https://svn.apache.org/repos/asf/lucene/dev/trunk/${module-directory}
</developerConnection>
<url>
http://svn.apache.org/viewvc/lucene/dev/trunk/${module-directory}
</url>
</scm>
<dependencies>
<dependency>
<!-- lucene-test-framework dependency must be declared before lucene-core -->

View File

@ -33,8 +33,19 @@
<description>Apache Solr DataImportHandler Extras</description>
<properties>
<module-directory>solr/contrib/dataimporthandler-extras</module-directory>
<build-directory>../../build/contrib/dataimporthandler-extras</build-directory>
<build-directory>../../build/contrib/solr-dataimporthandler-extras</build-directory>
</properties>
<scm>
<connection>
scm:svn:http://svn.apache.org/repos/asf/lucene/dev/trunk/${module-directory}
</connection>
<developerConnection>
scm:svn:https://svn.apache.org/repos/asf/lucene/dev/trunk/${module-directory}
</developerConnection>
<url>
http://svn.apache.org/viewvc/lucene/dev/trunk/${module-directory}
</url>
</scm>
<dependencies>
<dependency>
<!-- lucene-test-framework dependency must be declared before lucene-core -->

View File

@ -33,8 +33,19 @@
<description>Apache Solr DataImportHandler</description>
<properties>
<module-directory>solr/contrib/dataimporthandler</module-directory>
<build-directory>../../build/contrib/dataimporthandler</build-directory>
<build-directory>../../build/contrib/solr-dataimporthandler</build-directory>
</properties>
<scm>
<connection>
scm:svn:http://svn.apache.org/repos/asf/lucene/dev/trunk/${module-directory}
</connection>
<developerConnection>
scm:svn:https://svn.apache.org/repos/asf/lucene/dev/trunk/${module-directory}
</developerConnection>
<url>
http://svn.apache.org/viewvc/lucene/dev/trunk/${module-directory}
</url>
</scm>
<dependencies>
<dependency>
<!-- lucene-test-framework dependency must be declared before lucene-core -->

View File

@ -36,8 +36,19 @@
</description>
<properties>
<module-directory>solr/contrib/extraction</module-directory>
<build-directory>../../build/contrib/extraction</build-directory>
<build-directory>../../build/contrib/solr-cell</build-directory>
</properties>
<scm>
<connection>
scm:svn:http://svn.apache.org/repos/asf/lucene/dev/trunk/${module-directory}
</connection>
<developerConnection>
scm:svn:https://svn.apache.org/repos/asf/lucene/dev/trunk/${module-directory}
</developerConnection>
<url>
http://svn.apache.org/viewvc/lucene/dev/trunk/${module-directory}
</url>
</scm>
<dependencies>
<dependency>
<!-- lucene-test-framework dependency must be declared before lucene-core -->

View File

@ -36,9 +36,20 @@
Its purpose is to identify language from documents and tag the document with language code.
</description>
<properties>
<module-directory>solr/contrib/solr-langid</module-directory>
<module-directory>solr/contrib/langid</module-directory>
<build-directory>../../build/contrib/solr-langid</build-directory>
</properties>
<scm>
<connection>
scm:svn:http://svn.apache.org/repos/asf/lucene/dev/trunk/${module-directory}
</connection>
<developerConnection>
scm:svn:https://svn.apache.org/repos/asf/lucene/dev/trunk/${module-directory}
</developerConnection>
<url>
http://svn.apache.org/viewvc/lucene/dev/trunk/${module-directory}
</url>
</scm>
<dependencies>
<dependency>
<!-- lucene-test-framework dependency must be declared before lucene-core -->

View File

@ -29,12 +29,23 @@
<groupId>org.apache.solr</groupId>
<artifactId>solr-uima</artifactId>
<packaging>jar</packaging>
<name>Apache Solr - UIMA integration</name>
<name>Apache Solr UIMA integration</name>
<description>Apache Solr - UIMA integration</description>
<properties>
<module-directory>solr/contrib/uima</module-directory>
<build-directory>../../build/contrib/uima</build-directory>
<build-directory>../../build/contrib/solr-uima</build-directory>
</properties>
<scm>
<connection>
scm:svn:http://svn.apache.org/repos/asf/lucene/dev/trunk/${module-directory}
</connection>
<developerConnection>
scm:svn:https://svn.apache.org/repos/asf/lucene/dev/trunk/${module-directory}
</developerConnection>
<url>
http://svn.apache.org/viewvc/lucene/dev/trunk/${module-directory}
</url>
</scm>
<dependencies>
<dependency>
<!-- lucene-test-framework dependency must be declared before lucene-core -->
@ -45,6 +56,11 @@
<version>${project.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-analyzers-uima</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>solr-core</artifactId>

View File

@ -35,6 +35,17 @@
<module-directory>solr/contrib/velocity</module-directory>
<build-directory>../../build/contrib/solr-velocity</build-directory>
</properties>
<scm>
<connection>
scm:svn:http://svn.apache.org/repos/asf/lucene/dev/trunk/${module-directory}
</connection>
<developerConnection>
scm:svn:https://svn.apache.org/repos/asf/lucene/dev/trunk/${module-directory}
</developerConnection>
<url>
http://svn.apache.org/viewvc/lucene/dev/trunk/${module-directory}
</url>
</scm>
<dependencies>
<dependency>
<!-- lucene-test-framework dependency must be declared before lucene-core -->

View File

@ -32,9 +32,20 @@
<name>Apache Solr Core</name>
<description>Apache Solr Core</description>
<properties>
<module-directory>solr</module-directory>
<module-directory>solr/core</module-directory>
<build-directory>../build/solr-maven</build-directory>
</properties>
<scm>
<connection>
scm:svn:http://svn.apache.org/repos/asf/lucene/dev/trunk/${module-directory}
</connection>
<developerConnection>
scm:svn:https://svn.apache.org/repos/asf/lucene/dev/trunk/${module-directory}
</developerConnection>
<url>
http://svn.apache.org/viewvc/lucene/dev/trunk/${module-directory}
</url>
</scm>
<dependencies>
<dependency>
<!-- lucene-test-framework dependency must be declared before lucene-core -->
@ -170,11 +181,6 @@
<artifactId>jetty-util</artifactId>
<optional>true</optional> <!-- Only used for tests and one command-line utility: JettySolrRunner -->
</dependency>
<dependency>
<groupId>org.mortbay.jetty</groupId>
<artifactId>jsp-2.1-jetty</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.codehaus.woodstox</groupId>
<artifactId>wstx-asl</artifactId>

View File

@ -40,7 +40,19 @@
</modules>
<properties>
<tests.luceneMatchVersion>LUCENE_CURRENT</tests.luceneMatchVersion>
<module-directory>solr</module-directory>
</properties>
<scm>
<connection>
scm:svn:http://svn.apache.org/repos/asf/lucene/dev/trunk/${module-directory}
</connection>
<developerConnection>
scm:svn:https://svn.apache.org/repos/asf/lucene/dev/trunk/${module-directory}
</developerConnection>
<url>
http://svn.apache.org/viewvc/lucene/dev/trunk/${module-directory}
</url>
</scm>
<issueManagement>
<system>JIRA</system>
<url>http://issues.apache.org/jira/browse/SOLR</url>

View File

@ -35,6 +35,17 @@
<module-directory>solr/solrj</module-directory>
<build-directory>../build/solr-solrj</build-directory>
</properties>
<scm>
<connection>
scm:svn:http://svn.apache.org/repos/asf/lucene/dev/trunk/${module-directory}
</connection>
<developerConnection>
scm:svn:https://svn.apache.org/repos/asf/lucene/dev/trunk/${module-directory}
</developerConnection>
<url>
http://svn.apache.org/viewvc/lucene/dev/trunk/${module-directory}
</url>
</scm>
<dependencies>
<dependency>
<groupId>org.apache.solr</groupId>

View File

@ -35,6 +35,17 @@
<module-directory>solr/test-framework</module-directory>
<build-directory>../build/solr-test-framework</build-directory>
</properties>
<scm>
<connection>
scm:svn:http://svn.apache.org/repos/asf/lucene/dev/trunk/${module-directory}
</connection>
<developerConnection>
scm:svn:https://svn.apache.org/repos/asf/lucene/dev/trunk/${module-directory}
</developerConnection>
<url>
http://svn.apache.org/viewvc/lucene/dev/trunk/${module-directory}
</url>
</scm>
<dependencies>
<!-- These dependencies are compile scope because this is a test framework. -->
<dependency>

View File

@ -35,6 +35,17 @@
<module-directory>solr/webapp</module-directory>
<build-directory>../build</build-directory>
</properties>
<scm>
<connection>
scm:svn:http://svn.apache.org/repos/asf/lucene/dev/trunk/${module-directory}
</connection>
<developerConnection>
scm:svn:https://svn.apache.org/repos/asf/lucene/dev/trunk/${module-directory}
</developerConnection>
<url>
http://svn.apache.org/viewvc/lucene/dev/trunk/${module-directory}
</url>
</scm>
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>

View File

@ -859,9 +859,13 @@ New Features
* LUCENE-3725: Added optional packing to FST building; this uses extra
RAM during building but results in a smaller FST. (Mike McCandless)
* LUCENE-3714: Add top N shortest cost paths search for FST<Long>.
* LUCENE-3714: Add top N shortest cost paths search for FST.
(Robert Muir, Dawid Weiss, Mike McCandless)
* LUCENE-3789: Expose MTQ TermsEnum via RewriteMethod for non package private
access (Simon Willnauer)
Bug fixes
* LUCENE-3595: Fixed FieldCacheRangeFilter and FieldCacheTermsFilter
@ -911,6 +915,11 @@ Bug fixes
These checks now use getFilePointer instead to avoid this.
(Jamir Shaikh, Mike McCandless, Robert Muir)
* LUCENE-3816: Fixed problem in FilteredDocIdSet, if null was returned
from the delegate DocIdSet.iterator(), which is allowed to return
null by DocIdSet specification when no documents match.
(Shay Banon via Uwe Schindler)
Optimizations
* LUCENE-3653: Improve concurrency in VirtualMethod and AttributeSource by
@ -923,6 +932,12 @@ Documentation
Build
* LUCENE-3847: LuceneTestCase will now check for modifications of System
properties before and after each test (and suite). If changes are detected,
the test will fail. A rule can be used to reset system properties to
before-scope state (and this has been used to make Solr tests pass).
(Dawid Weiss, Uwe Schindler).
* LUCENE-3228: Stop downloading external javadoc package-list files:
- Added package-list files for Oracle Java javadocs and JUnit javadocs to
@ -1109,9 +1124,6 @@ New Features
* LUCENE-3558: Moved SearcherManager, NRTManager & SearcherLifetimeManager into
core. All classes are contained in o.a.l.search. (Simon Willnauer)
* LUCENE-3789: Expose MTQ TermsEnum via RewriteMethod for non package private
access (Simon Willnauer)
Optimizations
* LUCENE-3426: Add NGramPhraseQuery which extends PhraseQuery and tries to

View File

@ -354,9 +354,7 @@
<artifact:pom id="maven.project" file="@{pom.xml}"/>
<artifact:deploy file="@{jar.file}">
<artifact-attachments/>
<remoteRepository url="${m2.repository.url}">
<authentication username="${m2.repository.username}" privateKey="${m2.repository.private.key}" password="${m2.repository.password}"/>
</remoteRepository>
<remoteRepository id="${m2.repository.id}" url="${m2.repository.url}"/>
<pom refid="maven.project"/>
</artifact:deploy>
</sequential>
@ -374,9 +372,7 @@
<artifact:install-provider artifactId="wagon-ssh" version="1.0-beta-7"/>
<artifact:pom id="maven.project" file="${maven.build.dir}/pom.xml" />
<artifact:deploy file="@{jar.file}">
<remoteRepository url="${m2.repository.url}">
<authentication username="${m2.repository.username}" privateKey="${m2.repository.private.key}" password="${m2.repository.password}"/>
</remoteRepository>
<remoteRepository id="${m2.repository.id}" url="${m2.repository.url}"/>
<pom refid="maven.project"/>
</artifact:deploy>
</sequential>

View File

@ -68,6 +68,10 @@ New Features
cached IO pages due to large merges. (Varun Thacker, Mike
McCandless)
* LUCENE-3827: DocsAndPositionsEnum from MemoryIndex implements
start/endOffset, if offsets are indexed. (Alan Woodward via Mike
McCandless)
API Changes
* LUCENE-2606: Changed RegexCapabilities interface to fix thread
@ -111,6 +115,13 @@ Changes in backwards compatibility policy
* LUCENE-3626: The internal implementation classes in PKIndexSplitter
and MultiPassIndexSplitter were made private as they now work
per segment. (Uwe Schindler)
* LUCENE-3807: Cleaned up Suggest / Lookup API. Term weights (freqs) are now
64bit signed integers instead of 32bit floats. Sorting of terms is now a
disk based merge sort instead of an in-memory sort. The Lookup API now
accepts and returns CharSequence instead of String which should be converted
into a String before used in a datastructure that relies on hashCode / equals.
(Simon Willnauer)
Changes in Runtime Behavior
@ -143,6 +154,9 @@ New Features
* LUCENE-3730: Refine Kuromoji search mode (Mode.SEARCH) decompounding
heuristics. (Christian Moen via Robert Muir)
* LUCENE-3767: Kuromoji tokenizer/analyzer produces both compound words
and the segmentation of that compound in Mode.SEARCH. (Robert Muir, Mike McCandless via Christian Moen)
* LUCENE-3685: Add ToChildBlockJoinQuery and renamed previous
BlockJoinQuery to ToParentBlockJoinQuery, so that you can now do
joins in both parent to child and child to parent directions.

View File

@ -38,6 +38,7 @@ import org.apache.lucene.document.Field;
import org.apache.lucene.document.FieldType;
import org.apache.lucene.document.TextField;
import org.apache.lucene.index.CorruptIndexException;
import org.apache.lucene.index.DirectoryReader;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.IndexWriter;
import org.apache.lucene.index.IndexWriterConfig;
@ -83,7 +84,7 @@ public class FormBasedXmlQueryDemo extends HttpServlet {
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
//Take all completed form fields and add to a Properties object
Properties completedFormFields = new Properties();
Enumeration pNames = request.getParameterNames();
Enumeration<?> pNames = request.getParameterNames();
while (pNames.hasMoreElements()) {
String propName = (String) pNames.nextElement();
String value = request.getParameter(propName);
@ -147,7 +148,7 @@ public class FormBasedXmlQueryDemo extends HttpServlet {
//open searcher
// this example never closes it reader!
IndexReader reader = IndexReader.open(rd);
IndexReader reader = DirectoryReader.open(rd);
searcher = new IndexSearcher(reader);
}
}

View File

@ -50,6 +50,7 @@ import org.apache.lucene.search.highlight.SynonymTokenizer.TestHighlightRunner;
import org.apache.lucene.search.spans.*;
import org.apache.lucene.store.Directory;
import org.apache.lucene.util.BytesRef;
import org.apache.lucene.util.LuceneTestCase;
import org.apache.lucene.util.automaton.BasicAutomata;
import org.apache.lucene.util.automaton.CharacterRunAutomaton;
import org.apache.lucene.util.automaton.RegExp;
@ -722,7 +723,6 @@ public class HighlighterTest extends BaseTokenStreamTestCase implements Formatte
@Override
public void run() throws Exception {
numHighlights = 0;
String queryString = FIELD_NAME + ":[kannedy TO kznnedy]";
// Need to explicitly set the QueryParser property to use TermRangeQuery
// rather
@ -1249,8 +1249,6 @@ public class HighlighterTest extends BaseTokenStreamTestCase implements Formatte
String text = "this is a text with searchterm in it";
SimpleHTMLFormatter fm = new SimpleHTMLFormatter();
TokenStream tokenStream = new MockAnalyzer(random, MockTokenizer.SIMPLE, true, stopWords, true)
.tokenStream("text", new StringReader(text));
Highlighter hg = getHighlighter(query, "text", fm);
hg.setTextFragmenter(new NullFragmenter());
hg.setMaxDocCharsToAnalyze(36);
@ -1969,16 +1967,16 @@ final class SynonymTokenizer extends TokenStream {
String result = highlighter.getBestFragments(tokenStream, text, maxNumFragmentsRequired,
fragmentSeparator);
if (HighlighterTest.VERBOSE) System.out.println("\t" + result);
if (LuceneTestCase.VERBOSE) System.out.println("\t" + result);
}
}
abstract void run() throws Exception;
void start() throws Exception {
if (HighlighterTest.VERBOSE) System.out.println("Run QueryScorer");
if (LuceneTestCase.VERBOSE) System.out.println("Run QueryScorer");
run();
if (HighlighterTest.VERBOSE) System.out.println("Run QueryTermScorer");
if (LuceneTestCase.VERBOSE) System.out.println("Run QueryTermScorer");
mode = QUERY_TERM;
run();
}

View File

@ -43,10 +43,8 @@ import org.apache.lucene.index.FieldInfos;
import org.apache.lucene.index.FieldInvertState;
import org.apache.lucene.index.Fields;
import org.apache.lucene.index.FieldsEnum;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.OrdTermState;
import org.apache.lucene.index.StoredFieldVisitor;
import org.apache.lucene.index.Term;
import org.apache.lucene.index.TermState;
import org.apache.lucene.index.Terms;
import org.apache.lucene.index.TermsEnum;
@ -206,7 +204,7 @@ public class MemoryIndex {
* Arrays.binarySearch() and Arrays.sort()
*/
private static final Comparator<Object> termComparator = new Comparator<Object>() {
@SuppressWarnings("unchecked")
@SuppressWarnings({"unchecked","rawtypes"})
public int compare(Object o1, Object o2) {
if (o1 instanceof Map.Entry<?,?>) o1 = ((Map.Entry<?,?>) o1).getKey();
if (o2 instanceof Map.Entry<?,?>) o2 = ((Map.Entry<?,?>) o2).getKey();
@ -226,14 +224,14 @@ public class MemoryIndex {
* Constructs an empty instance that can optionally store the start and end
* character offset of each token term in the text. This can be useful for
* highlighting of hit locations with the Lucene highlighter package.
* Private until the highlighter package matures, so that this can actually
* Protected until the highlighter package matures, so that this can actually
* be meaningfully integrated.
*
* @param storeOffsets
* whether or not to store the start and end character offset of
* each token term in the text
*/
private MemoryIndex(boolean storeOffsets) {
protected MemoryIndex(boolean storeOffsets) {
this.stride = storeOffsets ? 3 : 1;
fieldInfos = new FieldInfos();
}
@ -610,9 +608,6 @@ public class MemoryIndex {
/** Boost factor for hits for this field */
private final float boost;
/** Term for this field's fieldName, lazily computed on demand */
public transient Term template;
private final long sumTotalTermFreq;
public Info(HashMap<BytesRef,ArrayIntList> terms, int numTokens, int numOverlapTokens, float boost) {
@ -643,16 +638,6 @@ public class MemoryIndex {
if (sortedTerms == null) sortedTerms = sort(terms);
}
/** note that the frequency can be calculated as numPosition(getPositions(x)) */
public ArrayIntList getPositions(BytesRef term) {
return terms.get(term);
}
/** note that the frequency can be calculated as numPosition(getPositions(x)) */
public ArrayIntList getPositions(int pos) {
return sortedTerms[pos].getValue();
}
public float getBoost() {
return boost;
}
@ -672,10 +657,6 @@ public class MemoryIndex {
private int[] elements;
private int size = 0;
public ArrayIntList() {
this(10);
}
public ArrayIntList(int initialCapacity) {
elements = new int[initialCapacity];
}
@ -702,16 +683,6 @@ public class MemoryIndex {
return size;
}
public int[] toArray(int stride) {
int[] arr = new int[size() / stride];
if (stride == 1) {
System.arraycopy(elements, 0, arr, 0, size); // fast path
} else {
for (int i=0, j=0; j < size; i++, j += stride) arr[i] = elements[j];
}
return arr;
}
private void ensureCapacity(int minCapacity) {
int newCapacity = Math.max(minCapacity, (elements.length * 3) / 2 + 1);
int[] newElements = new int[newCapacity];
@ -1046,22 +1017,22 @@ public class MemoryIndex {
@Override
public int freq() {
return positions.size();
return positions.size() / stride;
}
@Override
public int nextPosition() {
return positions.get(posUpto++);
return positions.get(posUpto++ * stride);
}
@Override
public int startOffset() {
return -1;
return stride == 1 ? -1 : positions.get((posUpto - 1) * stride + 1);
}
@Override
public int endOffset() {
return -1;
return stride == 1 ? -1 : positions.get((posUpto - 1) * stride + 2);
}
@Override
@ -1164,16 +1135,7 @@ public class MemoryIndex {
public static final int PTR = Constants.JRE_IS_64BIT ? 8 : 4;
// bytes occupied by primitive data types
public static final int BOOLEAN = 1;
public static final int BYTE = 1;
public static final int CHAR = 2;
public static final int SHORT = 2;
public static final int INT = 4;
public static final int LONG = 8;
public static final int FLOAT = 4;
public static final int DOUBLE = 8;
private static final int LOG_PTR = (int) Math.round(log2(PTR));
/**
@ -1201,28 +1163,15 @@ public class MemoryIndex {
return sizeOfObject(INT + PTR*len);
}
public static int sizeOfCharArray(int len) {
return sizeOfObject(INT + CHAR*len);
}
public static int sizeOfIntArray(int len) {
return sizeOfObject(INT + INT*len);
}
public static int sizeOfString(int len) {
return sizeOfObject(3*INT + PTR) + sizeOfCharArray(len);
}
public static int sizeOfHashMap(int len) {
return sizeOfObject(4*PTR + 4*INT) + sizeOfObjectArray(len)
+ len * sizeOfObject(3*PTR + INT); // entries
}
// note: does not include referenced objects
public static int sizeOfArrayList(int len) {
return sizeOfObject(PTR + 2*INT) + sizeOfObjectArray(len);
}
public static int sizeOfArrayIntList(int len) {
return sizeOfObject(PTR + INT) + sizeOfIntArray(len);
}

View File

@ -34,6 +34,7 @@ import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.document.TextField;
import org.apache.lucene.index.AtomicReader;
import org.apache.lucene.index.DirectoryReader;
import org.apache.lucene.index.DocsAndPositionsEnum;
import org.apache.lucene.index.DocsEnum;
import org.apache.lucene.index.IndexReader;
@ -135,7 +136,7 @@ public class MemoryIndexTest extends BaseTokenStreamTestCase {
* Run all queries against both the RAMDirectory and MemoryIndex, ensuring they are the same.
*/
public void assertAllQueries(MemoryIndex memory, Directory ramdir, Analyzer analyzer) throws Exception {
IndexReader reader = IndexReader.open(ramdir);
IndexReader reader = DirectoryReader.open(ramdir);
IndexSearcher ram = new IndexSearcher(reader);
IndexSearcher mem = memory.createSearcher();
QueryParser qp = new QueryParser(TEST_VERSION_CURRENT, "foo", analyzer);
@ -204,13 +205,16 @@ public class MemoryIndexTest extends BaseTokenStreamTestCase {
public void testDocsAndPositionsEnumStart() throws Exception {
Analyzer analyzer = new MockAnalyzer(random);
MemoryIndex memory = new MemoryIndex();
MemoryIndex memory = new MemoryIndex(true);
memory.addField("foo", "bar", analyzer);
AtomicReader reader = (AtomicReader) memory.createSearcher().getIndexReader();
DocsAndPositionsEnum disi = reader.termPositionsEnum(null, "foo", new BytesRef("bar"), false);
int docid = disi.docID();
assertTrue(docid == -1 || docid == DocIdSetIterator.NO_MORE_DOCS);
assertTrue(disi.nextDoc() != DocIdSetIterator.NO_MORE_DOCS);
assertEquals(0, disi.nextPosition());
assertEquals(0, disi.startOffset());
assertEquals(3, disi.endOffset());
// now reuse and check again
TermsEnum te = reader.terms("foo").iterator(null);

View File

@ -180,7 +180,7 @@ public class MultiPassIndexSplitter {
private static final class FakeDeleteIndexReader extends MultiReader {
public FakeDeleteIndexReader(IndexReader reader) throws IOException {
super(initSubReaders(reader), false /* dont close */);
super(initSubReaders(reader));
}
private static AtomicReader[] initSubReaders(IndexReader reader) throws IOException {

View File

@ -41,6 +41,7 @@ import org.apache.lucene.index.Norm;
* subclasses can choose between.
* </p>
*
* @see <a href="doc-files/ss.gnuplot">A Gnuplot file used to generate some of the visualizations refrenced from each function.</a>
*/
public class SweetSpotSimilarity extends DefaultSimilarity {
@ -75,7 +76,7 @@ public class SweetSpotSimilarity extends DefaultSimilarity {
*
* @param min the minimum tf value to ever be returned (default: 0.0)
* @param max the maximum tf value to ever be returned (default: 2.0)
* @param base the base value to be used in the exponential for the hyperbolic function (default: e)
* @param base the base value to be used in the exponential for the hyperbolic function (default: 1.3)
* @param xoffset the midpoint of the hyperbolic function (default: 10.0)
* @see #hyperbolicTf
*/
@ -135,6 +136,7 @@ public class SweetSpotSimilarity extends DefaultSimilarity {
* </p>
*
* @see #setLengthNormFactors
* @see <a href="doc-files/ss.computeLengthNorm.svg">An SVG visualization of this function</a>
*/
public float computeLengthNorm(int numTerms) {
final int l = ln_min;
@ -175,6 +177,7 @@ public class SweetSpotSimilarity extends DefaultSimilarity {
* </p>
*
* @see #setBaselineTfFactors
* @see <a href="doc-files/ss.baselineTf.svg">An SVG visualization of this function</a>
*/
public float baselineTf(float freq) {
@ -198,6 +201,7 @@ public class SweetSpotSimilarity extends DefaultSimilarity {
* </p>
*
* @see #setHyperbolicTfFactors
* @see <a href="doc-files/ss.hyperbolicTf.svg">An SVG visualization of this function</a>
*/
public float hyperbolicTf(float freq) {
if (0.0f == freq) return 0.0f;

View File

@ -0,0 +1,208 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg viewBox="0 0 600 400"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink">
<desc>Produced by GNUPLOT 4.2 patchlevel 5 </desc>
<defs>
<circle id='gpDot' r='0.5' stroke-width='0.5'/>
<path id='gpPt0' stroke-width='0.244' stroke='currentColor' d='M-1,0 h2 M0,-1 v2'/>
<path id='gpPt1' stroke-width='0.244' stroke='currentColor' d='M-1,-1 L1,1 M1,-1 L-1,1'/>
<path id='gpPt2' stroke-width='0.244' stroke='currentColor' d='M-1,0 L1,0 M0,-1 L0,1 M-1,-1 L1,1 M-1,1 L1,-1'/>
<rect id='gpPt3' stroke-width='0.244' stroke='currentColor' x='-1' y='-1' width='2' height='2'/>
<rect id='gpPt4' stroke-width='0.244' stroke='currentColor' fill='currentColor' x='-1' y='-1' width='2' height='2'/>
<circle id='gpPt5' stroke-width='0.244' stroke='currentColor' cx='0' cy='0' r='1'/>
<use xlink:href='#gpPt5' id='gpPt6' fill='currentColor' stroke='none'/>
<path id='gpPt7' stroke-width='0.244' stroke='currentColor' d='M0,-1.33 L-1.33,0.67 L1.33,0.67 z'/>
<use xlink:href='#gpPt7' id='gpPt8' fill='currentColor' stroke='none'/>
<use xlink:href='#gpPt7' id='gpPt9' stroke='currentColor' transform='rotate(180)'/>
<use xlink:href='#gpPt9' id='gpPt10' fill='currentColor' stroke='none'/>
<use xlink:href='#gpPt3' id='gpPt11' stroke='currentColor' transform='rotate(45)'/>
<use xlink:href='#gpPt11' id='gpPt12' fill='currentColor' stroke='none'/>
</defs>
<g style="fill:none; color:white; stroke:currentColor; stroke-width:1.00; stroke-linecap:butt; stroke-linejoin:miter">
</g>
<g style="fill:none; color:black; stroke:currentColor; stroke-width:1.00; stroke-linecap:butt; stroke-linejoin:miter">
<path d='M50.0,367.2 L58.2,367.2 M580.7,367.2 L572.5,367.2 '></path>
<g transform="translate(42.3,371.3)" style="stroke:none; fill:black; font-family:arial; font-size:11.00pt; text-anchor:end">
<text><tspan>-1</tspan>
</text>
</g>
<path d='M50.0,331.9 L58.2,331.9 M580.7,331.9 L572.5,331.9 '></path>
<g transform="translate(42.3,336.0)" style="stroke:none; fill:black; font-family:arial; font-size:11.00pt; text-anchor:end">
<text><tspan> 0</tspan>
</text>
</g>
<path d='M50.0,296.5 L58.2,296.5 M580.7,296.5 L572.5,296.5 '></path>
<g transform="translate(42.3,300.6)" style="stroke:none; fill:black; font-family:arial; font-size:11.00pt; text-anchor:end">
<text><tspan> 1</tspan>
</text>
</g>
<path d='M50.0,261.2 L58.2,261.2 M580.7,261.2 L572.5,261.2 '></path>
<g transform="translate(42.3,265.3)" style="stroke:none; fill:black; font-family:arial; font-size:11.00pt; text-anchor:end">
<text><tspan> 2</tspan>
</text>
</g>
<path d='M50.0,225.9 L58.2,225.9 M580.7,225.9 L572.5,225.9 '></path>
<g transform="translate(42.3,230.0)" style="stroke:none; fill:black; font-family:arial; font-size:11.00pt; text-anchor:end">
<text><tspan> 3</tspan>
</text>
</g>
<path d='M50.0,190.5 L58.2,190.5 M580.7,190.5 L572.5,190.5 '></path>
<g transform="translate(42.3,194.6)" style="stroke:none; fill:black; font-family:arial; font-size:11.00pt; text-anchor:end">
<text><tspan> 4</tspan>
</text>
</g>
<path d='M50.0,155.2 L58.2,155.2 M580.7,155.2 L572.5,155.2 '></path>
<g transform="translate(42.3,159.3)" style="stroke:none; fill:black; font-family:arial; font-size:11.00pt; text-anchor:end">
<text><tspan> 5</tspan>
</text>
</g>
<path d='M50.0,119.9 L58.2,119.9 M580.7,119.9 L572.5,119.9 '></path>
<g transform="translate(42.3,124.0)" style="stroke:none; fill:black; font-family:arial; font-size:11.00pt; text-anchor:end">
<text><tspan> 6</tspan>
</text>
</g>
<path d='M50.0,84.5 L58.2,84.5 M580.7,84.5 L572.5,84.5 '></path>
<g transform="translate(42.3,88.6)" style="stroke:none; fill:black; font-family:arial; font-size:11.00pt; text-anchor:end">
<text><tspan> 7</tspan>
</text>
</g>
<path d='M50.0,49.2 L58.2,49.2 M580.7,49.2 L572.5,49.2 '></path>
<g transform="translate(42.3,53.3)" style="stroke:none; fill:black; font-family:arial; font-size:11.00pt; text-anchor:end">
<text><tspan> 8</tspan>
</text>
</g>
<path d='M50.0,367.2 L50.0,359.0 M50.0,49.2 L50.0,57.4 '></path>
<g transform="translate(50.0,387.7)" style="stroke:none; fill:black; font-family:arial; font-size:11.00pt; text-anchor:middle">
<text><tspan> 0</tspan>
</text>
</g>
<path d='M182.7,367.2 L182.7,359.0 M182.7,49.2 L182.7,57.4 '></path>
<g transform="translate(182.7,387.7)" style="stroke:none; fill:black; font-family:arial; font-size:11.00pt; text-anchor:middle">
<text><tspan> 5</tspan>
</text>
</g>
<path d='M315.4,367.2 L315.4,359.0 M315.4,49.2 L315.4,57.4 '></path>
<g transform="translate(315.4,387.7)" style="stroke:none; fill:black; font-family:arial; font-size:11.00pt; text-anchor:middle">
<text><tspan> 10</tspan>
</text>
</g>
<path d='M448.0,367.2 L448.0,359.0 M448.0,49.2 L448.0,57.4 '></path>
<g transform="translate(448.0,387.7)" style="stroke:none; fill:black; font-family:arial; font-size:11.00pt; text-anchor:middle">
<text><tspan> 15</tspan>
</text>
</g>
<path d='M580.7,367.2 L580.7,359.0 M580.7,49.2 L580.7,57.4 '></path>
<g transform="translate(580.7,387.7)" style="stroke:none; fill:black; font-family:arial; font-size:11.00pt; text-anchor:middle">
<text><tspan> 20</tspan>
</text>
</g>
<path d='M50.0,49.2 L50.0,367.2 L580.7,367.2 L580.7,49.2 L50.0,49.2 Z '></path>
<g transform="translate(315.3,28.7)" style="stroke:none; fill:black; font-family:arial; font-size:11.00pt; text-anchor:middle">
<text><tspan>SweetSpotSimilarity.baselineTf(x)</tspan>
</text>
</g>
<path d='M57.7,123.0 L57.7,57.4 L227.6,57.4 L227.6,123.0 L57.7,123.0 Z '></path>
<path d='M57.7,57.4 L227.6,57.4 '></path>
</g>
<g style="fill:none; color:red; stroke:currentColor; stroke-width:1.00; stroke-linecap:butt; stroke-linejoin:miter">
</g>
<g style="fill:none; color:black; stroke:currentColor; stroke-width:1.00; stroke-linecap:butt; stroke-linejoin:miter">
<g transform="translate(173.2,69.7)" style="stroke:none; fill:black; font-family:arial; font-size:11.00pt; text-anchor:end">
<text><tspan>all defaults</tspan>
</text>
</g>
</g>
<g style="fill:none; color:red; stroke:currentColor; stroke-width:1.00; stroke-linecap:butt; stroke-linejoin:miter">
<path d='M180.9,65.6 L219.9,65.6 M50.0,331.9 L55.4,316.0 L60.7,309.4 L66.1,304.4 L71.4,300.1 L76.8,296.4
L82.2,293.0 L87.5,289.8 L92.9,286.9 L98.2,284.2 L103.6,281.6 L109.0,279.2 L114.3,276.9 L119.7,274.6
L125.0,272.4 L130.4,270.4 L135.8,268.3 L141.1,266.4 L146.5,264.5 L151.9,262.6 L157.2,260.8 L162.6,259.1
L167.9,257.4 L173.3,255.7 L178.7,254.1 L184.0,252.5 L189.4,250.9 L194.7,249.3 L200.1,247.8 L205.5,246.3
L210.8,244.9 L216.2,243.4 L221.5,242.0 L226.9,240.6 L232.3,239.3 L237.6,237.9 L243.0,236.6 L248.3,235.3
L253.7,234.0 L259.1,232.7 L264.4,231.4 L269.8,230.2 L275.1,228.9 L280.5,227.7 L285.9,226.5 L291.2,225.3
L296.6,224.2 L301.9,223.0 L307.3,221.8 L312.7,220.7 L318.0,219.6 L323.4,218.5 L328.8,217.3 L334.1,216.3
L339.5,215.2 L344.8,214.1 L350.2,213.0 L355.6,212.0 L360.9,210.9 L366.3,209.9 L371.6,208.9 L377.0,207.8
L382.4,206.8 L387.7,205.8 L393.1,204.8 L398.4,203.8 L403.8,202.8 L409.2,201.9 L414.5,200.9 L419.9,199.9
L425.2,199.0 L430.6,198.0 L436.0,197.1 L441.3,196.2 L446.7,195.3 L452.0,194.3 L457.4,193.4 L462.8,192.5
L468.1,191.6 L473.5,190.7 L478.8,189.8 L484.2,188.9 L489.6,188.1 L494.9,187.2 L500.3,186.3 L505.7,185.4
L511.0,184.6 L516.4,183.7 L521.7,182.9 L527.1,182.0 L532.5,181.2 L537.8,180.4 L543.2,179.5 L548.5,178.7
L553.9,177.9 L559.3,177.1 L564.6,176.3 L570.0,175.5 L575.3,174.7 L580.7,173.9 '></path>
</g>
<g style="fill:none; color:green; stroke:currentColor; stroke-width:1.00; stroke-linecap:butt; stroke-linejoin:miter">
</g>
<g style="fill:none; color:black; stroke:currentColor; stroke-width:1.00; stroke-linecap:butt; stroke-linejoin:miter">
<g transform="translate(173.2,86.1)" style="stroke:none; fill:black; font-family:arial; font-size:11.00pt; text-anchor:end">
<text><tspan>base=1.5</tspan>
</text>
</g>
</g>
<g style="fill:none; color:green; stroke:currentColor; stroke-width:1.00; stroke-linecap:butt; stroke-linejoin:miter">
<path d='M180.9,82.0 L219.9,82.0 M50.0,278.9 L55.4,276.5 L60.7,274.3 L66.1,272.2 L71.4,270.1 L76.8,268.1
L82.2,266.1 L87.5,264.2 L92.9,262.4 L98.2,260.6 L103.6,258.9 L109.0,257.1 L114.3,255.5 L119.7,253.8
L125.0,252.2 L130.4,250.7 L135.8,249.1 L141.1,247.6 L146.5,246.1 L151.9,244.7 L157.2,243.2 L162.6,241.8
L167.9,240.4 L173.3,239.1 L178.7,237.7 L184.0,236.4 L189.4,235.1 L194.7,233.8 L200.1,232.5 L205.5,231.3
L210.8,230.0 L216.2,228.8 L221.5,227.6 L226.9,226.4 L232.3,225.2 L237.6,224.0 L243.0,222.8 L248.3,221.7
L253.7,220.5 L259.1,219.4 L264.4,218.3 L269.8,217.2 L275.1,216.1 L280.5,215.0 L285.9,213.9 L291.2,212.9
L296.6,211.8 L301.9,210.8 L307.3,209.7 L312.7,208.7 L318.0,207.7 L323.4,206.7 L328.8,205.7 L334.1,204.7
L339.5,203.7 L344.8,202.7 L350.2,201.7 L355.6,200.8 L360.9,199.8 L366.3,198.9 L371.6,197.9 L377.0,197.0
L382.4,196.1 L387.7,195.1 L393.1,194.2 L398.4,193.3 L403.8,192.4 L409.2,191.5 L414.5,190.6 L419.9,189.7
L425.2,188.8 L430.6,187.9 L436.0,187.1 L441.3,186.2 L446.7,185.3 L452.0,184.5 L457.4,183.6 L462.8,182.8
L468.1,181.9 L473.5,181.1 L478.8,180.3 L484.2,179.4 L489.6,178.6 L494.9,177.8 L500.3,177.0 L505.7,176.2
L511.0,175.3 L516.4,174.5 L521.7,173.7 L527.1,172.9 L532.5,172.2 L537.8,171.4 L543.2,170.6 L548.5,169.8
L553.9,169.0 L559.3,168.3 L564.6,167.5 L570.0,166.7 L575.3,166.0 L580.7,165.2 '></path>
</g>
<g style="fill:none; color:blue; stroke:currentColor; stroke-width:1.00; stroke-linecap:butt; stroke-linejoin:miter">
</g>
<g style="fill:none; color:black; stroke:currentColor; stroke-width:1.00; stroke-linecap:butt; stroke-linejoin:miter">
<g transform="translate(173.2,102.5)" style="stroke:none; fill:black; font-family:arial; font-size:11.00pt; text-anchor:end">
<text><tspan>min=5</tspan>
</text>
</g>
</g>
<g style="fill:none; color:blue; stroke:currentColor; stroke-width:1.00; stroke-linecap:butt; stroke-linejoin:miter">
<path d='M180.9,98.4 L219.9,98.4 M50.0,331.9 L55.4,331.9 L60.7,331.9 L66.1,331.9 L71.4,331.9 L76.8,331.9
L82.2,331.9 L87.5,331.9 L92.9,331.9 L98.2,331.9 L103.6,331.9 L109.0,331.9 L114.3,331.9 L119.7,331.9
L125.0,331.9 L130.4,331.9 L135.8,331.9 L141.1,331.9 L146.5,331.9 L151.9,331.9 L157.2,331.9 L162.6,331.9
L167.9,331.9 L173.3,331.9 L178.7,331.9 L184.0,323.9 L189.4,314.1 L194.7,308.0 L200.1,303.2 L205.5,299.1
L210.8,295.5 L216.2,292.2 L221.5,289.1 L226.9,286.3 L232.3,283.6 L237.6,281.0 L243.0,278.6 L248.3,276.3
L253.7,274.1 L259.1,271.9 L264.4,269.8 L269.8,267.8 L275.1,265.9 L280.5,264.0 L285.9,262.2 L291.2,260.4
L296.6,258.7 L301.9,257.0 L307.3,255.3 L312.7,253.7 L318.0,252.1 L323.4,250.5 L328.8,249.0 L334.1,247.5
L339.5,246.0 L344.8,244.5 L350.2,243.1 L355.6,241.7 L360.9,240.3 L366.3,238.9 L371.6,237.6 L377.0,236.2
L382.4,234.9 L387.7,233.6 L393.1,232.4 L398.4,231.1 L403.8,229.9 L409.2,228.6 L414.5,227.4 L419.9,226.2
L425.2,225.0 L430.6,223.9 L436.0,222.7 L441.3,221.6 L446.7,220.4 L452.0,219.3 L457.4,218.2 L462.8,217.1
L468.1,216.0 L473.5,214.9 L478.8,213.8 L484.2,212.8 L489.6,211.7 L494.9,210.7 L500.3,209.6 L505.7,208.6
L511.0,207.6 L516.4,206.6 L521.7,205.6 L527.1,204.6 L532.5,203.6 L537.8,202.6 L543.2,201.6 L548.5,200.7
L553.9,199.7 L559.3,198.8 L564.6,197.8 L570.0,196.9 L575.3,195.9 L580.7,195.0 '></path>
</g>
<g style="fill:none; color:cyan; stroke:currentColor; stroke-width:1.00; stroke-linecap:butt; stroke-linejoin:miter">
</g>
<g style="fill:none; color:black; stroke:currentColor; stroke-width:1.00; stroke-linecap:butt; stroke-linejoin:miter">
<g transform="translate(173.2,118.9)" style="stroke:none; fill:black; font-family:arial; font-size:11.00pt; text-anchor:end">
<text><tspan>min=5, base=1.5</tspan>
</text>
</g>
</g>
<g style="fill:none; color:cyan; stroke:currentColor; stroke-width:1.00; stroke-linecap:butt; stroke-linejoin:miter">
<path d='M180.9,114.8 L219.9,114.8 M50.0,278.9 L55.4,278.9 L60.7,278.9 L66.1,278.9 L71.4,278.9 L76.8,278.9
L82.2,278.9 L87.5,278.9 L92.9,278.9 L98.2,278.9 L103.6,278.9 L109.0,278.9 L114.3,278.9 L119.7,278.9
L125.0,278.9 L130.4,278.9 L135.8,278.9 L141.1,278.9 L146.5,278.9 L151.9,278.9 L157.2,278.9 L162.6,278.9
L167.9,278.9 L173.3,278.9 L178.7,278.9 L184.0,278.3 L189.4,276.0 L194.7,273.8 L200.1,271.6 L205.5,269.6
L210.8,267.6 L216.2,265.6 L221.5,263.8 L226.9,261.9 L232.3,260.2 L237.6,258.4 L243.0,256.7 L248.3,255.1
L253.7,253.4 L259.1,251.8 L264.4,250.3 L269.8,248.8 L275.1,247.3 L280.5,245.8 L285.9,244.3 L291.2,242.9
L296.6,241.5 L301.9,240.1 L307.3,238.7 L312.7,237.4 L318.0,236.1 L323.4,234.8 L328.8,233.5 L334.1,232.2
L339.5,230.9 L344.8,229.7 L350.2,228.5 L355.6,227.3 L360.9,226.1 L366.3,224.9 L371.6,223.7 L377.0,222.5
L382.4,221.4 L387.7,220.3 L393.1,219.1 L398.4,218.0 L403.8,216.9 L409.2,215.8 L414.5,214.7 L419.9,213.7
L425.2,212.6 L430.6,211.6 L436.0,210.5 L441.3,209.5 L446.7,208.5 L452.0,207.4 L457.4,206.4 L462.8,205.4
L468.1,204.4 L473.5,203.4 L478.8,202.5 L484.2,201.5 L489.6,200.5 L494.9,199.6 L500.3,198.6 L505.7,197.7
L511.0,196.7 L516.4,195.8 L521.7,194.9 L527.1,194.0 L532.5,193.1 L537.8,192.2 L543.2,191.3 L548.5,190.4
L553.9,189.5 L559.3,188.6 L564.6,187.7 L570.0,186.8 L575.3,186.0 L580.7,185.1 '></path>
</g>
<g style="fill:none; color:black; stroke:currentColor; stroke-width:1.00; stroke-linecap:butt; stroke-linejoin:miter">
<path d='M50.0,49.2 L50.0,367.2 L580.7,367.2 L580.7,49.2 L50.0,49.2 Z '></path>
</g>
</svg>

After

Width:  |  Height:  |  Size: 13 KiB

View File

@ -0,0 +1,201 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg viewBox="0 0 600 400"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink">
<desc>Produced by GNUPLOT 4.2 patchlevel 5 </desc>
<defs>
<circle id='gpDot' r='0.5' stroke-width='0.5'/>
<path id='gpPt0' stroke-width='0.244' stroke='currentColor' d='M-1,0 h2 M0,-1 v2'/>
<path id='gpPt1' stroke-width='0.244' stroke='currentColor' d='M-1,-1 L1,1 M1,-1 L-1,1'/>
<path id='gpPt2' stroke-width='0.244' stroke='currentColor' d='M-1,0 L1,0 M0,-1 L0,1 M-1,-1 L1,1 M-1,1 L1,-1'/>
<rect id='gpPt3' stroke-width='0.244' stroke='currentColor' x='-1' y='-1' width='2' height='2'/>
<rect id='gpPt4' stroke-width='0.244' stroke='currentColor' fill='currentColor' x='-1' y='-1' width='2' height='2'/>
<circle id='gpPt5' stroke-width='0.244' stroke='currentColor' cx='0' cy='0' r='1'/>
<use xlink:href='#gpPt5' id='gpPt6' fill='currentColor' stroke='none'/>
<path id='gpPt7' stroke-width='0.244' stroke='currentColor' d='M0,-1.33 L-1.33,0.67 L1.33,0.67 z'/>
<use xlink:href='#gpPt7' id='gpPt8' fill='currentColor' stroke='none'/>
<use xlink:href='#gpPt7' id='gpPt9' stroke='currentColor' transform='rotate(180)'/>
<use xlink:href='#gpPt9' id='gpPt10' fill='currentColor' stroke='none'/>
<use xlink:href='#gpPt3' id='gpPt11' stroke='currentColor' transform='rotate(45)'/>
<use xlink:href='#gpPt11' id='gpPt12' fill='currentColor' stroke='none'/>
</defs>
<g style="fill:none; color:white; stroke:currentColor; stroke-width:1.00; stroke-linecap:butt; stroke-linejoin:miter">
</g>
<g style="fill:none; color:black; stroke:currentColor; stroke-width:1.00; stroke-linecap:butt; stroke-linejoin:miter">
<path d='M65.4,367.2 L73.6,367.2 M580.7,367.2 L572.5,367.2 '></path>
<g transform="translate(57.7,371.3)" style="stroke:none; fill:black; font-family:arial; font-size:11.00pt; text-anchor:end">
<text><tspan> 0</tspan>
</text>
</g>
<path d='M65.4,314.2 L73.6,314.2 M580.7,314.2 L572.5,314.2 '></path>
<g transform="translate(57.7,318.3)" style="stroke:none; fill:black; font-family:arial; font-size:11.00pt; text-anchor:end">
<text><tspan> 0.2</tspan>
</text>
</g>
<path d='M65.4,261.2 L73.6,261.2 M580.7,261.2 L572.5,261.2 '></path>
<g transform="translate(57.7,265.3)" style="stroke:none; fill:black; font-family:arial; font-size:11.00pt; text-anchor:end">
<text><tspan> 0.4</tspan>
</text>
</g>
<path d='M65.4,208.2 L73.6,208.2 M580.7,208.2 L572.5,208.2 '></path>
<g transform="translate(57.7,212.3)" style="stroke:none; fill:black; font-family:arial; font-size:11.00pt; text-anchor:end">
<text><tspan> 0.6</tspan>
</text>
</g>
<path d='M65.4,155.2 L73.6,155.2 M580.7,155.2 L572.5,155.2 '></path>
<g transform="translate(57.7,159.3)" style="stroke:none; fill:black; font-family:arial; font-size:11.00pt; text-anchor:end">
<text><tspan> 0.8</tspan>
</text>
</g>
<path d='M65.4,102.2 L73.6,102.2 M580.7,102.2 L572.5,102.2 '></path>
<g transform="translate(57.7,106.3)" style="stroke:none; fill:black; font-family:arial; font-size:11.00pt; text-anchor:end">
<text><tspan> 1</tspan>
</text>
</g>
<path d='M65.4,49.2 L73.6,49.2 M580.7,49.2 L572.5,49.2 '></path>
<g transform="translate(57.7,53.3)" style="stroke:none; fill:black; font-family:arial; font-size:11.00pt; text-anchor:end">
<text><tspan> 1.2</tspan>
</text>
</g>
<path d='M65.4,367.2 L65.4,359.0 M65.4,49.2 L65.4,57.4 '></path>
<g transform="translate(65.4,387.7)" style="stroke:none; fill:black; font-family:arial; font-size:11.00pt; text-anchor:middle">
<text><tspan> 0</tspan>
</text>
</g>
<path d='M91.2,367.2 L91.2,363.1 M91.2,49.2 L91.2,53.3 M116.9,367.2 L116.9,363.1 M116.9,49.2 L116.9,53.3
M142.7,367.2 L142.7,363.1 M142.7,49.2 L142.7,53.3 M168.5,367.2 L168.5,363.1 M168.5,49.2 L168.5,53.3
M194.2,367.2 L194.2,359.0 M194.2,49.2 L194.2,57.4 '></path>
<g transform="translate(194.2,387.7)" style="stroke:none; fill:black; font-family:arial; font-size:11.00pt; text-anchor:middle">
<text><tspan> 5</tspan>
</text>
</g>
<path d='M220.0,367.2 L220.0,363.1 M220.0,49.2 L220.0,53.3 M245.8,367.2 L245.8,363.1 M245.8,49.2 L245.8,53.3
M271.5,367.2 L271.5,363.1 M271.5,49.2 L271.5,53.3 M297.3,367.2 L297.3,363.1 M297.3,49.2 L297.3,53.3
M323.1,367.2 L323.1,359.0 M323.1,49.2 L323.1,57.4 '></path>
<g transform="translate(323.1,387.7)" style="stroke:none; fill:black; font-family:arial; font-size:11.00pt; text-anchor:middle">
<text><tspan> 10</tspan>
</text>
</g>
<path d='M348.8,367.2 L348.8,363.1 M348.8,49.2 L348.8,53.3 M374.6,367.2 L374.6,363.1 M374.6,49.2 L374.6,53.3
M400.3,367.2 L400.3,363.1 M400.3,49.2 L400.3,53.3 M426.1,367.2 L426.1,363.1 M426.1,49.2 L426.1,53.3
M451.9,367.2 L451.9,359.0 M451.9,49.2 L451.9,57.4 '></path>
<g transform="translate(451.9,387.7)" style="stroke:none; fill:black; font-family:arial; font-size:11.00pt; text-anchor:middle">
<text><tspan> 15</tspan>
</text>
</g>
<path d='M477.6,367.2 L477.6,363.1 M477.6,49.2 L477.6,53.3 M503.4,367.2 L503.4,363.1 M503.4,49.2 L503.4,53.3
M529.2,367.2 L529.2,363.1 M529.2,49.2 L529.2,53.3 M554.9,367.2 L554.9,363.1 M554.9,49.2 L554.9,53.3
M580.7,367.2 L580.7,359.0 M580.7,49.2 L580.7,57.4 '></path>
<g transform="translate(580.7,387.7)" style="stroke:none; fill:black; font-family:arial; font-size:11.00pt; text-anchor:middle">
<text><tspan> 20</tspan>
</text>
</g>
<path d='M65.4,49.2 L65.4,367.2 L580.7,367.2 L580.7,49.2 L65.4,49.2 Z '></path>
<g transform="translate(323.0,28.7)" style="stroke:none; fill:black; font-family:arial; font-size:11.00pt; text-anchor:middle">
<text><tspan>SweetSpotSimilarity.computeLengthNorm(t)</tspan>
</text>
</g>
<path d='M364.6,123.0 L364.6,57.4 L573.0,57.4 L573.0,123.0 L364.6,123.0 Z '></path>
<path d='M364.6,57.4 L573.0,57.4 '></path>
</g>
<g style="fill:none; color:red; stroke:currentColor; stroke-width:1.00; stroke-linecap:butt; stroke-linejoin:miter">
</g>
<g style="fill:none; color:black; stroke:currentColor; stroke-width:1.00; stroke-linecap:butt; stroke-linejoin:miter">
<g transform="translate(518.6,69.7)" style="stroke:none; fill:black; font-family:arial; font-size:11.00pt; text-anchor:end">
<text><tspan>all defaults</tspan>
</text>
</g>
</g>
<g style="fill:none; color:red; stroke:currentColor; stroke-width:1.00; stroke-linecap:butt; stroke-linejoin:miter">
<path d='M526.3,65.6 L565.3,65.6 M65.4,179.8 L70.6,169.6 L75.8,157.4 L81.0,142.7 L86.2,124.5 L91.4,103.5
L96.6,126.5 L101.8,144.4 L107.0,158.7 L112.2,170.7 L117.5,180.8 L122.7,189.4 L127.9,197.0 L133.1,203.7
L138.3,209.6 L143.5,215.0 L148.7,219.8 L153.9,224.2 L159.1,228.2 L164.3,231.9 L169.5,235.4 L174.7,238.5
L179.9,241.5 L185.1,244.3 L190.3,246.9 L195.5,249.3 L200.7,251.6 L205.9,253.7 L211.1,255.8 L216.3,257.7
L221.6,259.6 L226.8,261.3 L232.0,263.0 L237.2,264.6 L242.4,266.1 L247.6,267.5 L252.8,268.9 L258.0,270.3
L263.2,271.6 L268.4,272.8 L273.6,274.0 L278.8,275.1 L284.0,276.2 L289.2,277.3 L294.4,278.3 L299.6,279.3
L304.8,280.3 L310.0,281.2 L315.2,282.1 L320.4,283.0 L325.7,283.8 L330.9,284.6 L336.1,285.4 L341.3,286.2
L346.5,287.0 L351.7,287.7 L356.9,288.4 L362.1,289.1 L367.3,289.8 L372.5,290.4 L377.7,291.1 L382.9,291.7
L388.1,292.3 L393.3,292.9 L398.5,293.5 L403.7,294.1 L408.9,294.6 L414.1,295.2 L419.3,295.7 L424.5,296.2
L429.8,296.7 L435.0,297.2 L440.2,297.7 L445.4,298.2 L450.6,298.7 L455.8,299.1 L461.0,299.6 L466.2,300.0
L471.4,300.4 L476.6,300.9 L481.8,301.3 L487.0,301.7 L492.2,302.1 L497.4,302.5 L502.6,302.9 L507.8,303.3
L513.0,303.6 L518.2,304.0 L523.4,304.3 L528.6,304.7 L533.9,305.1 L539.1,305.4 L544.3,305.7 L549.5,306.1
L554.7,306.4 L559.9,306.7 L565.1,307.0 L570.3,307.3 L575.5,307.6 L580.7,307.9 '></path>
</g>
<g style="fill:none; color:green; stroke:currentColor; stroke-width:1.00; stroke-linecap:butt; stroke-linejoin:miter">
</g>
<g style="fill:none; color:black; stroke:currentColor; stroke-width:1.00; stroke-linecap:butt; stroke-linejoin:miter">
<g transform="translate(518.6,86.1)" style="stroke:none; fill:black; font-family:arial; font-size:11.00pt; text-anchor:end">
<text><tspan>steepness=0.2</tspan>
</text>
</g>
</g>
<g style="fill:none; color:green; stroke:currentColor; stroke-width:1.00; stroke-linecap:butt; stroke-linejoin:miter">
<path d='M526.3,82.0 L565.3,82.0 M65.4,143.2 L70.6,136.5 L75.8,129.1 L81.0,120.9 L86.2,111.8 L91.4,102.7
L96.6,112.8 L101.8,121.8 L107.0,129.8 L112.2,137.2 L117.5,143.9 L122.7,150.0 L127.9,155.7 L133.1,160.9
L138.3,165.8 L143.5,170.3 L148.7,174.6 L153.9,178.6 L159.1,182.3 L164.3,185.9 L169.5,189.2 L174.7,192.3
L179.9,195.3 L185.1,198.2 L190.3,200.9 L195.5,203.5 L200.7,206.0 L205.9,208.3 L211.1,210.6 L216.3,212.7
L221.6,214.8 L226.8,216.8 L232.0,218.7 L237.2,220.6 L242.4,222.4 L247.6,224.1 L252.8,225.7 L258.0,227.3
L263.2,228.9 L268.4,230.4 L273.6,231.8 L278.8,233.2 L284.0,234.6 L289.2,235.9 L294.4,237.2 L299.6,238.4
L304.8,239.7 L310.0,240.8 L315.2,242.0 L320.4,243.1 L325.7,244.2 L330.9,245.2 L336.1,246.3 L341.3,247.3
L346.5,248.3 L351.7,249.2 L356.9,250.1 L362.1,251.1 L367.3,251.9 L372.5,252.8 L377.7,253.7 L382.9,254.5
L388.1,255.3 L393.3,256.1 L398.5,256.9 L403.7,257.7 L408.9,258.4 L414.1,259.1 L419.3,259.9 L424.5,260.6
L429.8,261.3 L435.0,261.9 L440.2,262.6 L445.4,263.3 L450.6,263.9 L455.8,264.5 L461.0,265.1 L466.2,265.7
L471.4,266.3 L476.6,266.9 L481.8,267.5 L487.0,268.1 L492.2,268.6 L497.4,269.2 L502.6,269.7 L507.8,270.2
L513.0,270.8 L518.2,271.3 L523.4,271.8 L528.6,272.3 L533.9,272.8 L539.1,273.2 L544.3,273.7 L549.5,274.2
L554.7,274.6 L559.9,275.1 L565.1,275.5 L570.3,276.0 L575.5,276.4 L580.7,276.8 '></path>
</g>
<g style="fill:none; color:blue; stroke:currentColor; stroke-width:1.00; stroke-linecap:butt; stroke-linejoin:miter">
</g>
<g style="fill:none; color:black; stroke:currentColor; stroke-width:1.00; stroke-linecap:butt; stroke-linejoin:miter">
<g transform="translate(518.6,102.5)" style="stroke:none; fill:black; font-family:arial; font-size:11.00pt; text-anchor:end">
<text><tspan>max=6, steepness=0.2</tspan>
</text>
</g>
</g>
<g style="fill:none; color:blue; stroke:currentColor; stroke-width:1.00; stroke-linecap:butt; stroke-linejoin:miter">
<path d='M526.3,98.4 L565.3,98.4 M65.4,143.2 L70.6,136.5 L75.8,129.1 L81.0,120.9 L86.2,111.8 L91.4,102.2
L96.6,102.2 L101.8,102.2 L107.0,102.2 L112.2,102.2 L117.5,102.2 L122.7,102.2 L127.9,102.2 L133.1,102.2
L138.3,102.2 L143.5,102.2 L148.7,102.2 L153.9,102.2 L159.1,102.2 L164.3,102.2 L169.5,102.2 L174.7,102.2
L179.9,102.2 L185.1,102.2 L190.3,102.2 L195.5,102.2 L200.7,102.2 L205.9,102.2 L211.1,102.2 L216.3,102.2
L221.6,105.4 L226.8,115.1 L232.0,123.9 L237.2,131.7 L242.4,138.9 L247.6,145.5 L252.8,151.5 L258.0,157.0
L263.2,162.2 L268.4,167.0 L273.6,171.4 L278.8,175.6 L284.0,179.5 L289.2,183.2 L294.4,186.7 L299.6,190.0
L304.8,193.1 L310.0,196.1 L315.2,198.9 L320.4,201.6 L325.7,204.1 L330.9,206.6 L336.1,208.9 L341.3,211.1
L346.5,213.3 L351.7,215.3 L356.9,217.3 L362.1,219.2 L367.3,221.0 L372.5,222.8 L377.7,224.5 L382.9,226.1
L388.1,227.7 L393.3,229.3 L398.5,230.7 L403.7,232.2 L408.9,233.6 L414.1,234.9 L419.3,236.2 L424.5,237.5
L429.8,238.8 L435.0,240.0 L440.2,241.1 L445.4,242.3 L450.6,243.4 L455.8,244.4 L461.0,245.5 L466.2,246.5
L471.4,247.5 L476.6,248.5 L481.8,249.4 L487.0,250.4 L492.2,251.3 L497.4,252.2 L502.6,253.0 L507.8,253.9
L513.0,254.7 L518.2,255.5 L523.4,256.3 L528.6,257.1 L533.9,257.8 L539.1,258.6 L544.3,259.3 L549.5,260.0
L554.7,260.7 L559.9,261.4 L565.1,262.1 L570.3,262.8 L575.5,263.4 L580.7,264.0 '></path>
</g>
<g style="fill:none; color:cyan; stroke:currentColor; stroke-width:1.00; stroke-linecap:butt; stroke-linejoin:miter">
</g>
<g style="fill:none; color:black; stroke:currentColor; stroke-width:1.00; stroke-linecap:butt; stroke-linejoin:miter">
<g transform="translate(518.6,118.9)" style="stroke:none; fill:black; font-family:arial; font-size:11.00pt; text-anchor:end">
<text><tspan>min=3, max=5</tspan>
</text>
</g>
</g>
<g style="fill:none; color:cyan; stroke:currentColor; stroke-width:1.00; stroke-linecap:butt; stroke-linejoin:miter">
<path d='M526.3,114.8 L565.3,114.8 M65.4,234.7 L70.6,231.2 L75.8,227.5 L81.0,223.4 L86.2,218.9 L91.4,213.9
L96.6,208.5 L101.8,202.4 L107.0,195.6 L112.2,187.8 L117.5,178.9 L122.7,168.4 L127.9,156.1 L133.1,141.1
L138.3,122.4 L143.5,102.2 L148.7,102.2 L153.9,102.2 L159.1,102.2 L164.3,102.2 L169.5,102.2 L174.7,102.2
L179.9,102.2 L185.1,102.2 L190.3,102.2 L195.5,108.6 L200.7,130.4 L205.9,147.5 L211.1,161.3 L216.3,172.8
L221.6,182.6 L226.8,191.0 L232.0,198.4 L237.2,204.9 L242.4,210.7 L247.6,216.0 L252.8,220.7 L258.0,225.0
L263.2,229.0 L268.4,232.6 L273.6,236.0 L278.8,239.1 L284.0,242.1 L289.2,244.8 L294.4,247.3 L299.6,249.8
L304.8,252.0 L310.0,254.2 L315.2,256.2 L320.4,258.1 L325.7,259.9 L330.9,261.6 L336.1,263.3 L341.3,264.9
L346.5,266.4 L351.7,267.8 L356.9,269.2 L362.1,270.5 L367.3,271.8 L372.5,273.0 L377.7,274.2 L382.9,275.3
L388.1,276.4 L393.3,277.5 L398.5,278.5 L403.7,279.5 L408.9,280.5 L414.1,281.4 L419.3,282.3 L424.5,283.1
L429.8,284.0 L435.0,284.8 L440.2,285.6 L445.4,286.4 L450.6,287.1 L455.8,287.8 L461.0,288.6 L466.2,289.2
L471.4,289.9 L476.6,290.6 L481.8,291.2 L487.0,291.8 L492.2,292.4 L497.4,293.0 L502.6,293.6 L507.8,294.2
L513.0,294.7 L518.2,295.3 L523.4,295.8 L528.6,296.3 L533.9,296.8 L539.1,297.3 L544.3,297.8 L549.5,298.3
L554.7,298.8 L559.9,299.2 L565.1,299.7 L570.3,300.1 L575.5,300.5 L580.7,300.9 '></path>
</g>
<g style="fill:none; color:black; stroke:currentColor; stroke-width:1.00; stroke-linecap:butt; stroke-linejoin:miter">
<path d='M65.4,49.2 L65.4,367.2 L580.7,367.2 L580.7,49.2 L65.4,49.2 Z '></path>
</g>
</svg>

After

Width:  |  Height:  |  Size: 14 KiB

View File

@ -0,0 +1,67 @@
#
# 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.
#
# ####################################################################
#
# Instructions for generating SVG renderings of the functions
# used in SweetSpotSimilarity
#
# ####################################################################
#
#
set terminal svg size 600,400 dynamic enhanced fname 'arial' fsize 11 butt solid
set key inside left top vertical Right noreverse enhanced autotitles box linetype -1 linewidth 1.000
#
# ####### BASELINE TF
#
set output 'ss.baselineTf.svg'
set title "SweetSpotSimilarity.baselineTf(x)"
set xrange [0:20]
set yrange [-1:8]
btf(base,min,x)=(x <= min) ? base : sqrt(x+(base**2)-min)
#
plot btf(0,0,x) ti "all defaults", \
btf(1.5,0,x) ti "base=1.5", \
btf(0,5,x) ti "min=5", \
btf(1.5,5,x) ti "min=5, base=1.5"
#
# ####### HYPERBOLIC TF
#
set output 'ss.hyperbolicTf.svg'
set title "SweetSpotSimilarity.hyperbolcTf(x)"
set xrange [0:20]
set yrange [0:3]
htf(min,max,base,xoffset,x)=min+(max-min)/2*(((base**(x-xoffset)-base**-(x-xoffset))/(base**(x-xoffset)+base**-(x-xoffset)))+1)
#
plot htf(0,2,1.3,10,x) ti "all defaults", \
htf(0,2,1.3,5,x) ti "xoffset=5", \
htf(0,2,1.2,10,x) ti "base=1.2", \
htf(0,1.5,1.3,10,x) ti "max=1.5"
#
# ####### LENGTH NORM
#
set key inside right top
set output 'ss.computeLengthNorm.svg'
set title "SweetSpotSimilarity.computeLengthNorm(t)"
set xrange [0:20]
set yrange [0:1.2]
set mxtics 5
cln(min,max,steepness,x)=1/sqrt( steepness * (abs(x-min) + abs(x-max) - (max-min)) + 1 )
#
plot cln(1,1,0.5,x) ti "all defaults", \
cln(1,1,0.2,x) ti "steepness=0.2", \
cln(1,6,0.2,x) ti "max=6, steepness=0.2", \
cln(3,5,0.5,x) ti "min=3, max=5"

View File

@ -0,0 +1,193 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"
"http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg viewBox="0 0 600 400"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink">
<desc>Produced by GNUPLOT 4.2 patchlevel 5 </desc>
<defs>
<circle id='gpDot' r='0.5' stroke-width='0.5'/>
<path id='gpPt0' stroke-width='0.244' stroke='currentColor' d='M-1,0 h2 M0,-1 v2'/>
<path id='gpPt1' stroke-width='0.244' stroke='currentColor' d='M-1,-1 L1,1 M1,-1 L-1,1'/>
<path id='gpPt2' stroke-width='0.244' stroke='currentColor' d='M-1,0 L1,0 M0,-1 L0,1 M-1,-1 L1,1 M-1,1 L1,-1'/>
<rect id='gpPt3' stroke-width='0.244' stroke='currentColor' x='-1' y='-1' width='2' height='2'/>
<rect id='gpPt4' stroke-width='0.244' stroke='currentColor' fill='currentColor' x='-1' y='-1' width='2' height='2'/>
<circle id='gpPt5' stroke-width='0.244' stroke='currentColor' cx='0' cy='0' r='1'/>
<use xlink:href='#gpPt5' id='gpPt6' fill='currentColor' stroke='none'/>
<path id='gpPt7' stroke-width='0.244' stroke='currentColor' d='M0,-1.33 L-1.33,0.67 L1.33,0.67 z'/>
<use xlink:href='#gpPt7' id='gpPt8' fill='currentColor' stroke='none'/>
<use xlink:href='#gpPt7' id='gpPt9' stroke='currentColor' transform='rotate(180)'/>
<use xlink:href='#gpPt9' id='gpPt10' fill='currentColor' stroke='none'/>
<use xlink:href='#gpPt3' id='gpPt11' stroke='currentColor' transform='rotate(45)'/>
<use xlink:href='#gpPt11' id='gpPt12' fill='currentColor' stroke='none'/>
</defs>
<g style="fill:none; color:white; stroke:currentColor; stroke-width:1.00; stroke-linecap:butt; stroke-linejoin:miter">
</g>
<g style="fill:none; color:black; stroke:currentColor; stroke-width:1.00; stroke-linecap:butt; stroke-linejoin:miter">
<path d='M65.4,367.2 L73.6,367.2 M580.7,367.2 L572.5,367.2 '></path>
<g transform="translate(57.7,371.3)" style="stroke:none; fill:black; font-family:arial; font-size:11.00pt; text-anchor:end">
<text><tspan> 0</tspan>
</text>
</g>
<path d='M65.4,314.2 L73.6,314.2 M580.7,314.2 L572.5,314.2 '></path>
<g transform="translate(57.7,318.3)" style="stroke:none; fill:black; font-family:arial; font-size:11.00pt; text-anchor:end">
<text><tspan> 0.5</tspan>
</text>
</g>
<path d='M65.4,261.2 L73.6,261.2 M580.7,261.2 L572.5,261.2 '></path>
<g transform="translate(57.7,265.3)" style="stroke:none; fill:black; font-family:arial; font-size:11.00pt; text-anchor:end">
<text><tspan> 1</tspan>
</text>
</g>
<path d='M65.4,208.2 L73.6,208.2 M580.7,208.2 L572.5,208.2 '></path>
<g transform="translate(57.7,212.3)" style="stroke:none; fill:black; font-family:arial; font-size:11.00pt; text-anchor:end">
<text><tspan> 1.5</tspan>
</text>
</g>
<path d='M65.4,155.2 L73.6,155.2 M580.7,155.2 L572.5,155.2 '></path>
<g transform="translate(57.7,159.3)" style="stroke:none; fill:black; font-family:arial; font-size:11.00pt; text-anchor:end">
<text><tspan> 2</tspan>
</text>
</g>
<path d='M65.4,102.2 L73.6,102.2 M580.7,102.2 L572.5,102.2 '></path>
<g transform="translate(57.7,106.3)" style="stroke:none; fill:black; font-family:arial; font-size:11.00pt; text-anchor:end">
<text><tspan> 2.5</tspan>
</text>
</g>
<path d='M65.4,49.2 L73.6,49.2 M580.7,49.2 L572.5,49.2 '></path>
<g transform="translate(57.7,53.3)" style="stroke:none; fill:black; font-family:arial; font-size:11.00pt; text-anchor:end">
<text><tspan> 3</tspan>
</text>
</g>
<path d='M65.4,367.2 L65.4,359.0 M65.4,49.2 L65.4,57.4 '></path>
<g transform="translate(65.4,387.7)" style="stroke:none; fill:black; font-family:arial; font-size:11.00pt; text-anchor:middle">
<text><tspan> 0</tspan>
</text>
</g>
<path d='M194.2,367.2 L194.2,359.0 M194.2,49.2 L194.2,57.4 '></path>
<g transform="translate(194.2,387.7)" style="stroke:none; fill:black; font-family:arial; font-size:11.00pt; text-anchor:middle">
<text><tspan> 5</tspan>
</text>
</g>
<path d='M323.1,367.2 L323.1,359.0 M323.1,49.2 L323.1,57.4 '></path>
<g transform="translate(323.1,387.7)" style="stroke:none; fill:black; font-family:arial; font-size:11.00pt; text-anchor:middle">
<text><tspan> 10</tspan>
</text>
</g>
<path d='M451.9,367.2 L451.9,359.0 M451.9,49.2 L451.9,57.4 '></path>
<g transform="translate(451.9,387.7)" style="stroke:none; fill:black; font-family:arial; font-size:11.00pt; text-anchor:middle">
<text><tspan> 15</tspan>
</text>
</g>
<path d='M580.7,367.2 L580.7,359.0 M580.7,49.2 L580.7,57.4 '></path>
<g transform="translate(580.7,387.7)" style="stroke:none; fill:black; font-family:arial; font-size:11.00pt; text-anchor:middle">
<text><tspan> 20</tspan>
</text>
</g>
<path d='M65.4,49.2 L65.4,367.2 L580.7,367.2 L580.7,49.2 L65.4,49.2 Z '></path>
<g transform="translate(323.0,28.7)" style="stroke:none; fill:black; font-family:arial; font-size:11.00pt; text-anchor:middle">
<text><tspan>SweetSpotSimilarity.hyperbolcTf(x)</tspan>
</text>
</g>
<path d='M73.1,123.0 L73.1,57.4 L219.9,57.4 L219.9,123.0 L73.1,123.0 Z '></path>
<path d='M73.1,57.4 L219.9,57.4 '></path>
</g>
<g style="fill:none; color:red; stroke:currentColor; stroke-width:1.00; stroke-linecap:butt; stroke-linejoin:miter">
</g>
<g style="fill:none; color:black; stroke:currentColor; stroke-width:1.00; stroke-linecap:butt; stroke-linejoin:miter">
<g transform="translate(165.5,69.7)" style="stroke:none; fill:black; font-family:arial; font-size:11.00pt; text-anchor:end">
<text><tspan>all defaults</tspan>
</text>
</g>
</g>
<g style="fill:none; color:red; stroke:currentColor; stroke-width:1.00; stroke-linecap:butt; stroke-linejoin:miter">
<path d='M173.2,65.6 L212.2,65.6 M65.4,366.1 L70.6,366.0 L75.8,365.8 L81.0,365.7 L86.2,365.5 L91.4,365.3
L96.6,365.1 L101.8,364.9 L107.0,364.6 L112.2,364.3 L117.5,364.0 L122.7,363.7 L127.9,363.3 L133.1,362.9
L138.3,362.4 L143.5,361.9 L148.7,361.3 L153.9,360.6 L159.1,359.9 L164.3,359.2 L169.5,358.3 L174.7,357.3
L179.9,356.3 L185.1,355.2 L190.3,353.9 L195.5,352.5 L200.7,351.0 L205.9,349.3 L211.1,347.5 L216.3,345.5
L221.6,343.4 L226.8,341.1 L232.0,338.5 L237.2,335.8 L242.4,332.8 L247.6,329.7 L252.8,326.3 L258.0,322.7
L263.2,318.8 L268.4,314.8 L273.6,310.5 L278.8,306.0 L284.0,301.2 L289.2,296.3 L294.4,291.3 L299.6,286.0
L304.8,280.6 L310.0,275.2 L315.2,269.6 L320.4,264.0 L325.7,258.4 L330.9,252.8 L336.1,247.2 L341.3,241.8
L346.5,236.4 L351.7,231.1 L356.9,226.1 L362.1,221.2 L367.3,216.4 L372.5,211.9 L377.7,207.6 L382.9,203.6
L388.1,199.7 L393.3,196.1 L398.5,192.7 L403.7,189.6 L408.9,186.6 L414.1,183.9 L419.3,181.3 L424.5,179.0
L429.8,176.9 L435.0,174.9 L440.2,173.1 L445.4,171.4 L450.6,169.9 L455.8,168.5 L461.0,167.2 L466.2,166.1
L471.4,165.1 L476.6,164.1 L481.8,163.2 L487.0,162.5 L492.2,161.8 L497.4,161.1 L502.6,160.5 L507.8,160.0
L513.0,159.5 L518.2,159.1 L523.4,158.7 L528.6,158.4 L533.9,158.1 L539.1,157.8 L544.3,157.5 L549.5,157.3
L554.7,157.1 L559.9,156.9 L565.1,156.7 L570.3,156.6 L575.5,156.4 L580.7,156.3 '></path>
</g>
<g style="fill:none; color:green; stroke:currentColor; stroke-width:1.00; stroke-linecap:butt; stroke-linejoin:miter">
</g>
<g style="fill:none; color:black; stroke:currentColor; stroke-width:1.00; stroke-linecap:butt; stroke-linejoin:miter">
<g transform="translate(165.5,86.1)" style="stroke:none; fill:black; font-family:arial; font-size:11.00pt; text-anchor:end">
<text><tspan>xoffset=5</tspan>
</text>
</g>
</g>
<g style="fill:none; color:green; stroke:currentColor; stroke-width:1.00; stroke-linecap:butt; stroke-linejoin:miter">
<path d='M173.2,82.0 L212.2,82.0 M65.4,352.9 L70.6,351.4 L75.8,349.8 L81.0,348.0 L86.2,346.0 L91.4,343.9
L96.6,341.7 L101.8,339.2 L107.0,336.5 L112.2,333.6 L117.5,330.5 L122.7,327.2 L127.9,323.6 L133.1,319.8
L138.3,315.8 L143.5,311.6 L148.7,307.1 L153.9,302.4 L159.1,297.6 L164.3,292.5 L169.5,287.3 L174.7,282.0
L179.9,276.5 L185.1,271.0 L190.3,265.4 L195.5,259.8 L200.7,254.2 L205.9,248.6 L211.1,243.1 L216.3,237.7
L221.6,232.4 L226.8,227.3 L232.0,222.4 L237.2,217.6 L242.4,213.0 L247.6,208.7 L252.8,204.6 L258.0,200.7
L263.2,197.0 L268.4,193.5 L273.6,190.3 L278.8,187.3 L284.0,184.5 L289.2,182.0 L294.4,179.6 L299.6,177.4
L304.8,175.4 L310.0,173.5 L315.2,171.8 L320.4,170.3 L325.7,168.8 L330.9,167.6 L336.1,166.4 L341.3,165.3
L346.5,164.3 L351.7,163.5 L356.9,162.6 L362.1,161.9 L367.3,161.3 L372.5,160.7 L377.7,160.1 L382.9,159.6
L388.1,159.2 L393.3,158.8 L398.5,158.5 L403.7,158.1 L408.9,157.8 L414.1,157.6 L419.3,157.3 L424.5,157.1
L429.8,156.9 L435.0,156.8 L440.2,156.6 L445.4,156.5 L450.6,156.3 L455.8,156.2 L461.0,156.1 L466.2,156.0
L471.4,155.9 L476.6,155.9 L481.8,155.8 L487.0,155.7 L492.2,155.7 L497.4,155.6 L502.6,155.6 L507.8,155.6
L513.0,155.5 L518.2,155.5 L523.4,155.5 L528.6,155.4 L533.9,155.4 L539.1,155.4 L544.3,155.4 L549.5,155.4
L554.7,155.3 L559.9,155.3 L565.1,155.3 L570.3,155.3 L575.5,155.3 L580.7,155.3 '></path>
</g>
<g style="fill:none; color:blue; stroke:currentColor; stroke-width:1.00; stroke-linecap:butt; stroke-linejoin:miter">
</g>
<g style="fill:none; color:black; stroke:currentColor; stroke-width:1.00; stroke-linecap:butt; stroke-linejoin:miter">
<g transform="translate(165.5,102.5)" style="stroke:none; fill:black; font-family:arial; font-size:11.00pt; text-anchor:end">
<text><tspan>base=1.2</tspan>
</text>
</g>
</g>
<g style="fill:none; color:blue; stroke:currentColor; stroke-width:1.00; stroke-linecap:butt; stroke-linejoin:miter">
<path d='M173.2,98.4 L212.2,98.4 M65.4,361.8 L70.6,361.4 L75.8,361.0 L81.0,360.5 L86.2,360.0 L91.4,359.5
L96.6,358.9 L101.8,358.3 L107.0,357.7 L112.2,357.0 L117.5,356.2 L122.7,355.5 L127.9,354.6 L133.1,353.7
L138.3,352.7 L143.5,351.7 L148.7,350.6 L153.9,349.5 L159.1,348.2 L164.3,346.9 L169.5,345.5 L174.7,344.1
L179.9,342.5 L185.1,340.8 L190.3,339.1 L195.5,337.3 L200.7,335.3 L205.9,333.3 L211.1,331.1 L216.3,328.8
L221.6,326.5 L226.8,324.0 L232.0,321.4 L237.2,318.7 L242.4,315.9 L247.6,313.0 L252.8,310.0 L258.0,306.8
L263.2,303.6 L268.4,300.3 L273.6,296.8 L278.8,293.3 L284.0,289.8 L289.2,286.1 L294.4,282.4 L299.6,278.6
L304.8,274.8 L310.0,270.9 L315.2,267.1 L320.4,263.2 L325.7,259.2 L330.9,255.3 L336.1,251.5 L341.3,247.6
L346.5,243.8 L351.7,240.0 L356.9,236.3 L362.1,232.6 L367.3,229.1 L372.5,225.6 L377.7,222.1 L382.9,218.8
L388.1,215.6 L393.3,212.4 L398.5,209.4 L403.7,206.5 L408.9,203.7 L414.1,201.0 L419.3,198.4 L424.5,195.9
L429.8,193.6 L435.0,191.3 L440.2,189.1 L445.4,187.1 L450.6,185.1 L455.8,183.3 L461.0,181.6 L466.2,179.9
L471.4,178.3 L476.6,176.9 L481.8,175.5 L487.0,174.2 L492.2,172.9 L497.4,171.8 L502.6,170.7 L507.8,169.7
L513.0,168.7 L518.2,167.8 L523.4,166.9 L528.6,166.2 L533.9,165.4 L539.1,164.7 L544.3,164.1 L549.5,163.5
L554.7,162.9 L559.9,162.4 L565.1,161.9 L570.3,161.4 L575.5,161.0 L580.7,160.6 '></path>
</g>
<g style="fill:none; color:cyan; stroke:currentColor; stroke-width:1.00; stroke-linecap:butt; stroke-linejoin:miter">
</g>
<g style="fill:none; color:black; stroke:currentColor; stroke-width:1.00; stroke-linecap:butt; stroke-linejoin:miter">
<g transform="translate(165.5,118.9)" style="stroke:none; fill:black; font-family:arial; font-size:11.00pt; text-anchor:end">
<text><tspan>max=1.5</tspan>
</text>
</g>
</g>
<g style="fill:none; color:cyan; stroke:currentColor; stroke-width:1.00; stroke-linecap:butt; stroke-linejoin:miter">
<path d='M173.2,114.8 L212.2,114.8 M65.4,366.4 L70.6,366.3 L75.8,366.2 L81.0,366.1 L86.2,365.9 L91.4,365.8
L96.6,365.6 L101.8,365.5 L107.0,365.3 L112.2,365.1 L117.5,364.8 L122.7,364.6 L127.9,364.3 L133.1,363.9
L138.3,363.6 L143.5,363.2 L148.7,362.8 L153.9,362.3 L159.1,361.8 L164.3,361.2 L169.5,360.5 L174.7,359.8
L179.9,359.0 L185.1,358.2 L190.3,357.2 L195.5,356.2 L200.7,355.0 L205.9,353.8 L211.1,352.4 L216.3,351.0
L221.6,349.3 L226.8,347.6 L232.0,345.7 L237.2,343.6 L242.4,341.4 L247.6,339.1 L252.8,336.5 L258.0,333.8
L263.2,330.9 L268.4,327.9 L273.6,324.7 L278.8,321.3 L284.0,317.7 L289.2,314.1 L294.4,310.2 L299.6,306.3
L304.8,302.3 L310.0,298.2 L315.2,294.0 L320.4,289.8 L325.7,285.6 L330.9,281.4 L336.1,277.2 L341.3,273.1
L346.5,269.1 L351.7,265.2 L356.9,261.3 L362.1,257.7 L367.3,254.1 L372.5,250.7 L377.7,247.5 L382.9,244.5
L388.1,241.6 L393.3,238.9 L398.5,236.3 L403.7,234.0 L408.9,231.8 L414.1,229.7 L419.3,227.8 L424.5,226.1
L429.8,224.4 L435.0,223.0 L440.2,221.6 L445.4,220.4 L450.6,219.2 L455.8,218.2 L461.0,217.2 L466.2,216.4
L471.4,215.6 L476.6,214.9 L481.8,214.2 L487.0,213.6 L492.2,213.1 L497.4,212.6 L502.6,212.2 L507.8,211.8
L513.0,211.5 L518.2,211.1 L523.4,210.8 L528.6,210.6 L533.9,210.3 L539.1,210.1 L544.3,209.9 L549.5,209.8
L554.7,209.6 L559.9,209.5 L565.1,209.3 L570.3,209.2 L575.5,209.1 L580.7,209.0 '></path>
</g>
<g style="fill:none; color:black; stroke:currentColor; stroke-width:1.00; stroke-linecap:butt; stroke-linejoin:miter">
<path d='M65.4,49.2 L65.4,367.2 L580.7,367.2 L580.7,49.2 L65.4,49.2 Z '></path>
</g>
</svg>

After

Width:  |  Height:  |  Size: 13 KiB

View File

@ -20,8 +20,6 @@ import java.io.File;
import org.apache.lucene.analysis.MockAnalyzer;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.document.StringField;
import org.apache.lucene.index.IndexWriterConfig.OpenMode;
import org.apache.lucene.store.Directory;
import org.apache.lucene.util.LuceneTestCase;

View File

@ -18,6 +18,7 @@ package org.apache.lucene.sandbox.queries;
import org.apache.lucene.index.*;
import org.apache.lucene.search.DocIdSet;
import org.apache.lucene.search.DocIdSetIterator;
import org.apache.lucene.search.Filter;
import org.apache.lucene.util.Bits;
import org.apache.lucene.util.BytesRef;
@ -94,7 +95,7 @@ public class DuplicateFilter extends Filter {
} else {
docs = termsEnum.docs(acceptDocs, docs, false);
int doc = docs.nextDoc();
if (doc != DocsEnum.NO_MORE_DOCS) {
if (doc != DocIdSetIterator.NO_MORE_DOCS) {
if (keepMode == KeepMode.KM_USE_FIRST_OCCURRENCE) {
bits.set(doc);
} else {
@ -102,7 +103,7 @@ public class DuplicateFilter extends Filter {
while (true) {
lastDoc = doc;
doc = docs.nextDoc();
if (doc == DocsEnum.NO_MORE_DOCS) {
if (doc == DocIdSetIterator.NO_MORE_DOCS) {
break;
}
}
@ -134,7 +135,7 @@ public class DuplicateFilter extends Filter {
// unset potential duplicates
docs = termsEnum.docs(acceptDocs, docs, false);
int doc = docs.nextDoc();
if (doc != DocsEnum.NO_MORE_DOCS) {
if (doc != DocIdSetIterator.NO_MORE_DOCS) {
if (keepMode == KeepMode.KM_USE_FIRST_OCCURRENCE) {
doc = docs.nextDoc();
}
@ -145,7 +146,7 @@ public class DuplicateFilter extends Filter {
lastDoc = doc;
bits.clear(lastDoc);
doc = docs.nextDoc();
if (doc == DocsEnum.NO_MORE_DOCS) {
if (doc == DocIdSetIterator.NO_MORE_DOCS) {
break;
}
}

View File

@ -90,7 +90,7 @@ public final class SlowCollatedStringComparator extends FieldComparator<String>
}
@Override
public FieldComparator setNextReader(AtomicReaderContext context) throws IOException {
public FieldComparator<String> setNextReader(AtomicReaderContext context) throws IOException {
currentDocTerms = FieldCache.DEFAULT.getTerms(context.reader(), field);
return this;
}

View File

@ -25,6 +25,7 @@ import org.apache.lucene.document.Document;
import org.apache.lucene.document.StringField;
import org.apache.lucene.document.TextField;
import org.apache.lucene.index.*;
import org.apache.lucene.search.DocIdSetIterator;
import org.apache.lucene.search.IndexSearcher;
import org.apache.lucene.search.ScoreDoc;
import org.apache.lucene.search.TermQuery;
@ -142,7 +143,7 @@ public class DuplicateFilterTest extends LuceneTestCase {
false);
int lastDoc = 0;
while (td.nextDoc() != DocsEnum.NO_MORE_DOCS) {
while (td.nextDoc() != DocIdSetIterator.NO_MORE_DOCS) {
lastDoc = td.docID();
}
assertEquals("Duplicate urls should return last doc", lastDoc, hit.doc);

View File

@ -91,7 +91,7 @@ public class TestSlowCollationMethods extends LuceneTestCase {
public void testSort() throws Exception {
SortField sf = new SortField("field", new FieldComparatorSource() {
@Override
public FieldComparator newComparator(String fieldname, int numHits, int sortPos, boolean reversed) throws IOException {
public FieldComparator<String> newComparator(String fieldname, int numHits, int sortPos, boolean reversed) throws IOException {
return new SlowCollatedStringComparator(numHits, fieldname, collator);
}
});

View File

@ -83,31 +83,4 @@ public class TestSpanRegexQuery extends LuceneTestCase {
reader.close();
directory.close();
}
private void createRAMDirectories() throws CorruptIndexException,
LockObtainFailedException, IOException {
// creating a document to store
Document lDoc = new Document();
FieldType customType = new FieldType(TextField.TYPE_UNSTORED);
customType.setOmitNorms(true);
lDoc.add(newField("field", "a1 b1", customType));
// creating a document to store
Document lDoc2 = new Document();
lDoc2.add(newField("field", "a2 b2", customType));
// creating first index writer
IndexWriter writerA = new IndexWriter(indexStoreA, newIndexWriterConfig(
TEST_VERSION_CURRENT, new MockAnalyzer(random)).setOpenMode(OpenMode.CREATE));
writerA.addDocument(lDoc);
writerA.forceMerge(1);
writerA.close();
// creating second index writer
IndexWriter writerB = new IndexWriter(indexStoreB, newIndexWriterConfig(
TEST_VERSION_CURRENT, new MockAnalyzer(random)).setOpenMode(OpenMode.CREATE));
writerB.addDocument(lDoc2);
writerB.forceMerge(1);
writerB.close();
}
}

View File

@ -52,9 +52,10 @@ public class PositionIncrementAttributeImpl extends AttributeImpl implements Pos
* @param positionIncrement the distance from the prior term
*/
public void setPositionIncrement(int positionIncrement) {
if (positionIncrement < 0)
if (positionIncrement < 0) {
throw new IllegalArgumentException
("Increment must be zero or greater: " + positionIncrement);
("Increment must be zero or greater: got " + positionIncrement);
}
this.positionIncrement = positionIncrement;
}
@ -77,7 +78,8 @@ public class PositionIncrementAttributeImpl extends AttributeImpl implements Pos
}
if (other instanceof PositionIncrementAttributeImpl) {
return positionIncrement == ((PositionIncrementAttributeImpl) other).positionIncrement;
PositionIncrementAttributeImpl _other = (PositionIncrementAttributeImpl) other;
return positionIncrement == _other.positionIncrement;
}
return false;
@ -93,5 +95,4 @@ public class PositionIncrementAttributeImpl extends AttributeImpl implements Pos
PositionIncrementAttribute t = (PositionIncrementAttribute) target;
t.setPositionIncrement(positionIncrement);
}
}

View File

@ -1,4 +1,4 @@
package org.apache.solr.uima.processor.ae;
package org.apache.lucene.analysis.tokenattributes;
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
@ -17,16 +17,25 @@ package org.apache.solr.uima.processor.ae;
* limitations under the License.
*/
import org.apache.uima.analysis_engine.AnalysisEngine;
import org.apache.uima.resource.ResourceInitializationException;
import org.apache.lucene.util.Attribute;
/**
* provide an Apache UIMA {@link AnalysisEngine}
*
/** The positionLength determines how many positions this
* token spans. Very few analyzer components actually
* produce this attribute, and indexing ignores it, but
* it's useful to express the graph structure naturally
* produced by decompounding, word splitting/joining,
* synonym filtering, etc.
*
*/
public interface AEProvider {
* <p>The default value is one. */
public AnalysisEngine getAE() throws ResourceInitializationException;
public interface PositionLengthAttribute extends Attribute {
/** @param positionLength how many positions this token
* spans. */
public void setPositionLength(int positionLength);
/** Returns the position length of this Token.
* @see #setPositionLength
*/
public int getPositionLength();
}

View File

@ -0,0 +1,73 @@
package org.apache.lucene.analysis.tokenattributes;
/**
* 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.
*/
import org.apache.lucene.util.AttributeImpl;
/** See {@link PositionLengthAttribute}. */
public class PositionLengthAttributeImpl extends AttributeImpl implements PositionLengthAttribute, Cloneable {
private int positionLength = 1;
/** @param positionLength how many positions this token
* spans. NOTE: this is optional, and most analyzers
* don't change the default value (1). */
public void setPositionLength(int positionLength) {
if (positionLength < 1) {
throw new IllegalArgumentException
("Position length must be 1 or greater: got " + positionLength);
}
this.positionLength = positionLength;
}
/** Returns the position length of this Token.
* @see #setPositionLength
*/
public int getPositionLength() {
return positionLength;
}
@Override
public void clear() {
this.positionLength = 1;
}
@Override
public boolean equals(Object other) {
if (other == this) {
return true;
}
if (other instanceof PositionLengthAttributeImpl) {
PositionLengthAttributeImpl _other = (PositionLengthAttributeImpl) other;
return positionLength == _other.positionLength;
}
return false;
}
@Override
public int hashCode() {
return positionLength;
}
@Override
public void copyTo(AttributeImpl target) {
PositionLengthAttribute t = (PositionLengthAttribute) target;
t.setPositionLength(positionLength);
}
}

View File

@ -778,9 +778,6 @@ public class BlockTermsReader extends FieldsProducer {
return state.ord;
}
private void doPendingSeek() {
}
/* Does initial decode of next block of terms; this
doesn't actually decode the docFreq, totalTermFreq,
postings details (frq/prx offset, etc.) metadata;

View File

@ -35,7 +35,6 @@ import org.apache.lucene.index.IndexFileNames;
import org.apache.lucene.index.SegmentInfo;
import org.apache.lucene.index.TermState;
import org.apache.lucene.index.Terms;
import org.apache.lucene.index.TermsEnum.SeekStatus;
import org.apache.lucene.index.TermsEnum;
import org.apache.lucene.store.ByteArrayDataInput;
import org.apache.lucene.store.Directory;
@ -488,7 +487,7 @@ public class BlockTreeTermsReader extends FieldsProducer {
private Frame[] stack;
@SuppressWarnings("unchecked") private FST.Arc<BytesRef>[] arcs = new FST.Arc[5];
@SuppressWarnings({"rawtypes","unchecked"}) private FST.Arc<BytesRef>[] arcs = new FST.Arc[5];
private final RunAutomaton runAutomaton;
private final CompiledAutomaton compiledAutomaton;
@ -821,7 +820,8 @@ public class BlockTreeTermsReader extends FieldsProducer {
private FST.Arc<BytesRef> getArc(int ord) {
if (ord >= arcs.length) {
@SuppressWarnings("unchecked") final FST.Arc<BytesRef>[] next = new FST.Arc[ArrayUtil.oversize(1+ord, RamUsageEstimator.NUM_BYTES_OBJECT_REF)];
@SuppressWarnings({"rawtypes","unchecked"}) final FST.Arc<BytesRef>[] next =
new FST.Arc[ArrayUtil.oversize(1+ord, RamUsageEstimator.NUM_BYTES_OBJECT_REF)];
System.arraycopy(arcs, 0, next, 0, arcs.length);
for(int arcOrd=arcs.length;arcOrd<next.length;arcOrd++) {
next[arcOrd] = new FST.Arc<BytesRef>();
@ -1198,7 +1198,8 @@ public class BlockTreeTermsReader extends FieldsProducer {
final BytesRef term = new BytesRef();
private final FST.BytesReader fstReader;
@SuppressWarnings("unchecked") private FST.Arc<BytesRef>[] arcs = new FST.Arc[1];
@SuppressWarnings({"rawtypes","unchecked"}) private FST.Arc<BytesRef>[] arcs =
new FST.Arc[1];
public SegmentTermsEnum() throws IOException {
//if (DEBUG) System.out.println("BTTR.init seg=" + segment);
@ -1354,7 +1355,8 @@ public class BlockTreeTermsReader extends FieldsProducer {
private FST.Arc<BytesRef> getArc(int ord) {
if (ord >= arcs.length) {
@SuppressWarnings("unchecked") final FST.Arc<BytesRef>[] next = new FST.Arc[ArrayUtil.oversize(1+ord, RamUsageEstimator.NUM_BYTES_OBJECT_REF)];
@SuppressWarnings({"rawtypes","unchecked"}) final FST.Arc<BytesRef>[] next =
new FST.Arc[ArrayUtil.oversize(1+ord, RamUsageEstimator.NUM_BYTES_OBJECT_REF)];
System.arraycopy(arcs, 0, next, 0, arcs.length);
for(int arcOrd=arcs.length;arcOrd<next.length;arcOrd++) {
next[arcOrd] = new FST.Arc<BytesRef>();
@ -1944,6 +1946,7 @@ public class BlockTreeTermsReader extends FieldsProducer {
}
}
@SuppressWarnings("unused")
private void printSeekState() throws IOException {
if (currentFrame == staticFrame) {
System.out.println(" no prior seek");

View File

@ -640,7 +640,7 @@ public class BlockTreeTermsWriter extends FieldsConsumer {
// for debugging
@SuppressWarnings("unused")
private String toString(BytesRef b) {
private String toString(BytesRef b) {
try {
return b.utf8ToString() + " " + b;
} catch (Throwable t) {

View File

@ -21,13 +21,9 @@ import java.io.Closeable;
import java.io.IOException;
import org.apache.lucene.index.Fields;
import org.apache.lucene.index.FieldsEnum;
import org.apache.lucene.index.Terms;
/** Abstract API that consumes terms, doc, freq, prox and
* payloads postings. Concrete implementations of this
* actually do "something" with the postings (write it into
* the index in a specific format).
/** Abstract API that produces terms, doc, freq, prox and
* payloads postings.
*
* @lucene.experimental
*/

View File

@ -227,8 +227,6 @@ public class FixedGapTermsIndexReader extends TermsIndexReaderBase {
private final class FieldIndexData {
final private FieldInfo fieldInfo;
volatile CoreFieldIndex coreIndex;
private final long indexStart;
@ -241,7 +239,6 @@ public class FixedGapTermsIndexReader extends TermsIndexReaderBase {
public FieldIndexData(FieldInfo fieldInfo, int numIndexTerms, long indexStart, long termsStart, long packedIndexStart,
long packedOffsetsStart) throws IOException {
this.fieldInfo = fieldInfo;
this.termsStart = termsStart;
this.indexStart = indexStart;
this.packedIndexStart = packedIndexStart;

View File

@ -53,7 +53,8 @@ public class FixedGapTermsIndexWriter extends TermsIndexWriterBase {
final private int termIndexInterval;
private final List<SimpleFieldWriter> fields = new ArrayList<SimpleFieldWriter>();
private final FieldInfos fieldInfos; // unread
@SuppressWarnings("unused") private final FieldInfos fieldInfos; // unread
public FixedGapTermsIndexWriter(SegmentWriteState state) throws IOException {
final String indexFileName = IndexFileNames.segmentFileName(state.segmentName, state.segmentSuffix, TERMS_INDEX_EXTENSION);

View File

@ -22,7 +22,6 @@ import java.io.IOException;
import java.util.Comparator;
import org.apache.lucene.index.DocsAndPositionsEnum;
import org.apache.lucene.index.DocsEnum;
import org.apache.lucene.index.FieldInfo;
import org.apache.lucene.index.FieldInfos;
import org.apache.lucene.index.Fields;
@ -30,6 +29,7 @@ import org.apache.lucene.index.FieldsEnum;
import org.apache.lucene.index.MergeState;
import org.apache.lucene.index.Terms;
import org.apache.lucene.index.TermsEnum;
import org.apache.lucene.search.DocIdSetIterator;
import org.apache.lucene.store.DataInput;
import org.apache.lucene.util.Bits;
import org.apache.lucene.util.BytesRef;
@ -236,7 +236,7 @@ public abstract class TermVectorsWriter implements Closeable {
if (docsAndPositionsEnum != null) {
final int docID = docsAndPositionsEnum.nextDoc();
assert docID != DocsEnum.NO_MORE_DOCS;
assert docID != DocIdSetIterator.NO_MORE_DOCS;
assert docsAndPositionsEnum.freq() == freq;
for(int posUpto=0; posUpto<freq; posUpto++) {

View File

@ -22,7 +22,6 @@ import org.apache.lucene.util.BytesRef;
import java.io.IOException;
import java.io.Closeable;
import java.util.Collection;
// TODO

View File

@ -54,7 +54,8 @@ public class VariableGapTermsIndexWriter extends TermsIndexWriterBase {
final static int VERSION_CURRENT = VERSION_START;
private final List<FSTFieldWriter> fields = new ArrayList<FSTFieldWriter>();
private final FieldInfos fieldInfos; // unread
@SuppressWarnings("unused") private final FieldInfos fieldInfos; // unread
private final IndexTermSelector policy;
/** @lucene.experimental */
@ -214,7 +215,6 @@ public class VariableGapTermsIndexWriter extends TermsIndexWriterBase {
private final long startTermsFilePointer;
final FieldInfo fieldInfo;
int numIndexTerms;
FST<Long> fst;
final long indexStart;

View File

@ -32,7 +32,6 @@ import org.apache.lucene.codecs.lucene40.Lucene40PostingsWriter;
import org.apache.lucene.index.SegmentInfo;
import org.apache.lucene.index.SegmentReadState;
import org.apache.lucene.index.SegmentWriteState;
import org.apache.lucene.store.Directory;
/**
* Appending postings impl

View File

@ -63,6 +63,7 @@ final class VarSortedBytesImpl {
this.comp = comp;
size = 0;
}
@Override
public void merge(MergeState mergeState, DocValues[] docValues)
throws IOException {

View File

@ -387,7 +387,7 @@ public class SimpleTextTermVectorsReader extends TermVectorsReader {
}
@Override
public Comparator<BytesRef> getComparator() throws IOException {
public Comparator<BytesRef> getComparator() {
return BytesRef.getUTF8SortedAsUnicodeComparator();
}
}

View File

@ -20,7 +20,6 @@ package org.apache.lucene.index;
import java.io.IOException;
import org.apache.lucene.search.SearcherManager; // javadocs
import org.apache.lucene.store.*;
import org.apache.lucene.util.Bits;
import org.apache.lucene.util.BytesRef;
import org.apache.lucene.util.ReaderUtil; // for javadocs

View File

@ -22,25 +22,51 @@ import java.io.IOException;
import org.apache.lucene.util.BytesRef;
import org.apache.lucene.util.ReaderUtil;
abstract class BaseMultiReader<R extends IndexReader> extends CompositeReader {
/** Base class for implementing {@link CompositeReader}s based on an array
* of sub-readers. The implementing class has to add code for
* correctly refcounting and closing the sub-readers.
*
* <p>User code will most likely use {@link MultiReader} to build a
* composite reader on a set of sub-readers (like several
* {@link DirectoryReader}s).
*
* <p> For efficiency, in this API documents are often referred to via
* <i>document numbers</i>, non-negative integers which each name a unique
* document in the index. These document numbers are ephemeral -- they may change
* as documents are added to and deleted from an index. Clients should thus not
* rely on a given document having the same number between sessions.
*
* <p><a name="thread-safety"></a><p><b>NOTE</b>: {@link
* IndexReader} instances are completely thread
* safe, meaning multiple threads can call any of its methods,
* concurrently. If your application requires external
* synchronization, you should <b>not</b> synchronize on the
* <code>IndexReader</code> instance; use your own
* (non-Lucene) objects instead.
* @see MultiReader
* @lucene.internal
*/
public abstract class BaseCompositeReader<R extends IndexReader> extends CompositeReader {
protected final R[] subReaders;
protected final int[] starts; // 1st docno for each reader
private final int maxDoc;
private final int numDocs;
private final boolean hasDeletions;
protected BaseMultiReader(R[] subReaders) throws IOException {
protected BaseCompositeReader(R[] subReaders) throws IOException {
this.subReaders = subReaders;
starts = new int[subReaders.length + 1]; // build starts array
int maxDoc = 0, numDocs = 0;
boolean hasDeletions = false;
for (int i = 0; i < subReaders.length; i++) {
starts[i] = maxDoc;
maxDoc += subReaders[i].maxDoc(); // compute maxDocs
numDocs += subReaders[i].numDocs(); // compute numDocs
if (subReaders[i].hasDeletions()) {
final IndexReader r = subReaders[i];
maxDoc += r.maxDoc(); // compute maxDocs
numDocs += r.numDocs(); // compute numDocs
if (r.hasDeletions()) {
hasDeletions = true;
}
r.registerParentReader(this);
}
starts[subReaders.length] = maxDoc;
this.maxDoc = maxDoc;
@ -51,8 +77,8 @@ abstract class BaseMultiReader<R extends IndexReader> extends CompositeReader {
@Override
public final Fields getTermVectors(int docID) throws IOException {
ensureOpen();
final int i = readerIndex(docID); // find segment num
return subReaders[i].getTermVectors(docID - starts[i]); // dispatch to segment
final int i = readerIndex(docID); // find subreader num
return subReaders[i].getTermVectors(docID - starts[i]); // dispatch to subreader
}
@Override
@ -70,8 +96,8 @@ abstract class BaseMultiReader<R extends IndexReader> extends CompositeReader {
@Override
public final void document(int docID, StoredFieldVisitor visitor) throws CorruptIndexException, IOException {
ensureOpen();
final int i = readerIndex(docID); // find segment num
subReaders[i].document(docID - starts[i], visitor); // dispatch to segment reader
final int i = readerIndex(docID); // find subreader num
subReaders[i].document(docID - starts[i], visitor); // dispatch to subreader
}
@Override
@ -83,7 +109,7 @@ abstract class BaseMultiReader<R extends IndexReader> extends CompositeReader {
@Override
public final int docFreq(String field, BytesRef t) throws IOException {
ensureOpen();
int total = 0; // sum freqs in segments
int total = 0; // sum freqs in subreaders
for (int i = 0; i < subReaders.length; i++) {
total += subReaders[i].docFreq(field, t);
}

View File

@ -401,7 +401,7 @@ class BufferedDeletesStream {
while (true) {
final int docID = docsEnum.nextDoc();
//System.out.println(Thread.currentThread().getName() + " del term=" + term + " doc=" + docID);
if (docID == DocsEnum.NO_MORE_DOCS) {
if (docID == DocIdSetIterator.NO_MORE_DOCS) {
break;
}
// NOTE: there is no limit check on the docID

View File

@ -576,7 +576,7 @@ public class CheckIndex {
segInfoStat.fieldNormStatus = testFieldNorms(fieldInfos, reader);
// Test the Term Index
segInfoStat.termIndexStatus = testPostings(reader);
segInfoStat.termIndexStatus = testPostings(fieldInfos, reader);
// Test Stored Fields
segInfoStat.storedFieldStatus = testStoredFields(info, reader, nf);
@ -691,7 +691,7 @@ public class CheckIndex {
/**
* Test the term index.
*/
private Status.TermIndexStatus testPostings(SegmentReader reader) {
private Status.TermIndexStatus testPostings(FieldInfos fieldInfos, SegmentReader reader) {
// TODO: we should go and verify term vectors match, if
// crossCheckTermVectors is on...
@ -720,15 +720,31 @@ public class CheckIndex {
DocsEnum docsAndFreqs = null;
DocsAndPositionsEnum postings = null;
String lastField = null;
final FieldsEnum fieldsEnum = fields.iterator();
while(true) {
final String field = fieldsEnum.next();
if (field == null) {
break;
}
// MultiFieldsEnum relies upon this order...
if (lastField != null && field.compareTo(lastField) <= 0) {
throw new RuntimeException("fields out of order: lastField=" + lastField + " field=" + field);
}
lastField = field;
// check that the field is in fieldinfos, and is indexed.
// TODO: add a separate test to check this for different reader impls
FieldInfo fi = fieldInfos.fieldInfo(field);
if (fi == null) {
throw new RuntimeException("fieldsEnum inconsistent with fieldInfos, no fieldInfos for: " + field);
}
if (!fi.isIndexed) {
throw new RuntimeException("fieldsEnum inconsistent with fieldInfos, isIndexed == false for: " + field);
}
// TODO: really the codec should not return a field
// from FieldsEnum if it has to Terms... but we do
// from FieldsEnum if it has no Terms... but we do
// this today:
// assert fields.terms(field) != null;
computedFieldCount++;
@ -909,7 +925,7 @@ public class CheckIndex {
final int skipDocID = (int) (((idx+1)*(long) maxDoc)/8);
postings = termsEnum.docsAndPositions(liveDocs, postings, false);
final int docID = postings.advance(skipDocID);
if (docID == DocsEnum.NO_MORE_DOCS) {
if (docID == DocIdSetIterator.NO_MORE_DOCS) {
break;
} else {
if (docID < skipDocID) {
@ -932,7 +948,7 @@ public class CheckIndex {
}
final int nextDocID = postings.nextDoc();
if (nextDocID == DocsEnum.NO_MORE_DOCS) {
if (nextDocID == DocIdSetIterator.NO_MORE_DOCS) {
break;
}
if (nextDocID <= docID) {
@ -945,14 +961,14 @@ public class CheckIndex {
final int skipDocID = (int) (((idx+1)*(long) maxDoc)/8);
docs = termsEnum.docs(liveDocs, docs, false);
final int docID = docs.advance(skipDocID);
if (docID == DocsEnum.NO_MORE_DOCS) {
if (docID == DocIdSetIterator.NO_MORE_DOCS) {
break;
} else {
if (docID < skipDocID) {
throw new RuntimeException("term " + term + ": advance(docID=" + skipDocID + ") returned docID=" + docID);
}
final int nextDocID = docs.nextDoc();
if (nextDocID == DocsEnum.NO_MORE_DOCS) {
if (nextDocID == DocIdSetIterator.NO_MORE_DOCS) {
break;
}
if (nextDocID <= docID) {
@ -1051,7 +1067,7 @@ public class CheckIndex {
throw new RuntimeException("null DocsEnum from to existing term " + seekTerms[i]);
}
while(docs.nextDoc() != DocsEnum.NO_MORE_DOCS) {
while(docs.nextDoc() != DocIdSetIterator.NO_MORE_DOCS) {
totDocCount++;
}
}

View File

@ -488,19 +488,6 @@ public class ConcurrentMergeScheduler extends MergeScheduler {
}
}
}
@Override
public String toString() {
MergePolicy.OneMerge merge = getRunningMerge();
if (merge == null) {
merge = startMerge;
}
try {
return "merge thread: " + tWriter.segString(merge.segments);
} catch (IOException ioe) {
throw new RuntimeException(ioe);
}
}
}
/** Called when an exception is hit in a background merge

View File

@ -48,13 +48,8 @@ import org.apache.lucene.store.Directory;
synchronization, you should <b>not</b> synchronize on the
<code>IndexReader</code> instance; use your own
(non-Lucene) objects instead.
<p><em>Please note:</em> This class extends from an internal (invisible)
superclass that is generic: The type parameter {@code R} is
{@link AtomicReader}, see {@link #subReaders} and
{@link #getSequentialSubReaders}.
*/
public abstract class DirectoryReader extends BaseMultiReader<AtomicReader> {
public abstract class DirectoryReader extends BaseCompositeReader<AtomicReader> {
public static final int DEFAULT_TERMS_INDEX_DIVISOR = 1;
protected final Directory directory;

View File

@ -337,6 +337,9 @@ final class DocFieldProcessor extends DocConsumer {
if (perDocConsumer == null) {
PerDocWriteState perDocWriteState = docState.docWriter.newPerDocWriteState("");
perDocConsumer = docState.docWriter.codec.docValuesFormat().docsConsumer(perDocWriteState);
if (perDocConsumer == null) {
throw new IllegalStateException("codec=" + docState.docWriter.codec + " does not support docValues: from docValuesFormat().docsConsumer(...) returned null; field=" + fieldInfo.name);
}
}
DocValuesConsumer docValuesConsumer = perDocConsumer.addValuesField(valueType, fieldInfo);
fieldInfo.setDocValuesType(valueType, false);

View File

@ -642,19 +642,17 @@ public class DocTermOrds {
* ord; in this case we "wrap" our own terms index
* around it. */
private final class OrdWrappedTermsEnum extends TermsEnum {
private final AtomicReader reader;
private final TermsEnum termsEnum;
private BytesRef term;
private long ord = -indexInterval-1; // force "real" seek
public OrdWrappedTermsEnum(AtomicReader reader) throws IOException {
this.reader = reader;
assert indexedTermsArray != null;
termsEnum = reader.fields().terms(field).iterator(null);
}
@Override
public Comparator<BytesRef> getComparator() throws IOException {
public Comparator<BytesRef> getComparator() {
return termsEnum.getComparator();
}

View File

@ -148,6 +148,7 @@ public abstract class DocValues implements Closeable {
protected Source(Type type) {
this.type = type;
}
/**
* Returns a <tt>long</tt> for the given document id or throws an
* {@link UnsupportedOperationException} if this source doesn't support
@ -239,9 +240,10 @@ public abstract class DocValues implements Closeable {
public BytesRef getBytes(int docID, BytesRef bytesRef) {
final int ord = ord(docID);
if (ord < 0) {
// Negative ord means doc was missing?
bytesRef.length = 0;
} else {
getByOrd(ord , bytesRef);
getByOrd(ord, bytesRef);
}
return bytesRef;
}
@ -253,7 +255,7 @@ public abstract class DocValues implements Closeable {
public abstract int ord(int docID);
/** Returns value for specified ord. */
public abstract BytesRef getByOrd(int ord, BytesRef bytesRef);
public abstract BytesRef getByOrd(int ord, BytesRef result);
/** Return true if it's safe to call {@link
* #getDocToOrd}. */
@ -274,7 +276,7 @@ public abstract class DocValues implements Closeable {
}
/**
* Performs a lookup by value.
* Lookup ord by value.
*
* @param value
* the value to look up
@ -283,11 +285,11 @@ public abstract class DocValues implements Closeable {
* values to the given value. Must not be <code>null</code>
* @return the given values ordinal if found or otherwise
* <code>(-(ord)-1)</code>, defined as the ordinal of the first
* element that is greater than the given value. This guarantees
* that the return value will always be &gt;= 0 if the given value
* is found.
* element that is greater than the given value (the insertion
* point). This guarantees that the return value will always be
* &gt;= 0 if the given value is found.
*/
public int getByValue(BytesRef value, BytesRef spare) {
public int getOrdByValue(BytesRef value, BytesRef spare) {
return binarySearch(value, spare, 0, getValueCount() - 1);
}
@ -405,7 +407,7 @@ public abstract class DocValues implements Closeable {
}
@Override
public int getByValue(BytesRef value, BytesRef spare) {
public int getOrdByValue(BytesRef value, BytesRef spare) {
if (value.length == 0) {
return 0;
} else {
@ -414,7 +416,7 @@ public abstract class DocValues implements Closeable {
}
@Override
public int getValueCount() {
public int getValueCount() {
return 1;
}
};

View File

@ -17,8 +17,10 @@ package org.apache.lucene.index;
* limitations under the License.
*/
import org.apache.lucene.util.AttributeSource;
import org.apache.lucene.util.Bits;
import org.apache.lucene.util.BytesRef;
import org.apache.lucene.util.automaton.CompiledAutomaton;
import java.io.IOException;
import java.util.Comparator;
@ -26,7 +28,7 @@ import java.util.Comparator;
/** A <code>FilterAtomicReader</code> contains another AtomicReader, which it
* uses as its basic source of data, possibly transforming the data along the
* way or providing additional functionality. The class
* <code>FilterIndexReader</code> itself simply implements all abstract methods
* <code>FilterAtomicReader</code> itself simply implements all abstract methods
* of <code>IndexReader</code> with versions that pass all requests to the
* contained index reader. Subclasses of <code>FilterAtomicReader</code> may
* further override some of these methods and may also provide additional
@ -37,7 +39,7 @@ public class FilterAtomicReader extends AtomicReader {
/** Base class for filtering {@link Fields}
* implementations. */
public static class FilterFields extends Fields {
protected Fields in;
protected final Fields in;
public FilterFields(Fields in) {
this.in = in;
@ -57,12 +59,17 @@ public class FilterAtomicReader extends AtomicReader {
public int getUniqueFieldCount() throws IOException {
return in.getUniqueFieldCount();
}
@Override
public long getUniqueTermCount() throws IOException {
return in.getUniqueTermCount();
}
}
/** Base class for filtering {@link Terms}
* implementations. */
public static class FilterTerms extends Terms {
protected Terms in;
protected final Terms in;
public FilterTerms(Terms in) {
this.in = in;
@ -97,11 +104,16 @@ public class FilterAtomicReader extends AtomicReader {
public int getDocCount() throws IOException {
return in.getDocCount();
}
@Override
public TermsEnum intersect(CompiledAutomaton automaton, BytesRef bytes) throws java.io.IOException {
return in.intersect(automaton, bytes);
}
}
/** Base class for filtering {@link TermsEnum} implementations. */
public static class FilterFieldsEnum extends FieldsEnum {
protected FieldsEnum in;
protected final FieldsEnum in;
public FilterFieldsEnum(FieldsEnum in) {
this.in = in;
}
@ -115,11 +127,16 @@ public class FilterAtomicReader extends AtomicReader {
public Terms terms() throws IOException {
return in.terms();
}
@Override
public AttributeSource attributes() {
return in.attributes();
}
}
/** Base class for filtering {@link TermsEnum} implementations. */
public static class FilterTermsEnum extends TermsEnum {
protected TermsEnum in;
protected final TermsEnum in;
public FilterTermsEnum(TermsEnum in) { this.in = in; }
@ -174,7 +191,7 @@ public class FilterAtomicReader extends AtomicReader {
}
@Override
public Comparator<BytesRef> getComparator() throws IOException {
public Comparator<BytesRef> getComparator() {
return in.getComparator();
}
@ -187,11 +204,16 @@ public class FilterAtomicReader extends AtomicReader {
public TermState termState() throws IOException {
return in.termState();
}
@Override
public AttributeSource attributes() {
return in.attributes();
}
}
/** Base class for filtering {@link DocsEnum} implementations. */
public static class FilterDocsEnum extends DocsEnum {
protected DocsEnum in;
protected final DocsEnum in;
public FilterDocsEnum(DocsEnum in) {
this.in = in;
@ -216,11 +238,16 @@ public class FilterAtomicReader extends AtomicReader {
public int advance(int target) throws IOException {
return in.advance(target);
}
@Override
public AttributeSource attributes() {
return in.attributes();
}
}
/** Base class for filtering {@link DocsAndPositionsEnum} implementations. */
public static class FilterDocsAndPositionsEnum extends DocsAndPositionsEnum {
protected DocsAndPositionsEnum in;
protected final DocsAndPositionsEnum in;
public FilterDocsAndPositionsEnum(DocsAndPositionsEnum in) {
this.in = in;
@ -270,18 +297,24 @@ public class FilterAtomicReader extends AtomicReader {
public boolean hasPayload() {
return in.hasPayload();
}
@Override
public AttributeSource attributes() {
return in.attributes();
}
}
protected AtomicReader in;
protected final AtomicReader in;
/**
* <p>Construct a FilterIndexReader based on the specified base reader.
* <p>Note that base reader is closed if this FilterIndexReader is closed.</p>
* <p>Construct a FilterAtomicReader based on the specified base reader.
* <p>Note that base reader is closed if this FilterAtomicReader is closed.</p>
* @param in specified base reader.
*/
public FilterAtomicReader(AtomicReader in) {
super();
this.in = in;
in.registerParentReader(this);
}
@Override
@ -363,7 +396,7 @@ public class FilterAtomicReader extends AtomicReader {
@Override
public String toString() {
final StringBuilder buffer = new StringBuilder("FilterIndexReader(");
final StringBuilder buffer = new StringBuilder("FilterAtomicReader(");
buffer.append(in);
buffer.append(')');
return buffer.toString();

View File

@ -122,7 +122,7 @@ public abstract class FilteredTermsEnum extends TermsEnum {
}
@Override
public Comparator<BytesRef> getComparator() throws IOException {
public Comparator<BytesRef> getComparator() {
return tenum.getComparator();
}

View File

@ -19,7 +19,6 @@ package org.apache.lucene.index;
import java.io.File;
import java.io.FilenameFilter;
import java.util.HashSet;
import java.util.regex.Pattern;
/**

View File

@ -21,6 +21,7 @@ import java.io.Closeable;
import java.io.IOException;
import java.util.Collections;
import java.util.LinkedHashSet;
import java.util.WeakHashMap;
import java.util.Set;
import java.util.concurrent.atomic.AtomicInteger;
@ -72,10 +73,13 @@ import org.apache.lucene.util.ReaderUtil; // for javadocs
*/
public abstract class IndexReader implements Closeable {
private boolean closed = false;
private boolean closedByChild = false;
private final AtomicInteger refCount = new AtomicInteger(1);
IndexReader() {
if (!(this instanceof CompositeReader || this instanceof AtomicReader))
throw new Error("This class should never be directly extended, subclass AtomicReader or CompositeReader instead!");
refCount.set(1);
throw new Error("IndexReader should never be directly extended, subclass AtomicReader or CompositeReader instead.");
}
/**
@ -91,6 +95,9 @@ public abstract class IndexReader implements Closeable {
private final Set<ReaderClosedListener> readerClosedListeners =
Collections.synchronizedSet(new LinkedHashSet<ReaderClosedListener>());
private final Set<IndexReader> parentReaders =
Collections.synchronizedSet(Collections.newSetFromMap(new WeakHashMap<IndexReader,Boolean>()));
/** Expert: adds a {@link ReaderClosedListener}. The
* provided listener will be invoked when this reader is closed.
*
@ -107,8 +114,19 @@ public abstract class IndexReader implements Closeable {
ensureOpen();
readerClosedListeners.remove(listener);
}
/** Expert: This method is called by {@code IndexReader}s which wrap other readers
* (e.g. {@link CompositeReader} or {@link FilterAtomicReader}) to register the parent
* at the child (this reader) on construction of the parent. When this reader is closed,
* it will mark all registered parents as closed, too. The references to parent readers
* are weak only, so they can be GCed once they are no longer in use.
* @lucene.experimental */
public final void registerParentReader(IndexReader reader) {
ensureOpen();
parentReaders.add(reader);
}
private final void notifyReaderClosedListeners() {
private void notifyReaderClosedListeners() {
synchronized(readerClosedListeners) {
for(ReaderClosedListener listener : readerClosedListeners) {
listener.onClose(this);
@ -116,9 +134,17 @@ public abstract class IndexReader implements Closeable {
}
}
private boolean closed = false;
private final AtomicInteger refCount = new AtomicInteger();
private void reportCloseToParentReaders() {
synchronized(parentReaders) {
for(IndexReader parent : parentReaders) {
parent.closedByChild = true;
// cross memory barrier by a fake write:
parent.refCount.addAndGet(0);
// recurse:
parent.reportCloseToParentReaders();
}
}
}
/** Expert: returns the current refCount for this reader */
public final int getRefCount() {
@ -191,7 +217,12 @@ public abstract class IndexReader implements Closeable {
* @see #incRef
*/
public final void decRef() throws IOException {
ensureOpen();
// only check refcount here (don't call ensureOpen()), so we can
// still close the reader if it was made invalid by a child:
if (refCount.get() <= 0) {
throw new AlreadyClosedException("this IndexReader is closed");
}
final int rc = refCount.decrementAndGet();
if (rc == 0) {
boolean success = false;
@ -204,6 +235,7 @@ public abstract class IndexReader implements Closeable {
refCount.incrementAndGet();
}
}
reportCloseToParentReaders();
notifyReaderClosedListeners();
} else if (rc < 0) {
throw new IllegalStateException("too many decRef calls: refCount is " + rc + " after decrement");
@ -217,6 +249,33 @@ public abstract class IndexReader implements Closeable {
if (refCount.get() <= 0) {
throw new AlreadyClosedException("this IndexReader is closed");
}
// the happens before rule on reading the refCount, which must be after the fake write,
// ensures that we see the value:
if (closedByChild) {
throw new AlreadyClosedException("this IndexReader cannot be used anymore as one of its child readers was closed");
}
}
/** {@inheritDoc}
* <p>For caching purposes, {@code IndexReader} subclasses are not allowed
* to implement equals/hashCode, so methods are declared final.
* To lookup instances from caches use {@link #getCoreCacheKey} and
* {@link #getCombinedCoreAndDeletesKey}.
*/
@Override
public final boolean equals(Object obj) {
return (this == obj);
}
/** {@inheritDoc}
* <p>For caching purposes, {@code IndexReader} subclasses are not allowed
* to implement equals/hashCode, so methods are declared final.
* To lookup instances from caches use {@link #getCoreCacheKey} and
* {@link #getCombinedCoreAndDeletesKey}.
*/
@Override
public final int hashCode() {
return System.identityHashCode(this);
}
/** Returns a IndexReader reading the index in the given

View File

@ -532,7 +532,7 @@ public class IndexWriter implements Closeable, TwoPhaseCommit {
public synchronized boolean delete(int docID) {
assert liveDocs != null;
assert docID >= 0 && docID < liveDocs.length();
assert docID >= 0 && docID < liveDocs.length() : "out of bounds: docid=" + docID + ",liveDocsLength=" + liveDocs.length();
assert !shared;
final boolean didDelete = liveDocs.get(docID);
if (didDelete) {
@ -577,6 +577,7 @@ public class IndexWriter implements Closeable, TwoPhaseCommit {
public synchronized void initWritableLiveDocs() throws IOException {
assert Thread.holdsLock(IndexWriter.this);
assert info.docCount > 0;
//System.out.println("initWritableLivedocs seg=" + info + " liveDocs=" + liveDocs + " shared=" + shared);
if (shared) {
// Copy on write: this means we've cloned a
@ -3133,7 +3134,7 @@ public class IndexWriter implements Closeable, TwoPhaseCommit {
return false;
}
final ReadersAndLiveDocs mergedDeletes = commitMergedDeletes(merge);
final ReadersAndLiveDocs mergedDeletes = merge.info.docCount == 0 ? null : commitMergedDeletes(merge);
assert mergedDeletes == null || mergedDeletes.pendingDeleteCount != 0;

View File

@ -35,7 +35,7 @@ import org.apache.lucene.util.ReaderUtil;
* Exposes flex API, merged from flex API of sub-segments.
* This is useful when you're interacting with an {@link
* IndexReader} implementation that consists of sequential
* sub-readers (eg DirectoryReader or {@link
* sub-readers (eg {@link DirectoryReader} or {@link
* MultiReader}).
*
* <p><b>NOTE</b>: for multi readers, you'll get better

View File

@ -19,15 +19,25 @@ package org.apache.lucene.index;
import java.io.IOException;
/** An IndexReader which reads multiple indexes, appending
* their content.
<p><em>Please note:</em> This class extends from an internal (invisible)
superclass that is generic: The type parameter {@code R} is
{@link IndexReader}, see {@link #subReaders} and
{@link #getSequentialSubReaders}.
/** A {@link CompositeReader} which reads multiple indexes, appending
* their content. It can be used to create a view on several
* sub-readers (like {@link DirectoryReader}) and execute searches on it.
*
* <p> For efficiency, in this API documents are often referred to via
* <i>document numbers</i>, non-negative integers which each name a unique
* document in the index. These document numbers are ephemeral -- they may change
* as documents are added to and deleted from an index. Clients should thus not
* rely on a given document having the same number between sessions.
*
* <p><a name="thread-safety"></a><p><b>NOTE</b>: {@link
* IndexReader} instances are completely thread
* safe, meaning multiple threads can call any of its methods,
* concurrently. If your application requires external
* synchronization, you should <b>not</b> synchronize on the
* <code>IndexReader</code> instance; use your own
* (non-Lucene) objects instead.
*/
public class MultiReader extends BaseMultiReader<IndexReader> {
public class MultiReader extends BaseCompositeReader<IndexReader> {
private final boolean closeSubReaders;
/**

View File

@ -18,11 +18,8 @@ package org.apache.lucene.index;
import java.io.IOException;
import org.apache.lucene.codecs.DocValuesConsumer;
import org.apache.lucene.document.DocValuesField;
import org.apache.lucene.document.Field;
import org.apache.lucene.index.DocValues.Type;
import org.apache.lucene.search.similarities.Similarity;
import org.apache.lucene.util.BytesRef;
public class NormsConsumerPerField extends InvertedDocEndConsumerPerField implements Comparable<NormsConsumerPerField> {
private final FieldInfo fieldInfo;

View File

@ -19,7 +19,6 @@ package org.apache.lucene.index;
import java.io.IOException;
import java.util.Collections;
import java.util.HashMap;
import java.util.IdentityHashMap;
import java.util.Iterator;
import java.util.Map;
@ -57,7 +56,8 @@ public final class ParallelAtomicReader extends AtomicReader {
private final boolean closeSubReaders;
private final int maxDoc, numDocs;
private final boolean hasDeletions;
final SortedMap<String,AtomicReader> fieldToReader = new TreeMap<String,AtomicReader>();
private final SortedMap<String,AtomicReader> fieldToReader = new TreeMap<String,AtomicReader>();
private final SortedMap<String,AtomicReader> tvFieldToReader = new TreeMap<String,AtomicReader>();
/** Create a ParallelAtomicReader based on the provided
* readers; auto-closes the given readers on {@link #close()}. */
@ -98,24 +98,43 @@ public final class ParallelAtomicReader extends AtomicReader {
throw new IllegalArgumentException("All readers must have same maxDoc: "+maxDoc+"!="+reader.maxDoc());
}
}
// build FieldInfos and fieldToReader map:
for (final AtomicReader reader : this.parallelReaders) {
final FieldInfos readerFieldInfos = reader.getFieldInfos();
for(FieldInfo fieldInfo : readerFieldInfos) { // update fieldToReader map
for (FieldInfo fieldInfo : readerFieldInfos) {
// NOTE: first reader having a given field "wins":
if (!fieldToReader.containsKey(fieldInfo.name)) {
fieldInfos.add(fieldInfo);
fieldToReader.put(fieldInfo.name, reader);
this.fields.addField(fieldInfo.name, reader.terms(fieldInfo.name));
if (fieldInfo.storeTermVector) {
tvFieldToReader.put(fieldInfo.name, reader);
}
}
}
}
}
// build Fields instance
for (final AtomicReader reader : this.parallelReaders) {
final Fields readerFields = reader.fields();
if (readerFields != null) {
final FieldsEnum it = readerFields.iterator();
String name;
while ((name = it.next()) != null) {
// only add if the reader responsible for that field name is the current:
if (fieldToReader.get(name) == reader) {
this.fields.addField(name, it.terms());
}
}
}
}
// do this finally so any Exceptions occurred before don't affect refcounts:
if (!closeSubReaders) {
for (AtomicReader reader : completeReaderSet) {
for (AtomicReader reader : completeReaderSet) {
if (!closeSubReaders) {
reader.incRef();
}
reader.registerParentReader(this);
}
}
@ -132,11 +151,11 @@ public final class ParallelAtomicReader extends AtomicReader {
private final class ParallelFieldsEnum extends FieldsEnum {
private String currentField;
private final Iterator<String> keys;
private final Fields fields;
private final ParallelFields fields;
ParallelFieldsEnum(Fields fields) {
ParallelFieldsEnum(ParallelFields fields) {
this.fields = fields;
keys = fieldToReader.keySet().iterator();
keys = fields.fields.keySet().iterator();
}
@Override
@ -158,7 +177,7 @@ public final class ParallelAtomicReader extends AtomicReader {
// Single instance of this, per ParallelReader instance
private final class ParallelFields extends Fields {
final HashMap<String,Terms> fields = new HashMap<String,Terms>();
final Map<String,Terms> fields = new TreeMap<String,Terms>();
ParallelFields() {
}
@ -197,11 +216,6 @@ public final class ParallelAtomicReader extends AtomicReader {
@Override
public Fields fields() {
ensureOpen();
// we cache the inner field instances, so we must check
// that the delegate readers are really still open:
for (final AtomicReader reader : parallelReaders) {
reader.ensureOpen();
}
return fields;
}
@ -231,15 +245,17 @@ public final class ParallelAtomicReader extends AtomicReader {
}
}
// get all vectors
@Override
public Fields getTermVectors(int docID) throws IOException {
ensureOpen();
ParallelFields fields = new ParallelFields();
for (Map.Entry<String,AtomicReader> ent : fieldToReader.entrySet()) {
ParallelFields fields = null;
for (Map.Entry<String,AtomicReader> ent : tvFieldToReader.entrySet()) {
String fieldName = ent.getKey();
Terms vector = ent.getValue().getTermVector(docID, fieldName);
if (vector != null) {
if (fields == null) {
fields = new ParallelFields();
}
fields.addField(fieldName, vector);
}
}

View File

@ -46,7 +46,7 @@ import java.util.Set;
* by number of documents per segment. If you use different {@link MergePolicy}s
* it might happen that the segment structure of your index is no longer predictable.
*/
public final class ParallelCompositeReader extends BaseMultiReader<IndexReader> {
public final class ParallelCompositeReader extends BaseCompositeReader<IndexReader> {
private final boolean closeSubReaders;
private final Set<CompositeReader> completeReaderSet =
Collections.newSetFromMap(new IdentityHashMap<CompositeReader,Boolean>());

View File

@ -1,22 +1,4 @@
package org.apache.lucene.index;
/**
* 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.
*/
import java.io.PrintStream;
import org.apache.lucene.codecs.PerDocConsumer;
import org.apache.lucene.store.Directory;
import org.apache.lucene.store.IOContext;

View File

@ -68,6 +68,7 @@ public final class SlowCompositeReaderWrapper extends AtomicReader {
in = reader;
fields = MultiFields.getFields(in);
liveDocs = MultiFields.getLiveDocs(in);
in.registerParentReader(this);
}
@Override
@ -78,7 +79,6 @@ public final class SlowCompositeReaderWrapper extends AtomicReader {
@Override
public Fields fields() throws IOException {
ensureOpen();
in.ensureOpen(); // as we cached the fields, we better check the original reader
return fields;
}
@ -127,7 +127,6 @@ public final class SlowCompositeReaderWrapper extends AtomicReader {
@Override
public Bits getLiveDocs() {
ensureOpen();
in.ensureOpen(); // as we cached the liveDocs, we better check the original reader
return liveDocs;
}

View File

@ -81,7 +81,7 @@ public final class SortedBytesMergeUtils {
}
}
public static List<SortedSourceSlice> buildSlices(int[] docBases ,int[][] docMaps,
public static List<SortedSourceSlice> buildSlices(int[] docBases, int[][] docMaps,
DocValues[] docValues, MergeContext ctx) throws IOException {
final List<SortedSourceSlice> slices = new ArrayList<SortedSourceSlice>();
for (int i = 0; i < docValues.length; i++) {
@ -111,7 +111,7 @@ public final class SortedBytesMergeUtils {
* mapping in docIDToRelativeOrd. After the merge SortedSourceSlice#ordMapping
* contains the new global ordinals for the relative index.
*/
private static void createOrdMapping(int[] docBases ,int[][] docMaps,
private static void createOrdMapping(int[] docBases, int[][] docMaps,
SortedSourceSlice currentSlice) {
final int readerIdx = currentSlice.readerIdx;
final int[] currentDocMap = docMaps[readerIdx];

View File

@ -23,6 +23,7 @@ import java.util.Comparator;
import org.apache.lucene.util.AttributeSource;
import org.apache.lucene.util.Bits;
import org.apache.lucene.util.BytesRef;
import org.apache.lucene.util.BytesRefIterator;
/** Iterator to seek ({@link #seekCeil(BytesRef)}, {@link
* #seekExact(BytesRef,boolean)}) or step through ({@link
@ -40,7 +41,7 @@ import org.apache.lucene.util.BytesRef;
* of the <code>seek</code> methods.
*
* @lucene.experimental */
public abstract class TermsEnum {
public abstract class TermsEnum implements BytesRefIterator {
private AttributeSource atts = null;
@ -114,14 +115,6 @@ public abstract class TermsEnum {
}
}
/** Increments the enumeration to the next term.
* Returns the resulting term, or null if the end was
* hit (which means the enum is unpositioned). The
* returned BytesRef may be re-used across calls to next.
* After this method returns null, do not call it again:
* the results are undefined. */
public abstract BytesRef next() throws IOException;
/** Returns current term. Do not call this when the enum
* is unpositioned. */
public abstract BytesRef term() throws IOException;
@ -186,13 +179,6 @@ public abstract class TermsEnum {
}
};
}
/** Return the {@link BytesRef} Comparator used to sort
* terms provided by the iterator. This may return
* null if there are no terms. Callers may invoke this
* method many times, so it's best to cache a single
* instance & reuse it. */
public abstract Comparator<BytesRef> getComparator() throws IOException;
/** An empty TermsEnum for quickly returning an empty instance e.g.
* in {@link org.apache.lucene.search.MultiTermQuery}

View File

@ -203,8 +203,6 @@ final class BooleanScorer extends Scorer {
private final int minNrShouldMatch;
private int end;
private Bucket current;
private int doc = -1;
// Any time a prohibited clause matches we set bit 0:
private static final int PROHIBITED_MASK = 1;

View File

@ -25,7 +25,6 @@ import java.util.List;
import org.apache.lucene.search.BooleanClause.Occur;
import org.apache.lucene.search.BooleanQuery.BooleanWeight;
import org.apache.lucene.search.similarities.Similarity;
import org.apache.lucene.search.Scorer.ChildScorer;
/* See the description in BooleanScorer.java, comparing
* BooleanScorer & BooleanScorer2 */

View File

@ -49,7 +49,7 @@ class ConjunctionTermScorer extends Scorer {
private int doNext(int doc) throws IOException {
do {
if (lead.doc == DocsEnum.NO_MORE_DOCS) {
if (lead.doc == DocIdSetIterator.NO_MORE_DOCS) {
return NO_MORE_DOCS;
}
advanceHead: do {

View File

@ -76,7 +76,7 @@ final class ExactPhraseScorer extends Scorer {
// freq of rarest 2 terms is close:
final boolean useAdvance = postings[i].docFreq > 5*postings[0].docFreq;
chunkStates[i] = new ChunkState(postings[i].postings, -postings[i].position, useAdvance);
if (i > 0 && postings[i].postings.nextDoc() == DocsEnum.NO_MORE_DOCS) {
if (i > 0 && postings[i].postings.nextDoc() == DocIdSetIterator.NO_MORE_DOCS) {
noDocs = true;
return;
}
@ -89,7 +89,7 @@ final class ExactPhraseScorer extends Scorer {
// first (rarest) term
final int doc = chunkStates[0].posEnum.nextDoc();
if (doc == DocsEnum.NO_MORE_DOCS) {
if (doc == DocIdSetIterator.NO_MORE_DOCS) {
docID = doc;
return doc;
}
@ -140,8 +140,8 @@ final class ExactPhraseScorer extends Scorer {
// first term
int doc = chunkStates[0].posEnum.advance(target);
if (doc == DocsEnum.NO_MORE_DOCS) {
docID = DocsEnum.NO_MORE_DOCS;
if (doc == DocIdSetIterator.NO_MORE_DOCS) {
docID = DocIdSetIterator.NO_MORE_DOCS;
return doc;
}
@ -171,7 +171,7 @@ final class ExactPhraseScorer extends Scorer {
}
doc = chunkStates[0].posEnum.nextDoc();
if (doc == DocsEnum.NO_MORE_DOCS) {
if (doc == DocIdSetIterator.NO_MORE_DOCS) {
docID = doc;
return doc;
}

Some files were not shown because too many files have changed in this diff Show More