Skip to content

Apache Lucene open-source search software

LUCENE-1486: Move ComplexPhraseQueryParser to contrib

Mark Robert Miller5aaf5b01672a
diff --git a/CHANGES.txt b/CHANGES.txt
index a48bd03ff51..66c10fd33b2 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -621,18 +621,12 @@ New features
All standard parsers now also implement Serializable and enforce
their singleton status. (Uwe Schindler, Mike McCandless)
-31. LUCENE-1486: Added ComplexPhraseQueryParser, an extension of QueryParser
- that allows a subset of the Lucene query language to be embedded in
- PhraseQuerys. Wildcard, Range, and Fuzzy queries, as well as limited
- boolean logic, can be used within quote operators with this parser, ie:
- "(jo* -john) smyth~". (Mark Harwood via Mark Miller)
-
-32. LUCENE-1741: User configureable maximum chunk size in MMapDirectory.
+31. LUCENE-1741: User configureable maximum chunk size in MMapDirectory.
On 32 bit platforms, the address space can be very fragmented, so
one big ByteBuffer for the whole file may not fit into address space.
(Eks Dev via Uwe Schindler)
-33. LUCENE-1644: Enable 4 rewrite modes for queries deriving from
+32. LUCENE-1644: Enable 4 rewrite modes for queries deriving from
MultiTermQuery (WildcardQuery, PrefixQuery, TermRangeQuery,
NumericRangeQuery): CONSTANT_SCORE_FILTER_REWRITE first creates a
filter and then assigns constant score (boost) to docs;
@@ -642,7 +636,7 @@ New features
CONSTANT_SCORE_AUTO_REWRITE tries to pick the most performant
constant-score rewrite method. (Mike McCandless)
-34. LUCENE-1448: Added TokenStream.end(), to perform end-of-stream
+33. LUCENE-1448: Added TokenStream.end(), to perform end-of-stream
operations. This is currently used to fix offset problems when
multiple fields with the same name are added to a document.
(Mike McCandless, Mark Miller, Michael Busch)
diff --git a/contrib/CHANGES.txt b/contrib/CHANGES.txt
index f8a1ec780f6..94e6d842e33 100644
--- a/contrib/CHANGES.txt
+++ b/contrib/CHANGES.txt
@@ -106,6 +106,13 @@ New features
3.0 and will then replace the current core QueryParser, which
has been deprecated with this patch.
(Luis Alves and Adriano Campos via Michael Busch)
+
+13. LUCENE-1486: Added ComplexPhraseQueryParser, an extension of QueryParser
+ that allows a subset of the Lucene query language to be embedded in
+ PhraseQuerys. Wildcard, Range, and Fuzzy queries, as well as limited
+ boolean logic, can be used within quote operators with this parser, ie:
+ "(jo* -john) smyth~". (Mark Harwood via Mark Miller)
+
Optimizations
diff --git a/src/java/org/apache/lucene/queryParser/ComplexPhraseQueryParser.java b/contrib/miscellaneous/src/java/org/apache/lucene/queryParser/complexPhrase/ComplexPhraseQueryParser.java
similarity index 98%
rename from src/java/org/apache/lucene/queryParser/ComplexPhraseQueryParser.java
rename to contrib/miscellaneous/src/java/org/apache/lucene/queryParser/complexPhrase/ComplexPhraseQueryParser.java
index f7c5dc1b8df..9db2b2fde51 100644
--- a/src/java/org/apache/lucene/queryParser/ComplexPhraseQueryParser.java
+++ b/contrib/miscellaneous/src/java/org/apache/lucene/queryParser/complexPhrase/ComplexPhraseQueryParser.java
@@ -1,4 +1,4 @@
-package org.apache.lucene.queryParser;
+package org.apache.lucene.queryParser.complexPhrase;
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -25,11 +25,13 @@ import java.util.List;
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.Term;
+import org.apache.lucene.queryParser.ParseException;
+import org.apache.lucene.queryParser.QueryParser;
import org.apache.lucene.search.BooleanClause;
import org.apache.lucene.search.BooleanQuery;
+import org.apache.lucene.search.MultiTermQuery;
import org.apache.lucene.search.Query;
import org.apache.lucene.search.TermQuery;
-import org.apache.lucene.search.MultiTermQuery;
import org.apache.lucene.search.TermRangeQuery;
import org.apache.lucene.search.spans.SpanNearQuery;
import org.apache.lucene.search.spans.SpanNotQuery;
@@ -54,8 +56,8 @@ import org.apache.lucene.search.spans.SpanTermQuery;
* currently simply feeds all phrase content through an analyzer to select
* phrase terms - any "special" syntax such as * ~ * etc are not given special
* status
- *
- * @deprecated use new the flexible query parser instead
+ *
+ *
*/
public class ComplexPhraseQueryParser extends QueryParser {
private ArrayList/*<ComplexPhraseQuery>*/complexPhrases = null;
diff --git a/src/test/org/apache/lucene/queryParser/TestComplexPhraseQuery.java b/contrib/miscellaneous/src/test/org/apache/lucene/queryParser/complexPhrase/TestComplexPhraseQuery.java
similarity index 97%
rename from src/test/org/apache/lucene/queryParser/TestComplexPhraseQuery.java
rename to contrib/miscellaneous/src/test/org/apache/lucene/queryParser/complexPhrase/TestComplexPhraseQuery.java
index b112edd75a4..c5f75fccc36 100644
--- a/src/test/org/apache/lucene/queryParser/TestComplexPhraseQuery.java
+++ b/contrib/miscellaneous/src/test/org/apache/lucene/queryParser/complexPhrase/TestComplexPhraseQuery.java
@@ -1,4 +1,4 @@
-package org.apache.lucene.queryParser;
+package org.apache.lucene.queryParser.complexPhrase;
/**
* Licensed to the Apache Software Foundation (ASF) under one or more
@@ -27,6 +27,7 @@ import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.index.IndexWriter;
import org.apache.lucene.index.IndexWriter.MaxFieldLength;
+import org.apache.lucene.queryParser.QueryParser;
import org.apache.lucene.search.IndexSearcher;
import org.apache.lucene.search.Query;
import org.apache.lucene.search.ScoreDoc;