Skip to content

Apache Lucene open-source search software

catch up with trunk

Simon Willnauerec20e8ab0232
diff --cc lucene/contrib/CHANGES.txt
index 7f2fe40dffc,7251f49788c..8ee60a752f3
--- a/lucene/contrib/CHANGES.txt
+++ b/lucene/contrib/CHANGES.txt
@@@ -4,39 -4,44 +4,53 @@@ Lucene contrib change Lo
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-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-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-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-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-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-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-2638 MakeHighFreqTerms.TermStats public to make it more useful
++ for API use. (Andrzej Bialecki)
- * 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 -69,14 +78,6 @@@ Changes in backwards compatibility poli
* 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 -91,11 +92,6 @@@
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 -113,48 +109,41 @@@
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-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-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-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-591: The demo indexer now indexes meta keywords.
- (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 -190,20 +179,11 @@@
* 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 -293,14 +273,6 @@@
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 -320,12 +292,7 @@@
* 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
diff --cc lucene/src/java/org/apache/lucene/index/SegmentWriteState.java
index 98cfdb4edf3,e44462cc72d..af3db9341a5
--- a/lucene/src/java/org/apache/lucene/index/SegmentWriteState.java
+++ b/lucene/src/java/org/apache/lucene/index/SegmentWriteState.java
@@@ -58,22 -53,8 +58,8 @@@ public class SegmentWriteState
* tweaking this is rarely useful.*/
public int termIndexInterval; // TODO: this should be private to the codec, not settable here or in IWC
- /** Expert: The fraction of TermDocs entries stored in skip tables,
- * used to accelerate {@link DocsEnum#advance(int)}. Larger values result in
- * smaller indexes, greater acceleration, but fewer accelerable cases, while
- * smaller values result in bigger indexes, less acceleration and more
- * accelerable cases. More detailed experiments would be useful here. */
- public final int skipInterval = 16;
-
- /** Expert: The maximum number of skip levels. Smaller values result in
- * slightly smaller indexes, but slower skipping in big posting lists.
- */
- public final int maxSkipLevels = 10;
-
-
-
public SegmentWriteState(PrintStream infoStream, Directory directory, String segmentName, FieldInfos fieldInfos,
- int numDocs, int termIndexInterval, SegmentCodecs segmentCodecs, BufferedDeletes segDeletes) {
+ int numDocs, int termIndexInterval, SegmentCodecs segmentCodecs, BufferedDeletes segDeletes, AtomicLong bytesUsed) {
this.infoStream = infoStream;
this.segDeletes = segDeletes;
this.directory = directory;
diff --cc lucene/src/java/org/apache/lucene/index/codecs/CodecProvider.java
index 31b0c230bc5,921a8e6db62..bd9046bf69a
--- a/lucene/src/java/org/apache/lucene/index/codecs/CodecProvider.java
+++ b/lucene/src/java/org/apache/lucene/index/codecs/CodecProvider.java
@@@ -22,13 -22,7 +22,8 @@@ import java.util.HashMap
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
+import java.util.Map.Entry;
- import org.apache.lucene.index.codecs.preflex.PreFlexCodec;
- import org.apache.lucene.index.codecs.pulsing.PulsingCodec;
- import org.apache.lucene.index.codecs.simpletext.SimpleTextCodec;
- import org.apache.lucene.index.codecs.standard.StandardCodec;
-
/** Holds a set of codecs, keyed by name. You subclass
* this, instantiate it, and register your codecs, then
* pass this instance to IndexReader/IndexWriter (via
@@@ -164,33 -158,4 +159,24 @@@ public class CodecProvider
public synchronized void setDefaultFieldCodec(String codec) {
defaultFieldCodec = codec;
}
+
+ /**
+ * Registers all codecs from the given provider including the field to codec
+ * mapping and the default field codec.
+ * <p>
+ * NOTE: This method will pass any codec from the given codec to
+ * {@link #register(Codec)} and sets fiels codecs via
+ * {@link #setFieldCodec(String, String)}.
+ */
+ public void copyFrom(CodecProvider other) {
+ final Collection<Codec> values = other.codecs.values();
+ for (Codec codec : values) {
+ register(codec);
+ }
+ final Set<Entry<String, String>> entrySet = other.perFieldMap.entrySet();
+ for (Entry<String, String> entry : entrySet) {
+ setFieldCodec(entry.getKey(), entry.getValue());
+ }
+ setDefaultFieldCodec(other.getDefaultFieldCodec());
+ }
}
-
- class DefaultCodecProvider extends CodecProvider {
- DefaultCodecProvider() {
- register(new StandardCodec());
- register(new PreFlexCodec());
- register(new PulsingCodec(1));
- register(new SimpleTextCodec());
- }
- }
diff --cc lucene/src/java/org/apache/lucene/search/SortField.java
index 0875ccfa287,cf2cc8a1f26..08047106f4c
--- a/lucene/src/java/org/apache/lucene/search/SortField.java
+++ b/lucene/src/java/org/apache/lucene/search/SortField.java
@@@ -18,8 -18,6 +18,7 @@@ package org.apache.lucene.search
*/
import java.io.IOException;
- import java.io.Serializable;
+import java.util.Comparator;
import java.util.Locale;
import org.apache.lucene.search.cache.*;
@@@ -436,33 -425,6 +434,26 @@@ public class SortField
return hash;
}
- // field must be interned after reading from stream
- private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
- in.defaultReadObject();
- if (field != null)
- field = StringHelper.intern(field);
- }
-
+ private boolean useIndexValues;
+
+ public void setUseIndexValues(boolean b) {
+ useIndexValues = b;
+ }
+
+ public boolean getUseIndexValues() {
+ return useIndexValues;
+ }
+
+ private Comparator<BytesRef> bytesComparator = BytesRef.getUTF8SortedAsUnicodeComparator();
+
+ public void setBytesComparator(Comparator<BytesRef> b) {
+ bytesComparator = b;
+ }
+
+ public Comparator<BytesRef> getBytesComparator() {
+ return bytesComparator;
+ }
+
/** Returns the {@link FieldComparator} to use for
* sorting.
*