You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by si...@apache.org on 2011/02/21 15:13:40 UTC
svn commit: r1072973 [2/11] - in /lucene/dev/branches/docvalues: ./
dev-tools/eclipse/ dev-tools/idea/.idea/ dev-tools/idea/lucene/contrib/ant/
dev-tools/idea/lucene/contrib/demo/
dev-tools/idea/lucene/contrib/highlighter/ dev-tools/idea/lucene/contrib...
Modified: lucene/dev/branches/docvalues/lucene/contrib/CHANGES.txt
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/lucene/contrib/CHANGES.txt?rev=1072973&r1=1072972&r2=1072973&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/lucene/contrib/CHANGES.txt (original)
+++ lucene/dev/branches/docvalues/lucene/contrib/CHANGES.txt Mon Feb 21 14:13:28 2011
@@ -4,39 +4,53 @@ Lucene contrib change Log
Build
- * LUCENE-2845: Moved contrib/benchmark to modules.
+ * LUCENE-2413: Moved the demo out of lucene core and into contrib/demo.
+ (Robert Muir)
New Features
- * LUCENE-2604: Added RegexpQuery support to contrib/queryparser.
- (Simon Willnauer, Robert Muir)
+ * LUCENE-2604: Added RegexpQuery support to contrib/queryparser.
+ (Simon Willnauer, Robert Muir)
- * LUCENE-2373: Added a Codec implementation that works with append-only
- filesystems (such as e.g. Hadoop DFS). SegmentInfos writing/reading
- code is refactored to support append-only FS, and to allow for future
- customization of per-segment information. (Andrzej Bialecki)
+ * LUCENE-2500: Added DirectIOLinuxDirectory, a Linux-specific
+ Directory impl that uses the O_DIRECT flag to bypass the buffer
+ cache. This is useful to prevent segment merging from evicting
+ pages from the buffer cache, since fadvise/madvise do not seem.
+ (Michael McCandless)
+
+ * LUCENE-2373: Added a Codec implementation that works with append-only
+ filesystems (such as e.g. Hadoop DFS). SegmentInfos writing/reading
+ code is refactored to support append-only FS, and to allow for future
+ customization of per-segment information. (Andrzej Bialecki)
- * LUCENE-2479: Added ability to provide a sort comparator for spelling suggestions along
- with two implementations. The existing comparator (score, then frequency) is the default (Grant Ingersoll)
+ * LUCENE-2479: Added ability to provide a sort comparator for spelling suggestions along
+ with two implementations. The existing comparator (score, then frequency) is the default (Grant Ingersoll)
- * LUCENE-2608: Added the ability to specify the accuracy at method time in the SpellChecker. The per class
- method is also still available. (Grant Ingersoll)
+ * LUCENE-2608: Added the ability to specify the accuracy at method time in the SpellChecker. The per class
+ method is also still available. (Grant Ingersoll)
- * LUCENE-2507: Added DirectSpellChecker, which retrieves correction candidates directly
- from the term dictionary using levenshtein automata. (Robert Muir)
+ * LUCENE-2507: Added DirectSpellChecker, which retrieves correction candidates directly
+ from the term dictionary using levenshtein automata. (Robert Muir)
- * LUCENE-2836: Add FieldCacheRewriteMethod, which rewrites MultiTermQueries
- using the FieldCache's TermsEnum. (Robert Muir)
+ * LUCENE-2791: Added WindowsDirectory, a Windows-specific Directory impl
+ that doesn't synchronize on the file handle. This can be useful to
+ avoid the performance problems of SimpleFSDirectory and NIOFSDirectory.
+ (Robert Muir, Simon Willnauer, Uwe Schindler, Michael McCandless)
API Changes
- * LUCENE-2606: Changed RegexCapabilities interface to fix thread
- safety, serialization, and performance problems. If you have
- written a custom RegexCapabilities it will need to be updated
- to the new API. (Robert Muir, Uwe Schindler)
-
- * LUCENE-2638 MakeHighFreqTerms.TermStats public to make it more useful
- for API use. (Andrzej Bialecki)
+ * LUCENE-2606: Changed RegexCapabilities interface to fix thread
+ safety, serialization, and performance problems. If you have
+ written a custom RegexCapabilities it will need to be updated
+ to the new API. (Robert Muir, Uwe Schindler)
+
+ * LUCENE-2638 MakeHighFreqTerms.TermStats public to make it more useful
+ for API use. (Andrzej Bialecki)
+
+ * LUCENE-2912: The field-specific hashmaps in SweetSpotSimilarity were removed.
+ Instead, use SimilarityProvider to return different SweetSpotSimilaritys
+ for different fields, this way all parameters (such as TF factors) can be
+ customized on a per-field basis. (Robert Muir)
======================= Lucene 3.x (not yet released) =======================
@@ -64,14 +78,6 @@ Changes in backwards compatibility polic
* LUCENE-2581: Added new methods to FragmentsBuilder interface. These methods
are used to set pre/post tags and Encoder. (Koji Sekiguchi)
-
- * LUCENE-2391: Improved spellchecker (re)build time/ram usage by omitting
- frequencies/positions/norms for single-valued fields, modifying the default
- ramBufferMBSize to match IndexWriterConfig (16MB), making index optimization
- an optional boolean parameter, and modifying the incremental update logic
- to work well with unoptimized spellcheck indexes. The indexDictionary() methods
- were made final to ensure a hard backwards break in case you were subclassing
- Spellchecker. In general, subclassing Spellchecker is not recommended. (Robert Muir)
Changes in runtime behavior
@@ -86,11 +92,6 @@ Changes in runtime behavior
Bug fixes
- * LUCENE-2855: contrib queryparser was using CharSequence as key in some internal
- Map instances, which was leading to incorrect behaviour, since some CharSequence
- implementors do not override hashcode and equals methods. Now the internal Maps
- are using String instead. (Adriano Crestani)
-
* LUCENE-2068: Fixed ReverseStringFilter which was not aware of supplementary
characters. During reverse the filter created unpaired surrogates, which
will be replaced by U+FFFD by the indexer, but not at query time. The filter
@@ -108,48 +109,41 @@ Bug fixes
default. (Robert Muir, Uwe Schindler, Simon Willnauer)
* LUCENE-2184: Fixed bug with handling best fit value when the proper best fit value is
- not an indexed field. Note, this change affects the APIs. (Grant Ingersoll)
+ not an indexed field. Note, this change affects the APIs. (Grant Ingersoll)
* LUCENE-2359: Fix bug in CartesianPolyFilterBuilder related to handling of behavior around
- the 180th meridian (Grant Ingersoll)
+ the 180th meridian (Grant Ingersoll)
* LUCENE-2404: Fix bugs with position increment and empty tokens in ThaiWordFilter.
For matchVersion >= 3.1 the filter also no longer lowercases. ThaiAnalyzer
will use a separate LowerCaseFilter instead. (Uwe Schindler, Robert Muir)
- * LUCENE-2615: Fix DirectIOLinuxDirectory to not assign bogus
- permissions to newly created files, and to not silently hardwire
- buffer size to 1 MB. (Mark Miller, Robert Muir, Mike McCandless)
-
- * LUCENE-2629: Fix gennorm2 task for generating ICUFoldingFilter's .nrm file. This allows
- you to customize its normalization/folding, by editing the source data files in src/data
- and regenerating a new .nrm with 'ant gennorm2'. (David Bowen via Robert Muir)
-
- * LUCENE-2653: ThaiWordFilter depends on the JRE having a Thai dictionary, which is not
- always the case. If the dictionary is unavailable, the filter will now throw
- UnsupportedOperationException in the constructor. (Robert Muir)
+* LUCENE-2615: Fix DirectIOLinuxDirectory to not assign bogus
+ permissions to newly created files, and to not silently hardwire
+ buffer size to 1 MB. (Mark Miller, Robert Muir, Mike McCandless)
+
+* LUCENE-2629: Fix gennorm2 task for generating ICUFoldingFilter's .nrm file. This allows
+ you to customize its normalization/folding, by editing the source data files in src/data
+ and regenerating a new .nrm with 'ant gennorm2'. (David Bowen via Robert Muir)
+
+* LUCENE-2653: ThaiWordFilter depends on the JRE having a Thai dictionary, which is not
+ always the case. If the dictionary is unavailable, the filter will now throw
+ UnsupportedOperationException in the constructor. (Robert Muir)
- * LUCENE-589: Fix contrib/demo for international documents.
- (Curtis d'Entremont via Robert Muir)
+* LUCENE-589: Fix contrib/demo for international documents.
+ (Curtis d'Entremont via Robert Muir)
- * LUCENE-2246: Fix contrib/demo for Turkish html documents.
- (Selim Nadi via Robert Muir)
+* LUCENE-2246: Fix contrib/demo for Turkish html documents.
+ (Selim Nadi via Robert Muir)
- * LUCENE-590: Demo HTML parser gives incorrect summaries when title is repeated as a heading
- (Curtis d'Entremont via Robert Muir)
-
- * LUCENE-591: The demo indexer now indexes meta keywords.
- (Curtis d'Entremont via Robert Muir)
+* LUCENE-590: Demo HTML parser gives incorrect summaries when title is repeated as a heading
+ (Curtis d'Entremont via Robert Muir)
- * LUCENE-2874: Highlighting overlapping tokens outputted doubled words.
- (Pierre Gossé via Robert Muir)
+* LUCENE-591: The demo indexer now indexes meta keywords.
+ (Curtis d'Entremont via Robert Muir)
API Changes
- * LUCENE-2867: Some contrib queryparser methods that receives CharSequence as
- identifier, such as QueryNode#unsetTag(CharSequence), were deprecated and
- will be removed on version 4. (Adriano Crestani)
-
* LUCENE-2147: Spatial GeoHashUtils now always decode GeoHash strings
with full precision. GeoHash#decode_exactly(String) was merged into
GeoHash#decode(String). (Chris Male, Simon Willnauer)
@@ -185,17 +179,11 @@ API Changes
* LUCENE-2747: Deprecated ArabicLetterTokenizer. StandardTokenizer now tokenizes
most languages correctly including Arabic. (Steven Rowe, Robert Muir)
- * LUCENE-2830: Use StringBuilder instead of StringBuffer across Benchmark, and
- remove the StringBuffer HtmlParser.parse() variant. (Shai Erera)
+ * LUCENE-2920: Deprecated ShingleMatrixFilter as it is unmaintained and does
+ not work with custom Attributes or custom payload encoders. (Uwe Schindler)
New features
- * LUCENE-2500: Added DirectIOLinuxDirectory, a Linux-specific
- Directory impl that uses the O_DIRECT flag to bypass the buffer
- cache. This is useful to prevent segment merging from evicting
- pages from the buffer cache, since fadvise/madvise do not seem.
- (Michael McCandless)
-
* LUCENE-2306: Add NumericRangeFilter and NumericRangeQuery support to XMLQueryParser.
(Jingkei Ly, via Mark Harwood)
@@ -285,14 +273,6 @@ New features
BooleanModifiersQueryNodeProcessor, for example instead of GroupQueryNodeProcessor.
(Adriano Crestani via Robert Muir)
- * LUCENE-2791: Added WindowsDirectory, a Windows-specific Directory impl
- that doesn't synchronize on the file handle. This can be useful to
- avoid the performance problems of SimpleFSDirectory and NIOFSDirectory.
- (Robert Muir, Simon Willnauer, Uwe Schindler, Michael McCandless)
-
- * LUCENE-2842: Add analyzer for Galician. Also adds the RSLP (Orengo) stemmer
- for Portuguese. (Robert Muir)
-
Build
* LUCENE-2124: Moved the JDK-based collation support from contrib/collation
@@ -312,12 +292,7 @@ Build
* LUCENE-2797: Upgrade contrib/icu's ICU jar file to ICU 4.6
(Robert Muir)
-
- * LUCENE-2833: Upgrade contrib/ant's jtidy jar file to r938 (Robert Muir)
-
- * LUCENE-2413: Moved the demo out of lucene core and into contrib/demo.
- (Robert Muir)
-
+
Optimizations
* LUCENE-2157: DelimitedPayloadTokenFilter no longer copies the buffer
Modified: lucene/dev/branches/docvalues/lucene/contrib/demo/build.xml
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/lucene/contrib/demo/build.xml?rev=1072973&r1=1072972&r2=1072973&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/lucene/contrib/demo/build.xml (original)
+++ lucene/dev/branches/docvalues/lucene/contrib/demo/build.xml Mon Feb 21 14:13:28 2011
@@ -17,81 +17,40 @@
limitations under the License.
-->
-<project name="demo" default="default" xmlns:artifact="antlib:org.apache.maven.artifact.ant">
+<project name="demo" default="jar-core" xmlns:artifact="antlib:org.apache.maven.artifact.ant">
<description>
Lucene Demo
</description>
- <property name="build.demo.template" value="src/java/demo-build.template"/>
-
<property name="demo.name" value="lucene-demos-${version}"/>
- <property name="demo.war.name" value="luceneweb"/>
<import file="../contrib-build.xml"/>
<module-uptodate name="analysis/common" jarfile="${common.dir}/../modules/analysis/build/common/lucene-analyzers-common-${version}.jar"
property="analyzers-common.uptodate" classpath.property="analyzers-common.jar"/>
-
+
+ <property name="lucene.jar" value="${common.dir}/build/lucene-core-${version}.jar"/>
+ <target name="lucene-jar-uptodate" unless="lucene.jar.uptodate">
+ <uptodate property="lucene.jar.uptodate" targetfile="${lucene.jar}">
+ <srcfiles dir="${common.dir}/src/java" includes="**/*.java"/>
+ </uptodate>
+ </target>
+ <target name="jar-lucene" depends="build-lucene" unless="lucene.jar.uptodate">
+ <ant dir="${common.dir}" target="jar-core" inheritAll="false"/>
+ </target>
+ <target name="init" depends="contrib-build.init,lucene-jar-uptodate,jar-lucene"/>
+
<path id="classpath">
<pathelement path="${analyzers-common.jar}"/>
- <path refid="base.classpath"/>
+ <pathelement path="${lucene.jar}"/>
</path>
- <target name="compile-core" depends="compile-analyzers-common, common.compile-core, war-demo" />
+ <target name="compile-core" depends="jar-analyzers-common,common.compile-core" />
- <target name="compile-analyzers-common" unless="analyzers-common.uptodate">
- <subant target="default">
+ <target name="jar-analyzers-common" unless="analyzers-common.uptodate">
+ <subant target="jar-core">
<fileset dir="${common.dir}/../modules/analysis/common" includes="build.xml"/>
</subant>
</target>
-
- <target name="war-demo">
- <sequential>
- <build-manifest title="Lucene Search Engine: demos"/>
- <war destfile="${build.dir}/${demo.war.name}.war"
- webxml="src/jsp/WEB-INF/web.xml"
- manifest="${manifest.file}">
- <fileset dir="src/jsp" excludes="WEB-INF/web.xml"/>
- <lib dir="${build.dir}/../.." includes="lucene-core-${version}.jar"/>
- <lib dir="${common.dir}/../modules/analysis/build/common" includes="lucene-analyzers-common-${version}.jar"/>
- <lib dir="${build.dir}" includes="${final.name}.jar"/>
- <metainf dir="${common.dir}">
- <include name="LICENSE.txt"/>
- <include name="NOTICE.txt"/>
- </metainf>
- </war>
- </sequential>
- </target>
-
- <target name="clean-javacc">
- <fileset dir="src/java/org/apache/lucene/demo/html" includes="*.java">
- <containsregexp expression="Generated.*By.*JavaCC"/>
- </fileset>
- </target>
-
- <target name="javacc" depends="init,javacc-check" if="javacc.present">
- <invoke-javacc target="src/java/org/apache/lucene/demo/html/HTMLParser.jj"
- outputDir="src/java/org/apache/lucene/demo/html"
- />
- </target>
-
- <target name="dist-maven" if="pom.xml.present" depends="compile-core,jar-src">
- <sequential>
- <artifact:install-provider artifactId="wagon-ssh" version="1.0-beta-7"/>
- <artifact:pom id="maven.project" file="pom.xml"/>
- <artifact:deploy file="${build.dir}/${demo.war.name}.war">
- <attach file="${build.dir}/${maven.project.build.finalName}.jar"
- classifier="classes"/>
- <attach file="${build.dir}/${final.name}-src.jar"
- classifier="sources"/>
- <attach file="${build.dir}/${final.name}-javadoc.jar"
- classifier="javadoc"/>
- <remoteRepository url="${m2.repository.url}">
- <authentication username="${m2.repository.username}" privateKey="${m2.repository.private.key}"/>
- </remoteRepository>
- <pom refid="maven.project"/>
- </artifact:deploy>
- </sequential>
- </target>
</project>
Modified: lucene/dev/branches/docvalues/lucene/contrib/demo/src/java/org/apache/lucene/demo/IndexFiles.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/lucene/contrib/demo/src/java/org/apache/lucene/demo/IndexFiles.java?rev=1072973&r1=1072972&r2=1072973&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/lucene/contrib/demo/src/java/org/apache/lucene/demo/IndexFiles.java (original)
+++ lucene/dev/branches/docvalues/lucene/contrib/demo/src/java/org/apache/lucene/demo/IndexFiles.java Mon Feb 21 14:13:28 2011
@@ -17,39 +17,59 @@ package org.apache.lucene.demo;
* limitations under the License.
*/
+import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.standard.StandardAnalyzer;
+import org.apache.lucene.document.Document;
+import org.apache.lucene.document.Field;
+import org.apache.lucene.document.NumericField;
import org.apache.lucene.index.IndexWriter;
-import org.apache.lucene.index.IndexWriterConfig;
import org.apache.lucene.index.IndexWriterConfig.OpenMode;
+import org.apache.lucene.index.IndexWriterConfig;
+import org.apache.lucene.index.Term;
+import org.apache.lucene.store.Directory;
import org.apache.lucene.store.FSDirectory;
import org.apache.lucene.util.Version;
+import java.io.BufferedReader;
import java.io.File;
+import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
+import java.io.InputStreamReader;
import java.util.Date;
-/** Index all text files under a directory. */
+/** Index all text files under a directory. See http://lucene.apache.org/java/4_0/demo.html. */
public class IndexFiles {
private IndexFiles() {}
- static final File INDEX_DIR = new File("index");
-
/** Index all text files under a directory. */
public static void main(String[] args) {
- String usage = "java org.apache.lucene.demo.IndexFiles <root_directory>";
- if (args.length == 0) {
- System.err.println("Usage: " + usage);
- System.exit(1);
+ String usage = "java org.apache.lucene.demo.IndexFiles"
+ + " [-index INDEX_PATH] [-docs DOCS_PATH] [-update]\n\n"
+ // TODO: Change the link with every release (or: fill in some less error-prone alternative here...)
+ + "See http://lucene.apache.org/java/4_0/demo.html for details.";
+ String indexPath = "index";
+ String docsPath = null;
+ boolean create = true;
+ for(int i=0;i<args.length;i++) {
+ if ("-index".equals(args[i])) {
+ indexPath = args[i+1];
+ i++;
+ } else if ("-docs".equals(args[i])) {
+ docsPath = args[i+1];
+ i++;
+ } else if ("-update".equals(args[i])) {
+ create = false;
+ }
}
- if (INDEX_DIR.exists()) {
- System.out.println("Cannot save index to '" +INDEX_DIR+ "' directory, please delete it first");
+ if (docsPath == null) {
+ System.err.println("Usage: " + usage);
System.exit(1);
}
-
- final File docDir = new File(args[0]);
+
+ final File docDir = new File(docsPath);
if (!docDir.exists() || !docDir.canRead()) {
System.out.println("Document directory '" +docDir.getAbsolutePath()+ "' does not exist or is not readable, please check the path");
System.exit(1);
@@ -57,13 +77,39 @@ public class IndexFiles {
Date start = new Date();
try {
- IndexWriter writer = new IndexWriter(FSDirectory.open(INDEX_DIR),
- new IndexWriterConfig(Version.LUCENE_CURRENT, new StandardAnalyzer(
- Version.LUCENE_CURRENT)).setOpenMode(OpenMode.CREATE));
- System.out.println("Indexing to directory '" +INDEX_DIR+ "'...");
+ System.out.println("Indexing to directory '" + indexPath + "'...");
+
+ Directory dir = FSDirectory.open(new File(indexPath));
+ Analyzer analyzer = new StandardAnalyzer(Version.LUCENE_40);
+ IndexWriterConfig iwc = new IndexWriterConfig(Version.LUCENE_40, analyzer);
+
+ if (create) {
+ // Create a new index in the directory, removing any
+ // previously indexed documents:
+ iwc.setOpenMode(OpenMode.CREATE);
+ } else {
+ // Add new documents to an existing index:
+ iwc.setOpenMode(OpenMode.CREATE_OR_APPEND);
+ }
+
+ // Optional: for better indexing performance, if you
+ // are indexing many documents, increase the RAM
+ // buffer. But if you do this, increase the max heap
+ // size to the JVM (eg add -Xmx512m or -Xmx1g):
+ //
+ // iwc.setRAMBufferSizeMB(256.0);
+
+ IndexWriter writer = new IndexWriter(dir, iwc);
indexDocs(writer, docDir);
- System.out.println("Optimizing...");
- writer.optimize();
+
+ // NOTE: if you want to maximize search performance,
+ // you can optionally call optimize here. This can be
+ // a costly operation, so generally it's only worth
+ // it when your index is relatively static (ie you're
+ // done adding documents to it):
+ //
+ // writer.optimize();
+
writer.close();
Date end = new Date();
@@ -75,6 +121,21 @@ public class IndexFiles {
}
}
+ /**
+ * Indexes the given file using the given writer, or if a directory is given,
+ * recurses over files and directories found under the given directory.
+ *
+ * NOTE: This method indexes one document per input file. This is slow. For good
+ * throughput, put multiple documents into your input file(s). An example of this is
+ * in the benchmark module, which can create "line doc" files, one document per line,
+ * using the
+ * <a href="../../../../../contrib-benchmark/org/apache/lucene/benchmark/byTask/tasks/WriteLineDocTask.html"
+ * >WriteLineDocTask</a>.
+ *
+ * @param writer Writer to the index where the given file/dir info will be stored
+ * @param file The file to index, or the directory to recurse into to find files to index
+ * @throws IOException
+ */
static void indexDocs(IndexWriter writer, File file)
throws IOException {
// do not try to index files that cannot be read
@@ -88,16 +149,62 @@ public class IndexFiles {
}
}
} else {
- System.out.println("adding " + file);
+
+ FileInputStream fis;
try {
- writer.addDocument(FileDocument.Document(file));
+ fis = new FileInputStream(file);
+ } catch (FileNotFoundException fnfe) {
+ // at least on windows, some temporary files raise this exception with an "access denied" message
+ // checking if the file can be read doesn't help
+ return;
}
- // at least on windows, some temporary files raise this exception with an "access denied" message
- // checking if the file can be read doesn't help
- catch (FileNotFoundException fnfe) {
+
+ try {
+
+ // make a new, empty document
+ Document doc = new Document();
+
+ // Add the path of the file as a field named "path". Use a
+ // field that is indexed (i.e. searchable), but don't tokenize
+ // the field into separate words and don't index term frequency
+ // or positional information:
+ Field pathField = new Field("path", file.getPath(), Field.Store.YES, Field.Index.NOT_ANALYZED_NO_NORMS);
+ pathField.setOmitTermFreqAndPositions(true);
+ doc.add(pathField);
+
+ // Add the last modified date of the file a field named "modified".
+ // Use a NumericField that is indexed (i.e. efficiently filterable with
+ // NumericRangeFilter). This indexes to milli-second resolution, which
+ // is often too fine. You could instead create a number based on
+ // year/month/day/hour/minutes/seconds, down the resolution you require.
+ // For example the long value 2011021714 would mean
+ // February 17, 2011, 2-3 PM.
+ NumericField modifiedField = new NumericField("modified");
+ modifiedField.setLongValue(file.lastModified());
+ doc.add(modifiedField);
+
+ // Add the contents of the file to a field named "contents". Specify a Reader,
+ // so that the text of the file is tokenized and indexed, but not stored.
+ // Note that FileReader expects the file to be in UTF-8 encoding.
+ // If that's not the case searching for special characters will fail.
+ doc.add(new Field("contents", new BufferedReader(new InputStreamReader(fis, "UTF-8"))));
+
+ if (writer.getConfig().getOpenMode() == OpenMode.CREATE) {
+ // New index, so we just add the document (no old document can be there):
+ System.out.println("adding " + file);
+ writer.addDocument(doc);
+ } else {
+ // Existing index (an old copy of this document may have been indexed) so
+ // we use updateDocument instead to replace the old one matching the exact
+ // path, if present:
+ System.out.println("updating " + file);
+ writer.updateDocument(new Term("path", file.getPath()), doc);
+ }
+
+ } finally {
+ fis.close();
}
}
}
}
-
}
Modified: lucene/dev/branches/docvalues/lucene/contrib/demo/src/java/org/apache/lucene/demo/SearchFiles.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/lucene/contrib/demo/src/java/org/apache/lucene/demo/SearchFiles.java?rev=1072973&r1=1072972&r2=1072973&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/lucene/contrib/demo/src/java/org/apache/lucene/demo/SearchFiles.java (original)
+++ lucene/dev/branches/docvalues/lucene/contrib/demo/src/java/org/apache/lucene/demo/SearchFiles.java Mon Feb 21 14:13:28 2011
@@ -27,15 +27,11 @@ import java.util.Date;
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.standard.StandardAnalyzer;
import org.apache.lucene.document.Document;
-import org.apache.lucene.index.IndexReader;
-import org.apache.lucene.index.IndexReader.AtomicReaderContext;
import org.apache.lucene.queryParser.QueryParser;
-import org.apache.lucene.search.Collector;
import org.apache.lucene.search.IndexSearcher;
import org.apache.lucene.search.Query;
import org.apache.lucene.search.ScoreDoc;
-import org.apache.lucene.search.Scorer;
-import org.apache.lucene.search.TopScoreDocCollector;
+import org.apache.lucene.search.TopDocs;
import org.apache.lucene.store.FSDirectory;
import org.apache.lucene.util.Version;
@@ -47,8 +43,7 @@ public class SearchFiles {
/** Simple command-line based search demo. */
public static void main(String[] args) throws Exception {
String usage =
- "Usage:\tjava org.apache.lucene.demo.SearchFiles [-index dir] [-field f] [-repeat n] [-queries file] [-raw] [-paging hitsPerPage]";
- usage += "\n\tSpecify 'false' for hitsPerPage to use streaming instead of paging search.";
+ "Usage:\tjava org.apache.lucene.demo.SearchFiles [-index dir] [-field f] [-repeat n] [-queries file] [-query string] [-raw] [-paging hitsPerPage]\n\nSee http://lucene.apache.org/java/4_0/demo.html for details.";
if (args.length > 0 && ("-h".equals(args[0]) || "-help".equals(args[0]))) {
System.out.println(usage);
System.exit(0);
@@ -59,10 +54,10 @@ public class SearchFiles {
String queries = null;
int repeat = 0;
boolean raw = false;
- boolean paging = true;
+ String queryString = null;
int hitsPerPage = 10;
- for (int i = 0; i < args.length; i++) {
+ for(int i = 0;i < args.length;i++) {
if ("-index".equals(args[i])) {
index = args[i+1];
i++;
@@ -72,28 +67,26 @@ public class SearchFiles {
} else if ("-queries".equals(args[i])) {
queries = args[i+1];
i++;
+ } else if ("-query".equals(args[i])) {
+ queryString = args[i+1];
+ i++;
} else if ("-repeat".equals(args[i])) {
repeat = Integer.parseInt(args[i+1]);
i++;
} else if ("-raw".equals(args[i])) {
raw = true;
} else if ("-paging".equals(args[i])) {
- if (args[i+1].equals("false")) {
- paging = false;
- } else {
- hitsPerPage = Integer.parseInt(args[i+1]);
- if (hitsPerPage == 0) {
- paging = false;
- }
+ hitsPerPage = Integer.parseInt(args[i+1]);
+ if (hitsPerPage <= 0) {
+ System.err.println("There must be at least 1 hit per page.");
+ System.exit(1);
}
i++;
}
}
- IndexReader reader = IndexReader.open(FSDirectory.open(new File(index)), true); // only searching, so read-only=true
-
- IndexSearcher searcher = new IndexSearcher(reader);
- Analyzer analyzer = new StandardAnalyzer(Version.LUCENE_CURRENT);
+ IndexSearcher searcher = new IndexSearcher(FSDirectory.open(new File(index)));
+ Analyzer analyzer = new StandardAnalyzer(Version.LUCENE_40);
BufferedReader in = null;
if (queries != null) {
@@ -101,23 +94,25 @@ public class SearchFiles {
} else {
in = new BufferedReader(new InputStreamReader(System.in, "UTF-8"));
}
- QueryParser parser = new QueryParser(Version.LUCENE_CURRENT, field, analyzer);
+ QueryParser parser = new QueryParser(Version.LUCENE_40, field, analyzer);
while (true) {
- if (queries == null) // prompt the user
+ if (queries == null && queryString == null) { // prompt the user
System.out.println("Enter query: ");
+ }
- String line = in.readLine();
+ String line = queryString != null ? queryString : in.readLine();
- if (line == null || line.length() == -1)
+ if (line == null || line.length() == -1) {
break;
+ }
line = line.trim();
- if (line.length() == 0)
+ if (line.length() == 0) {
break;
+ }
Query query = parser.parse(line);
System.out.println("Searching for: " + query.toString(field));
-
if (repeat > 0) { // repeat & time as benchmark
Date start = new Date();
@@ -128,52 +123,13 @@ public class SearchFiles {
System.out.println("Time: "+(end.getTime()-start.getTime())+"ms");
}
- if (paging) {
- doPagingSearch(in, searcher, query, hitsPerPage, raw, queries == null);
- } else {
- doStreamingSearch(searcher, query);
- }
- }
- reader.close();
- }
-
- /**
- * This method uses a custom HitCollector implementation which simply prints out
- * the docId and score of every matching document.
- *
- * This simulates the streaming search use case, where all hits are supposed to
- * be processed, regardless of their relevance.
- */
- public static void doStreamingSearch(final IndexSearcher searcher, Query query) throws IOException {
- Collector streamingHitCollector = new Collector() {
- private Scorer scorer;
- private int docBase;
-
- // simply print docId and score of every matching document
- @Override
- public void collect(int doc) throws IOException {
- System.out.println("doc=" + doc + docBase + " score=" + scorer.score());
- }
-
- @Override
- public boolean acceptsDocsOutOfOrder() {
- return true;
- }
-
- @Override
- public void setNextReader(AtomicReaderContext context)
- throws IOException {
- this.docBase = context.docBase;
- }
+ doPagingSearch(in, searcher, query, hitsPerPage, raw, queries == null && queryString == null);
- @Override
- public void setScorer(Scorer scorer) throws IOException {
- this.scorer = scorer;
+ if (queryString != null) {
+ break;
}
-
- };
-
- searcher.search(query, streamingHitCollector);
+ }
+ searcher.close();
}
/**
@@ -190,12 +146,10 @@ public class SearchFiles {
int hitsPerPage, boolean raw, boolean interactive) throws IOException {
// Collect enough docs to show 5 pages
- TopScoreDocCollector collector = TopScoreDocCollector.create(
- 5 * hitsPerPage, false);
- searcher.search(query, collector);
- ScoreDoc[] hits = collector.topDocs().scoreDocs;
+ TopDocs results = searcher.search(query, 5 * hitsPerPage);
+ ScoreDoc[] hits = results.scoreDocs;
- int numTotalHits = collector.getTotalHits();
+ int numTotalHits = results.totalHits;
System.out.println(numTotalHits + " total matching documents");
int start = 0;
@@ -210,9 +164,7 @@ public class SearchFiles {
break;
}
- collector = TopScoreDocCollector.create(numTotalHits, false);
- searcher.search(query, collector);
- hits = collector.topDocs().scoreDocs;
+ hits = searcher.search(query, numTotalHits).scoreDocs;
}
end = Math.min(hits.length, start + hitsPerPage);
@@ -237,7 +189,7 @@ public class SearchFiles {
}
- if (!interactive) {
+ if (!interactive || end == 0) {
break;
}
@@ -279,8 +231,6 @@ public class SearchFiles {
if (quit) break;
end = Math.min(numTotalHits, start + hitsPerPage);
}
-
}
-
}
}
Modified: lucene/dev/branches/docvalues/lucene/contrib/demo/src/test/org/apache/lucene/demo/TestDemo.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/lucene/contrib/demo/src/test/org/apache/lucene/demo/TestDemo.java?rev=1072973&r1=1072972&r2=1072973&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/lucene/contrib/demo/src/test/org/apache/lucene/demo/TestDemo.java (original)
+++ lucene/dev/branches/docvalues/lucene/contrib/demo/src/test/org/apache/lucene/demo/TestDemo.java Mon Feb 21 14:13:28 2011
@@ -24,43 +24,30 @@ import java.io.PrintStream;
import org.apache.lucene.util.LuceneTestCase;
public class TestDemo extends LuceneTestCase {
- // LUCENE-589
- public void testUnicodeHtml() throws Exception {
- File dir = getDataFile("test-files/html");
- File indexDir = new File(TEMP_DIR, "demoIndex");
- IndexHTML.main(new String[] { "-create", "-index", indexDir.getPath(), dir.getPath() });
- File queries = getDataFile("test-files/queries.txt");
+
+ private void testOneSearch(String query, int expectedHitCount) throws Exception {
PrintStream outSave = System.out;
try {
ByteArrayOutputStream bytes = new ByteArrayOutputStream();
PrintStream fakeSystemOut = new PrintStream(bytes);
System.setOut(fakeSystemOut);
- SearchFiles.main(new String[] { "-index", indexDir.getPath(), "-queries", queries.getPath()});
+ SearchFiles.main(new String[] {"-query", query});
fakeSystemOut.flush();
String output = bytes.toString(); // intentionally use default encoding
- assertTrue(output.contains("1 total matching documents"));
+ assertTrue("output=" + output, output.contains(expectedHitCount + " total matching documents"));
} finally {
System.setOut(outSave);
}
}
-
- // LUCENE-591
- public void testIndexKeywords() throws Exception {
- File dir = getDataFile("test-files/html");
- File indexDir = new File(TEMP_DIR, "demoIndex2");
- IndexHTML.main(new String[] { "-create", "-index", indexDir.getPath(), dir.getPath() });
- File queries = getDataFile("test-files/queries2.txt");
- PrintStream outSave = System.out;
- try {
- ByteArrayOutputStream bytes = new ByteArrayOutputStream();
- PrintStream fakeSystemOut = new PrintStream(bytes);
- System.setOut(fakeSystemOut);
- SearchFiles.main(new String[] { "-index", indexDir.getPath(), "-queries", queries.getPath()});
- fakeSystemOut.flush();
- String output = bytes.toString(); // intentionally use default encoding
- assertTrue(output.contains("1 total matching documents"));
- } finally {
- System.setOut(outSave);
- }
+
+ public void testIndexSearch() throws Exception {
+ File dir = getDataFile("test-files/docs");
+ IndexFiles.main(new String[] { "-create", "-docs", dir.getPath() });
+ testOneSearch("apache", 3);
+ testOneSearch("patent", 8);
+ testOneSearch("lucene", 0);
+ testOneSearch("gnu", 6);
+ testOneSearch("derivative", 8);
+ testOneSearch("license", 13);
}
}
Modified: lucene/dev/branches/docvalues/lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/FieldSetting.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/FieldSetting.java?rev=1072973&r1=1072972&r2=1072973&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/FieldSetting.java (original)
+++ lucene/dev/branches/docvalues/lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/FieldSetting.java Mon Feb 21 14:13:28 2011
@@ -1,7 +1,5 @@
package org.apache.lucene.store.instantiated;
-import java.io.Serializable;
-
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -22,7 +20,7 @@ import java.io.Serializable;
/**
* For non package access see {@link org.apache.lucene.index.IndexReader#getFieldNames(org.apache.lucene.index.IndexReader.FieldOption)}
*/
-class FieldSetting implements Serializable {
+class FieldSetting {
String fieldName;
boolean storeTermVector = false;
Modified: lucene/dev/branches/docvalues/lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/FieldSettings.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/FieldSettings.java?rev=1072973&r1=1072972&r2=1072973&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/FieldSettings.java (original)
+++ lucene/dev/branches/docvalues/lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/FieldSettings.java Mon Feb 21 14:13:28 2011
@@ -3,7 +3,6 @@ package org.apache.lucene.store.instanti
import java.util.HashMap;
import java.util.Map;
import java.util.Collection;
-import java.io.Serializable;
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -25,7 +24,7 @@ import java.io.Serializable;
/**
* Essentially a Map<FieldName, {@link org.apache.lucene.store.instantiated.FieldSetting}>
*/
-class FieldSettings implements Serializable {
+class FieldSettings {
FieldSettings() {
Modified: lucene/dev/branches/docvalues/lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedDocument.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedDocument.java?rev=1072973&r1=1072972&r2=1072973&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedDocument.java (original)
+++ lucene/dev/branches/docvalues/lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedDocument.java Mon Feb 21 14:13:28 2011
@@ -18,7 +18,6 @@ package org.apache.lucene.store.instanti
import org.apache.lucene.document.Document;
-import java.io.Serializable;
import java.util.List;
import java.util.Map;
@@ -27,10 +26,7 @@ import java.util.Map;
*
* @see org.apache.lucene.document.Document
*/
-public class InstantiatedDocument
- implements Serializable {
-
- private static final long serialVersionUID = 1l;
+public class InstantiatedDocument {
private Document document;
Modified: lucene/dev/branches/docvalues/lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedIndex.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedIndex.java?rev=1072973&r1=1072972&r2=1072973&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedIndex.java (original)
+++ lucene/dev/branches/docvalues/lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedIndex.java Mon Feb 21 14:13:28 2011
@@ -18,7 +18,6 @@ package org.apache.lucene.store.instanti
import java.io.Closeable;
import java.io.IOException;
-import java.io.Serializable;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
@@ -60,9 +59,7 @@ import org.apache.lucene.util.BytesRef;
* Consider using InstantiatedIndex as if it was immutable.
*/
public class InstantiatedIndex
- implements Serializable,Closeable {
-
- private static final long serialVersionUID = 1l;
+ implements Closeable {
private long version = System.currentTimeMillis();
Modified: lucene/dev/branches/docvalues/lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedIndexWriter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedIndexWriter.java?rev=1072973&r1=1072972&r2=1072973&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedIndexWriter.java (original)
+++ lucene/dev/branches/docvalues/lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedIndexWriter.java Mon Feb 21 14:13:28 2011
@@ -241,7 +241,7 @@ public class InstantiatedIndexWriter imp
final FieldInvertState invertState = new FieldInvertState();
invertState.setBoost(eFieldTermDocInfoFactoriesByTermText.getKey().boost * document.getDocument().getBoost());
invertState.setLength(eFieldTermDocInfoFactoriesByTermText.getKey().fieldLength);
- final float norm = similarityProvider.get(fieldName).computeNorm(fieldName, invertState);
+ final float norm = similarityProvider.get(fieldName).computeNorm(invertState);
normsByFieldNameAndDocumentNumber.get(fieldName)[document.getDocumentNumber()] = similarityProvider.get(fieldName).encodeNormValue(norm);
} else {
System.currentTimeMillis();
Modified: lucene/dev/branches/docvalues/lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedTerm.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedTerm.java?rev=1072973&r1=1072972&r2=1072973&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedTerm.java (original)
+++ lucene/dev/branches/docvalues/lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedTerm.java Mon Feb 21 14:13:28 2011
@@ -16,7 +16,6 @@ package org.apache.lucene.store.instanti
* limitations under the License.
*/
-import java.io.Serializable;
import java.util.Comparator;
import org.apache.lucene.index.Term;
@@ -26,10 +25,7 @@ import org.apache.lucene.index.Term;
*
* @see org.apache.lucene.index.Term
*/
-public class InstantiatedTerm
- implements Serializable {
-
- private static final long serialVersionUID = 1l;
+public class InstantiatedTerm {
public static final Comparator<InstantiatedTerm> comparator = new Comparator<InstantiatedTerm>() {
public int compare(InstantiatedTerm instantiatedTerm, InstantiatedTerm instantiatedTerm1) {
Modified: lucene/dev/branches/docvalues/lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedTermDocumentInformation.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedTermDocumentInformation.java?rev=1072973&r1=1072972&r2=1072973&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedTermDocumentInformation.java (original)
+++ lucene/dev/branches/docvalues/lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedTermDocumentInformation.java Mon Feb 21 14:13:28 2011
@@ -2,7 +2,6 @@ package org.apache.lucene.store.instanti
import org.apache.lucene.index.TermVectorOffsetInfo;
-import java.io.Serializable;
import java.util.Comparator;
/**
@@ -38,10 +37,7 @@ import java.util.Comparator;
* </pre>
*
*/
-public class InstantiatedTermDocumentInformation
- implements Serializable {
-
- private static final long serialVersionUID = 1l;
+public class InstantiatedTermDocumentInformation {
public static final Comparator<InstantiatedTermDocumentInformation> termComparator = new Comparator<InstantiatedTermDocumentInformation>() {
public int compare(InstantiatedTermDocumentInformation instantiatedTermDocumentInformation, InstantiatedTermDocumentInformation instantiatedTermDocumentInformation1) {
Modified: lucene/dev/branches/docvalues/lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedTermFreqVector.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedTermFreqVector.java?rev=1072973&r1=1072972&r2=1072973&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedTermFreqVector.java (original)
+++ lucene/dev/branches/docvalues/lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedTermFreqVector.java Mon Feb 21 14:13:28 2011
@@ -3,7 +3,6 @@ package org.apache.lucene.store.instanti
import org.apache.lucene.index.TermFreqVector;
import org.apache.lucene.util.BytesRef;
-import java.io.Serializable;
import java.util.Arrays;
import java.util.List;
@@ -29,9 +28,7 @@ import java.util.List;
* @see org.apache.lucene.index.TermFreqVector
*/
public class InstantiatedTermFreqVector
- implements TermFreqVector, Serializable {
-
- private static final long serialVersionUID = 1l;
+ implements TermFreqVector {
private final List<InstantiatedTermDocumentInformation> termDocumentInformations;
private final String field;
Modified: lucene/dev/branches/docvalues/lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedTermPositionVector.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedTermPositionVector.java?rev=1072973&r1=1072972&r2=1072973&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedTermPositionVector.java (original)
+++ lucene/dev/branches/docvalues/lucene/contrib/instantiated/src/java/org/apache/lucene/store/instantiated/InstantiatedTermPositionVector.java Mon Feb 21 14:13:28 2011
@@ -19,8 +19,6 @@ package org.apache.lucene.store.instanti
import org.apache.lucene.index.TermPositionVector;
import org.apache.lucene.index.TermVectorOffsetInfo;
-import java.io.Serializable;
-
/**
* Extended vector space view of a document in an {@link InstantiatedIndexReader}.
*
@@ -28,9 +26,7 @@ import java.io.Serializable;
*/
public class InstantiatedTermPositionVector
extends InstantiatedTermFreqVector
- implements TermPositionVector, Serializable {
-
- private static final long serialVersionUID = 1l;
+ implements TermPositionVector {
public InstantiatedTermPositionVector(InstantiatedDocument document, String field) {
super(document, field);
Modified: lucene/dev/branches/docvalues/lucene/contrib/memory/src/java/org/apache/lucene/index/memory/MemoryIndex.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/lucene/contrib/memory/src/java/org/apache/lucene/index/memory/MemoryIndex.java?rev=1072973&r1=1072972&r2=1072973&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/lucene/contrib/memory/src/java/org/apache/lucene/index/memory/MemoryIndex.java (original)
+++ lucene/dev/branches/docvalues/lucene/contrib/memory/src/java/org/apache/lucene/index/memory/MemoryIndex.java Mon Feb 21 14:13:28 2011
@@ -18,7 +18,6 @@ package org.apache.lucene.index.memory;
*/
import java.io.IOException;
-import java.io.Serializable;
import java.io.StringReader;
import java.util.Arrays;
import java.util.Collection;
@@ -187,7 +186,7 @@ import org.apache.lucene.util.Constants;
* hprof tracing </a>).
*
*/
-public class MemoryIndex implements Serializable {
+public class MemoryIndex {
/** info for each field: Map<String fieldName, Info field> */
private final HashMap<String,Info> fields = new HashMap<String,Info>();
@@ -200,8 +199,6 @@ public class MemoryIndex implements Seri
/** Could be made configurable; See {@link Document#setBoost(float)} */
private static final float docBoost = 1.0f;
-
- private static final long serialVersionUID = 2782195016849084649L;
private static final boolean DEBUG = false;
@@ -590,7 +587,7 @@ public class MemoryIndex implements Seri
* Index data structure for a field; Contains the tokenized term texts and
* their positions.
*/
- private static final class Info implements Serializable {
+ private static final class Info {
/**
* Term strings and their positions for this field: Map <String
@@ -615,8 +612,6 @@ public class MemoryIndex implements Seri
private final long sumTotalTermFreq;
- private static final long serialVersionUID = 2882195016849084649L;
-
public Info(HashMap<BytesRef,ArrayIntList> terms, int numTokens, int numOverlapTokens, float boost) {
this.terms = terms;
this.numTokens = numTokens;
@@ -669,12 +664,10 @@ public class MemoryIndex implements Seri
* Efficient resizable auto-expanding list holding <code>int</code> elements;
* implemented with arrays.
*/
- private static final class ArrayIntList implements Serializable {
+ private static final class ArrayIntList {
private int[] elements;
private int size = 0;
-
- private static final long serialVersionUID = 2282195016849084649L;
public ArrayIntList() {
this(10);
@@ -1210,7 +1203,7 @@ public class MemoryIndex implements Seri
int numOverlapTokens = info != null ? info.numOverlapTokens : 0;
float boost = info != null ? info.getBoost() : 1.0f;
FieldInvertState invertState = new FieldInvertState(0, numTokens, numOverlapTokens, 0, boost);
- float n = fieldSim.computeNorm(fieldName, invertState);
+ float n = fieldSim.computeNorm(invertState);
byte norm = fieldSim.encodeNormValue(n);
norms = new byte[] {norm};
Modified: lucene/dev/branches/docvalues/lucene/contrib/misc/src/java/org/apache/lucene/index/FieldNormModifier.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/lucene/contrib/misc/src/java/org/apache/lucene/index/FieldNormModifier.java?rev=1072973&r1=1072972&r2=1072973&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/lucene/contrib/misc/src/java/org/apache/lucene/index/FieldNormModifier.java (original)
+++ lucene/dev/branches/docvalues/lucene/contrib/misc/src/java/org/apache/lucene/index/FieldNormModifier.java Mon Feb 21 14:13:28 2011
@@ -149,7 +149,7 @@ public class FieldNormModifier {
for (int d = 0; d < termCounts.length; d++) {
if (delDocs == null || !delDocs.get(d)) {
invertState.setLength(termCounts[d]);
- subReader.setNorm(d, fieldName, fieldSim.encodeNormValue(fieldSim.computeNorm(fieldName, invertState)));
+ subReader.setNorm(d, fieldName, fieldSim.encodeNormValue(fieldSim.computeNorm(invertState)));
}
}
}
Modified: lucene/dev/branches/docvalues/lucene/contrib/misc/src/java/org/apache/lucene/index/codecs/appending/AppendingCodec.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/lucene/contrib/misc/src/java/org/apache/lucene/index/codecs/appending/AppendingCodec.java?rev=1072973&r1=1072972&r2=1072973&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/lucene/contrib/misc/src/java/org/apache/lucene/index/codecs/appending/AppendingCodec.java (original)
+++ lucene/dev/branches/docvalues/lucene/contrib/misc/src/java/org/apache/lucene/index/codecs/appending/AppendingCodec.java Mon Feb 21 14:13:28 2011
@@ -71,7 +71,7 @@ public class AppendingCodec extends Code
}
success = false;
try {
- FieldsConsumer ret = new AppendingTermsDictWriter(indexWriter, state, docsWriter, BytesRef.getUTF8SortedAsUnicodeComparator());
+ FieldsConsumer ret = new AppendingTermsDictWriter(indexWriter, state, docsWriter);
success = true;
return ret;
} finally {
@@ -111,7 +111,6 @@ public class AppendingCodec extends Code
state.dir, state.fieldInfos, state.segmentInfo.name,
docsReader,
state.readBufferSize,
- BytesRef.getUTF8SortedAsUnicodeComparator(),
StandardCodec.TERMS_CACHE_SIZE,
state.codecId);
success = true;
Modified: lucene/dev/branches/docvalues/lucene/contrib/misc/src/java/org/apache/lucene/index/codecs/appending/AppendingTermsDictReader.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/lucene/contrib/misc/src/java/org/apache/lucene/index/codecs/appending/AppendingTermsDictReader.java?rev=1072973&r1=1072972&r2=1072973&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/lucene/contrib/misc/src/java/org/apache/lucene/index/codecs/appending/AppendingTermsDictReader.java (original)
+++ lucene/dev/branches/docvalues/lucene/contrib/misc/src/java/org/apache/lucene/index/codecs/appending/AppendingTermsDictReader.java Mon Feb 21 14:13:28 2011
@@ -18,7 +18,6 @@ package org.apache.lucene.index.codecs.a
*/
import java.io.IOException;
-import java.util.Comparator;
import org.apache.lucene.index.FieldInfos;
import org.apache.lucene.index.codecs.PostingsReaderBase;
@@ -27,7 +26,6 @@ import org.apache.lucene.index.codecs.Bl
import org.apache.lucene.index.codecs.TermsIndexReaderBase;
import org.apache.lucene.store.Directory;
import org.apache.lucene.store.IndexInput;
-import org.apache.lucene.util.BytesRef;
import org.apache.lucene.util.CodecUtil;
public class AppendingTermsDictReader extends BlockTermsReader {
@@ -35,9 +33,9 @@ public class AppendingTermsDictReader ex
public AppendingTermsDictReader(TermsIndexReaderBase indexReader,
Directory dir, FieldInfos fieldInfos, String segment,
PostingsReaderBase postingsReader, int readBufferSize,
- Comparator<BytesRef> termComp, int termsCacheSize, String codecId) throws IOException {
+ int termsCacheSize, String codecId) throws IOException {
super(indexReader, dir, fieldInfos, segment, postingsReader, readBufferSize,
- termComp, termsCacheSize, codecId);
+ termsCacheSize, codecId);
}
@Override
Modified: lucene/dev/branches/docvalues/lucene/contrib/misc/src/java/org/apache/lucene/index/codecs/appending/AppendingTermsDictWriter.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/lucene/contrib/misc/src/java/org/apache/lucene/index/codecs/appending/AppendingTermsDictWriter.java?rev=1072973&r1=1072972&r2=1072973&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/lucene/contrib/misc/src/java/org/apache/lucene/index/codecs/appending/AppendingTermsDictWriter.java (original)
+++ lucene/dev/branches/docvalues/lucene/contrib/misc/src/java/org/apache/lucene/index/codecs/appending/AppendingTermsDictWriter.java Mon Feb 21 14:13:28 2011
@@ -18,23 +18,21 @@ package org.apache.lucene.index.codecs.a
*/
import java.io.IOException;
-import java.util.Comparator;
import org.apache.lucene.index.SegmentWriteState;
import org.apache.lucene.index.codecs.PostingsWriterBase;
import org.apache.lucene.index.codecs.BlockTermsWriter;
import org.apache.lucene.index.codecs.TermsIndexWriterBase;
import org.apache.lucene.store.IndexOutput;
-import org.apache.lucene.util.BytesRef;
import org.apache.lucene.util.CodecUtil;
public class AppendingTermsDictWriter extends BlockTermsWriter {
final static String CODEC_NAME = "APPENDING_TERMS_DICT";
public AppendingTermsDictWriter(TermsIndexWriterBase indexWriter,
- SegmentWriteState state, PostingsWriterBase postingsWriter,
- Comparator<BytesRef> termComp) throws IOException {
- super(indexWriter, state, postingsWriter, termComp);
+ SegmentWriteState state, PostingsWriterBase postingsWriter)
+ throws IOException {
+ super(indexWriter, state, postingsWriter);
}
@Override
Modified: lucene/dev/branches/docvalues/lucene/contrib/misc/src/java/org/apache/lucene/misc/SweetSpotSimilarity.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/lucene/contrib/misc/src/java/org/apache/lucene/misc/SweetSpotSimilarity.java?rev=1072973&r1=1072972&r2=1072973&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/lucene/contrib/misc/src/java/org/apache/lucene/misc/SweetSpotSimilarity.java (original)
+++ lucene/dev/branches/docvalues/lucene/contrib/misc/src/java/org/apache/lucene/misc/SweetSpotSimilarity.java Mon Feb 21 14:13:28 2011
@@ -20,9 +20,6 @@ package org.apache.lucene.misc;
import org.apache.lucene.search.DefaultSimilarity;
import org.apache.lucene.index.FieldInvertState;
-import java.util.Map;
-import java.util.HashMap;
-
/**
* A similarity with a lengthNorm that provides for a "plateau" of
* equally good lengths, and tf helper functions.
@@ -50,11 +47,6 @@ public class SweetSpotSimilarity extends
private int ln_max = 1;
private float ln_steep = 0.5f;
- private Map<String,Number> ln_maxs = new HashMap<String,Number>(7);
- private Map<String,Number> ln_mins = new HashMap<String,Number>(7);
- private Map<String,Float> ln_steeps = new HashMap<String,Float>(7);
- private Map<String,Boolean> ln_overlaps = new HashMap<String,Boolean>(7);
-
private float tf_base = 0.0f;
private float tf_min = 0.0f;
@@ -98,55 +90,31 @@ public class SweetSpotSimilarity extends
* Sets the default function variables used by lengthNorm when no field
* specific variables have been set.
*
- * @see #lengthNorm
+ * @see #computeLengthNorm
*/
- public void setLengthNormFactors(int min, int max, float steepness) {
+ public void setLengthNormFactors(int min, int max, float steepness, boolean discountOverlaps) {
this.ln_min = min;
this.ln_max = max;
this.ln_steep = steepness;
- }
-
- /**
- * Sets the function variables used by lengthNorm for a specific named field.
- *
- * @param field field name
- * @param min minimum value
- * @param max maximum value
- * @param steepness steepness of the curve
- * @param discountOverlaps if true, <code>numOverlapTokens</code> will be
- * subtracted from <code>numTokens</code>; if false then
- * <code>numOverlapTokens</code> will be assumed to be 0 (see
- * {@link DefaultSimilarity#computeNorm(String, FieldInvertState)} for details).
- *
- * @see #lengthNorm
- */
- public void setLengthNormFactors(String field, int min, int max,
- float steepness, boolean discountOverlaps) {
- ln_mins.put(field, Integer.valueOf(min));
- ln_maxs.put(field, Integer.valueOf(max));
- ln_steeps.put(field, Float.valueOf(steepness));
- ln_overlaps.put(field, new Boolean(discountOverlaps));
+ this.discountOverlaps = discountOverlaps;
}
/**
* Implemented as <code> state.getBoost() *
- * lengthNorm(fieldName, numTokens) </code> where
+ * computeLengthNorm(numTokens) </code> where
* numTokens does not count overlap tokens if
* discountOverlaps is true by default or true for this
* specific field. */
@Override
- public float computeNorm(String fieldName, FieldInvertState state) {
+ public float computeNorm(FieldInvertState state) {
final int numTokens;
- boolean overlaps = discountOverlaps;
- if (ln_overlaps.containsKey(fieldName)) {
- overlaps = ln_overlaps.get(fieldName).booleanValue();
- }
- if (overlaps)
+
+ if (discountOverlaps)
numTokens = state.getLength() - state.getNumOverlap();
else
numTokens = state.getLength();
- return state.getBoost() * computeLengthNorm(fieldName, numTokens);
+ return state.getBoost() * computeLengthNorm(numTokens);
}
/**
@@ -167,20 +135,10 @@ public class SweetSpotSimilarity extends
*
* @see #setLengthNormFactors
*/
- public float computeLengthNorm(String fieldName, int numTerms) {
- int l = ln_min;
- int h = ln_max;
- float s = ln_steep;
-
- if (ln_mins.containsKey(fieldName)) {
- l = ln_mins.get(fieldName).intValue();
- }
- if (ln_maxs.containsKey(fieldName)) {
- h = ln_maxs.get(fieldName).intValue();
- }
- if (ln_steeps.containsKey(fieldName)) {
- s = ln_steeps.get(fieldName).floatValue();
- }
+ public float computeLengthNorm(int numTerms) {
+ final int l = ln_min;
+ final int h = ln_max;
+ final float s = ln_steep;
return (float)
(1.0f /
Modified: lucene/dev/branches/docvalues/lucene/contrib/misc/src/test/org/apache/lucene/index/TestFieldNormModifier.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/lucene/contrib/misc/src/test/org/apache/lucene/index/TestFieldNormModifier.java?rev=1072973&r1=1072972&r2=1072973&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/lucene/contrib/misc/src/test/org/apache/lucene/index/TestFieldNormModifier.java (original)
+++ lucene/dev/branches/docvalues/lucene/contrib/misc/src/test/org/apache/lucene/index/TestFieldNormModifier.java Mon Feb 21 14:13:28 2011
@@ -44,7 +44,7 @@ public class TestFieldNormModifier exten
/** inverts the normal notion of lengthNorm */
public static SimilarityProvider s = new DefaultSimilarity() {
@Override
- public float computeNorm(String fieldName, FieldInvertState state) {
+ public float computeNorm(FieldInvertState state) {
return state.getBoost() * (discountOverlaps ? state.getLength() - state.getNumOverlap() : state.getLength());
}
};
Modified: lucene/dev/branches/docvalues/lucene/contrib/misc/src/test/org/apache/lucene/misc/SweetSpotSimilarityTest.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/lucene/contrib/misc/src/test/org/apache/lucene/misc/SweetSpotSimilarityTest.java?rev=1072973&r1=1072972&r2=1072973&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/lucene/contrib/misc/src/test/org/apache/lucene/misc/SweetSpotSimilarityTest.java (original)
+++ lucene/dev/branches/docvalues/lucene/contrib/misc/src/test/org/apache/lucene/misc/SweetSpotSimilarityTest.java Mon Feb 21 14:13:28 2011
@@ -20,6 +20,7 @@ package org.apache.lucene.misc;
import org.apache.lucene.search.DefaultSimilarity;
import org.apache.lucene.search.Similarity;
+import org.apache.lucene.search.SimilarityProvider;
import org.apache.lucene.util.LuceneTestCase;
import org.apache.lucene.index.FieldInvertState;
@@ -30,8 +31,8 @@ public class SweetSpotSimilarityTest ext
public void testSweetSpotComputeNorm() {
- SweetSpotSimilarity ss = new SweetSpotSimilarity();
- ss.setLengthNormFactors(1,1,0.5f);
+ final SweetSpotSimilarity ss = new SweetSpotSimilarity();
+ ss.setLengthNormFactors(1,1,0.5f,true);
Similarity d = new DefaultSimilarity();
Similarity s = ss;
@@ -43,28 +44,28 @@ public class SweetSpotSimilarityTest ext
for (int i = 1; i < 1000; i++) {
invertState.setLength(i);
assertEquals("base case: i="+i,
- d.computeNorm("foo", invertState),
- s.computeNorm("foo", invertState),
+ d.computeNorm(invertState),
+ s.computeNorm(invertState),
0.0f);
}
// make a sweet spot
- ss.setLengthNormFactors(3,10,0.5f);
+ ss.setLengthNormFactors(3,10,0.5f,true);
for (int i = 3; i <=10; i++) {
invertState.setLength(i);
assertEquals("3,10: spot i="+i,
1.0f,
- s.computeNorm("foo", invertState),
+ s.computeNorm(invertState),
0.0f);
}
for (int i = 10; i < 1000; i++) {
invertState.setLength(i-9);
- final float normD = d.computeNorm("foo", invertState);
+ final float normD = d.computeNorm(invertState);
invertState.setLength(i);
- final float normS = s.computeNorm("foo", invertState);
+ final float normS = s.computeNorm(invertState);
assertEquals("3,10: 10<x : i="+i,
normD,
normS,
@@ -74,22 +75,42 @@ public class SweetSpotSimilarityTest ext
// seperate sweet spot for certain fields
- ss.setLengthNormFactors("bar",8,13, 0.5f, false);
- ss.setLengthNormFactors("yak",6,9, 0.5f, false);
-
+ final SweetSpotSimilarity ssBar = new SweetSpotSimilarity();
+ ssBar.setLengthNormFactors(8,13, 0.5f, false);
+ final SweetSpotSimilarity ssYak = new SweetSpotSimilarity();
+ ssYak.setLengthNormFactors(6,9, 0.5f, false);
+ final SweetSpotSimilarity ssA = new SweetSpotSimilarity();
+ ssA.setLengthNormFactors(5,8,0.5f, false);
+ final SweetSpotSimilarity ssB = new SweetSpotSimilarity();
+ ssB.setLengthNormFactors(5,8,0.1f, false);
+
+ SimilarityProvider sp = new SweetSpotSimilarity() {
+ public Similarity get(String field) {
+ if (field.equals("bar"))
+ return ssBar;
+ else if (field.equals("yak"))
+ return ssYak;
+ else if (field.equals("a"))
+ return ssA;
+ else if (field.equals("b"))
+ return ssB;
+ else
+ return ss;
+ }
+ };
for (int i = 3; i <=10; i++) {
invertState.setLength(i);
assertEquals("f: 3,10: spot i="+i,
1.0f,
- s.computeNorm("foo", invertState),
+ sp.get("foo").computeNorm(invertState),
0.0f);
}
for (int i = 10; i < 1000; i++) {
invertState.setLength(i-9);
- final float normD = d.computeNorm("foo", invertState);
+ final float normD = d.computeNorm(invertState);
invertState.setLength(i);
- final float normS = s.computeNorm("foo", invertState);
+ final float normS = sp.get("foo").computeNorm(invertState);
assertEquals("f: 3,10: 10<x : i="+i,
normD,
normS,
@@ -99,21 +120,21 @@ public class SweetSpotSimilarityTest ext
invertState.setLength(i);
assertEquals("f: 8,13: spot i="+i,
1.0f,
- s.computeNorm("bar", invertState),
+ sp.get("bar").computeNorm(invertState),
0.0f);
}
for (int i = 6; i <=9; i++) {
invertState.setLength(i);
assertEquals("f: 6,9: spot i="+i,
1.0f,
- s.computeNorm("yak", invertState),
+ sp.get("yak").computeNorm(invertState),
0.0f);
}
for (int i = 13; i < 1000; i++) {
invertState.setLength(i-12);
- final float normD = d.computeNorm("foo", invertState);
+ final float normD = d.computeNorm(invertState);
invertState.setLength(i);
- final float normS = s.computeNorm("bar", invertState);
+ final float normS = sp.get("bar").computeNorm(invertState);
assertEquals("f: 8,13: 13<x : i="+i,
normD,
normS,
@@ -121,9 +142,9 @@ public class SweetSpotSimilarityTest ext
}
for (int i = 9; i < 1000; i++) {
invertState.setLength(i-8);
- final float normD = d.computeNorm("foo", invertState);
+ final float normD = d.computeNorm(invertState);
invertState.setLength(i);
- final float normS = s.computeNorm("yak", invertState);
+ final float normS = sp.get("yak").computeNorm(invertState);
assertEquals("f: 6,9: 9<x : i="+i,
normD,
normS,
@@ -133,13 +154,10 @@ public class SweetSpotSimilarityTest ext
// steepness
- ss.setLengthNormFactors("a",5,8,0.5f, false);
- ss.setLengthNormFactors("b",5,8,0.1f, false);
-
for (int i = 9; i < 1000; i++) {
invertState.setLength(i);
- final float normSS = ss.computeNorm("a", invertState);
- final float normS = s.computeNorm("b", invertState);
+ final float normSS = sp.get("a").computeNorm(invertState);
+ final float normS = sp.get("b").computeNorm(invertState);
assertTrue("s: i="+i+" : a="+normSS+
" < b="+normS,
normSS < normS);
Modified: lucene/dev/branches/docvalues/lucene/contrib/misc/src/test/org/apache/lucene/misc/TestLengthNormModifier.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/lucene/contrib/misc/src/test/org/apache/lucene/misc/TestLengthNormModifier.java?rev=1072973&r1=1072972&r2=1072973&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/lucene/contrib/misc/src/test/org/apache/lucene/misc/TestLengthNormModifier.java (original)
+++ lucene/dev/branches/docvalues/lucene/contrib/misc/src/test/org/apache/lucene/misc/TestLengthNormModifier.java Mon Feb 21 14:13:28 2011
@@ -49,7 +49,7 @@ public class TestLengthNormModifier exte
/** inverts the normal notion of lengthNorm */
public static SimilarityProvider s = new DefaultSimilarity() {
@Override
- public float computeNorm(String fieldName, FieldInvertState state) {
+ public float computeNorm(FieldInvertState state) {
return state.getBoost() * (discountOverlaps ? state.getLength() - state.getNumOverlap() : state.getLength());
}
};
@@ -165,7 +165,7 @@ public class TestLengthNormModifier exte
// override the norms to be inverted
SimilarityProvider s = new DefaultSimilarity() {
@Override
- public float computeNorm(String fieldName, FieldInvertState state) {
+ public float computeNorm(FieldInvertState state) {
return state.getBoost() * (discountOverlaps ? state.getLength() - state.getNumOverlap() : state.getLength());
}
};
Modified: lucene/dev/branches/docvalues/lucene/contrib/queries/src/java/org/apache/lucene/search/FilterClause.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/lucene/contrib/queries/src/java/org/apache/lucene/search/FilterClause.java?rev=1072973&r1=1072972&r2=1072973&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/lucene/contrib/queries/src/java/org/apache/lucene/search/FilterClause.java (original)
+++ lucene/dev/branches/docvalues/lucene/contrib/queries/src/java/org/apache/lucene/search/FilterClause.java Mon Feb 21 14:13:28 2011
@@ -26,7 +26,7 @@ import org.apache.lucene.search.BooleanC
* of queries.)
*/
-public class FilterClause implements java.io.Serializable
+public class FilterClause
{
Occur occur = null;
Filter filter = null;
Modified: lucene/dev/branches/docvalues/lucene/contrib/queries/src/java/org/apache/lucene/search/regex/RegexCapabilities.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/lucene/contrib/queries/src/java/org/apache/lucene/search/regex/RegexCapabilities.java?rev=1072973&r1=1072972&r2=1072973&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/lucene/contrib/queries/src/java/org/apache/lucene/search/regex/RegexCapabilities.java (original)
+++ lucene/dev/branches/docvalues/lucene/contrib/queries/src/java/org/apache/lucene/search/regex/RegexCapabilities.java Mon Feb 21 14:13:28 2011
@@ -1,7 +1,5 @@
package org.apache.lucene.search.regex;
-import java.io.Serializable;
-
import org.apache.lucene.util.BytesRef;
/**
@@ -25,7 +23,7 @@ import org.apache.lucene.util.BytesRef;
* Defines basic operations needed by {@link RegexQuery} for a regular
* expression implementation.
*/
-public interface RegexCapabilities extends Serializable {
+public interface RegexCapabilities {
/**
* Called by the constructor of {@link RegexTermsEnum} allowing
* implementations to cache a compiled version of the regular
Modified: lucene/dev/branches/docvalues/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/QueryNodeError.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/QueryNodeError.java?rev=1072973&r1=1072972&r2=1072973&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/QueryNodeError.java (original)
+++ lucene/dev/branches/docvalues/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/QueryNodeError.java Mon Feb 21 14:13:28 2011
@@ -27,8 +27,6 @@ import org.apache.lucene.messages.NLSExc
* @see org.apache.lucene.messages.Message
*/
public class QueryNodeError extends Error implements NLSException {
-
- private static final long serialVersionUID = 1804855832182710327L;
private Message message;
/**
Modified: lucene/dev/branches/docvalues/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/QueryNodeException.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/QueryNodeException.java?rev=1072973&r1=1072972&r2=1072973&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/QueryNodeException.java (original)
+++ lucene/dev/branches/docvalues/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/QueryNodeException.java Mon Feb 21 14:13:28 2011
@@ -42,8 +42,6 @@ import org.apache.lucene.queryParser.cor
*/
public class QueryNodeException extends Exception implements NLSException {
- private static final long serialVersionUID = -5962648855261624214L;
-
protected Message message = new MessageImpl(QueryParserMessages.EMPTY_MESSAGE);
public QueryNodeException(Message message) {
Modified: lucene/dev/branches/docvalues/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/QueryNodeParseException.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/QueryNodeParseException.java?rev=1072973&r1=1072972&r2=1072973&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/QueryNodeParseException.java (original)
+++ lucene/dev/branches/docvalues/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/QueryNodeParseException.java Mon Feb 21 14:13:28 2011
@@ -33,8 +33,6 @@ import org.apache.lucene.queryParser.cor
*/
public class QueryNodeParseException extends QueryNodeException {
- private static final long serialVersionUID = 8197535103538766773L;
-
private CharSequence query;
private int beginColumn = -1;
Modified: lucene/dev/branches/docvalues/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/nodes/AndQueryNode.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/nodes/AndQueryNode.java?rev=1072973&r1=1072972&r2=1072973&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/nodes/AndQueryNode.java (original)
+++ lucene/dev/branches/docvalues/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/nodes/AndQueryNode.java Mon Feb 21 14:13:28 2011
@@ -27,8 +27,6 @@ import org.apache.lucene.queryParser.cor
*/
public class AndQueryNode extends BooleanQueryNode {
- private static final long serialVersionUID = 118496077529151825L;
-
/**
* @param clauses
* - the query nodes to be and'ed
Modified: lucene/dev/branches/docvalues/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/nodes/AnyQueryNode.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/nodes/AnyQueryNode.java?rev=1072973&r1=1072972&r2=1072973&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/nodes/AnyQueryNode.java (original)
+++ lucene/dev/branches/docvalues/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/nodes/AnyQueryNode.java Mon Feb 21 14:13:28 2011
@@ -26,8 +26,6 @@ import org.apache.lucene.queryParser.cor
* nodes.
*/
public class AnyQueryNode extends AndQueryNode {
- private static final long serialVersionUID = 1000791433562954187L;
-
private CharSequence field = null;
private int minimumMatchingmElements = 0;
Modified: lucene/dev/branches/docvalues/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/nodes/BooleanQueryNode.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/nodes/BooleanQueryNode.java?rev=1072973&r1=1072972&r2=1072973&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/nodes/BooleanQueryNode.java (original)
+++ lucene/dev/branches/docvalues/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/nodes/BooleanQueryNode.java Mon Feb 21 14:13:28 2011
@@ -28,8 +28,6 @@ import org.apache.lucene.queryParser.cor
*/
public class BooleanQueryNode extends QueryNodeImpl {
- private static final long serialVersionUID = -2206623652088638072L;
-
/**
* @param clauses
* - the query nodes to be and'ed
Modified: lucene/dev/branches/docvalues/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/nodes/BoostQueryNode.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/nodes/BoostQueryNode.java?rev=1072973&r1=1072972&r2=1072973&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/nodes/BoostQueryNode.java (original)
+++ lucene/dev/branches/docvalues/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/nodes/BoostQueryNode.java Mon Feb 21 14:13:28 2011
@@ -34,8 +34,6 @@ import org.apache.lucene.queryParser.cor
*/
public class BoostQueryNode extends QueryNodeImpl {
- private static final long serialVersionUID = -3929082630855807593L;
-
private float value = 0;
/**
Modified: lucene/dev/branches/docvalues/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/nodes/DeletedQueryNode.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/nodes/DeletedQueryNode.java?rev=1072973&r1=1072972&r2=1072973&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/nodes/DeletedQueryNode.java (original)
+++ lucene/dev/branches/docvalues/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/nodes/DeletedQueryNode.java Mon Feb 21 14:13:28 2011
@@ -27,8 +27,6 @@ import org.apache.lucene.queryParser.cor
*/
public class DeletedQueryNode extends QueryNodeImpl {
- private static final long serialVersionUID = -9151675506000425293L;
-
public DeletedQueryNode() {
// empty constructor
}
Modified: lucene/dev/branches/docvalues/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/nodes/FieldQueryNode.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/nodes/FieldQueryNode.java?rev=1072973&r1=1072972&r2=1072973&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/nodes/FieldQueryNode.java (original)
+++ lucene/dev/branches/docvalues/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/nodes/FieldQueryNode.java Mon Feb 21 14:13:28 2011
@@ -28,8 +28,6 @@ import org.apache.lucene.queryParser.cor
public class FieldQueryNode extends QueryNodeImpl implements TextableQueryNode,
FieldableNode {
- private static final long serialVersionUID = 3634521145130758265L;
-
/**
* The term's field
*/
Modified: lucene/dev/branches/docvalues/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/nodes/FuzzyQueryNode.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/nodes/FuzzyQueryNode.java?rev=1072973&r1=1072972&r2=1072973&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/nodes/FuzzyQueryNode.java (original)
+++ lucene/dev/branches/docvalues/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/nodes/FuzzyQueryNode.java Mon Feb 21 14:13:28 2011
@@ -25,8 +25,6 @@ import org.apache.lucene.queryParser.cor
*/
public class FuzzyQueryNode extends FieldQueryNode {
- private static final long serialVersionUID = -1794537213032589441L;
-
private float similarity;
private int prefixLength;
Modified: lucene/dev/branches/docvalues/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/nodes/GroupQueryNode.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/nodes/GroupQueryNode.java?rev=1072973&r1=1072972&r2=1072973&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/nodes/GroupQueryNode.java (original)
+++ lucene/dev/branches/docvalues/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/nodes/GroupQueryNode.java Mon Feb 21 14:13:28 2011
@@ -34,8 +34,6 @@ import org.apache.lucene.queryParser.cor
*/
public class GroupQueryNode extends QueryNodeImpl {
- private static final long serialVersionUID = -9204673493869114999L;
-
/**
* This QueryNode is used to identify parenthesis on the original query string
*/
Modified: lucene/dev/branches/docvalues/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/nodes/MatchAllDocsQueryNode.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/nodes/MatchAllDocsQueryNode.java?rev=1072973&r1=1072972&r2=1072973&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/nodes/MatchAllDocsQueryNode.java (original)
+++ lucene/dev/branches/docvalues/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/nodes/MatchAllDocsQueryNode.java Mon Feb 21 14:13:28 2011
@@ -25,8 +25,6 @@ import org.apache.lucene.queryParser.cor
*/
public class MatchAllDocsQueryNode extends QueryNodeImpl {
- private static final long serialVersionUID = -7050381275423477809L;
-
public MatchAllDocsQueryNode() {
// empty constructor
}
Modified: lucene/dev/branches/docvalues/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/nodes/MatchNoDocsQueryNode.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/nodes/MatchNoDocsQueryNode.java?rev=1072973&r1=1072972&r2=1072973&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/nodes/MatchNoDocsQueryNode.java (original)
+++ lucene/dev/branches/docvalues/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/nodes/MatchNoDocsQueryNode.java Mon Feb 21 14:13:28 2011
@@ -24,8 +24,6 @@ package org.apache.lucene.queryParser.co
*/
public class MatchNoDocsQueryNode extends DeletedQueryNode {
- private static final long serialVersionUID = 8081805751679581497L;
-
public MatchNoDocsQueryNode() {
// empty constructor
}
Modified: lucene/dev/branches/docvalues/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/nodes/ModifierQueryNode.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/nodes/ModifierQueryNode.java?rev=1072973&r1=1072972&r2=1072973&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/nodes/ModifierQueryNode.java (original)
+++ lucene/dev/branches/docvalues/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/nodes/ModifierQueryNode.java Mon Feb 21 14:13:28 2011
@@ -36,8 +36,6 @@ import org.apache.lucene.queryParser.cor
*/
public class ModifierQueryNode extends QueryNodeImpl {
- private static final long serialVersionUID = -391209837953928169L;
-
public enum Modifier {
MOD_NONE, MOD_NOT, MOD_REQ;
Modified: lucene/dev/branches/docvalues/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/nodes/NoTokenFoundQueryNode.java
URL: http://svn.apache.org/viewvc/lucene/dev/branches/docvalues/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/nodes/NoTokenFoundQueryNode.java?rev=1072973&r1=1072972&r2=1072973&view=diff
==============================================================================
--- lucene/dev/branches/docvalues/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/nodes/NoTokenFoundQueryNode.java (original)
+++ lucene/dev/branches/docvalues/lucene/contrib/queryparser/src/java/org/apache/lucene/queryParser/core/nodes/NoTokenFoundQueryNode.java Mon Feb 21 14:13:28 2011
@@ -25,8 +25,6 @@ import org.apache.lucene.queryParser.cor
*/
public class NoTokenFoundQueryNode extends DeletedQueryNode {
- private static final long serialVersionUID = 7332975497586993833L;
-
public NoTokenFoundQueryNode() {
super();
}