LUCENE-8856: Promote intervals queries from sandbox to queries module

This commit is contained in:
Alan Woodward 2019-06-26 11:24:05 +01:00
parent b48a02b1f1
commit 46cc24d77e
48 changed files with 117 additions and 114 deletions

View File

@ -47,6 +47,9 @@ API Changes
and apply to all queries, rather than only booleans. (Atri Sharma, Adrien and apply to all queries, rather than only booleans. (Atri Sharma, Adrien
Grand, Alan Woodward) Grand, Alan Woodward)
* LUCENE-8856: Intervals queries have moved from the sandbox to the queries
module. (Alan Woodward)
New Features New Features
* LUCENE-8815: Provide a DoubleValues implementation for retrieving the value of features without * LUCENE-8815: Provide a DoubleValues implementation for retrieving the value of features without

View File

@ -15,7 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.apache.lucene.search.intervals; package org.apache.lucene.queries.intervals;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;

View File

@ -15,7 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.apache.lucene.search.intervals; package org.apache.lucene.queries.intervals;
import java.io.IOException; import java.io.IOException;

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.lucene.search.intervals; package org.apache.lucene.queries.intervals;
import java.io.IOException; import java.io.IOException;

View File

@ -15,7 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.apache.lucene.search.intervals; package org.apache.lucene.queries.intervals;
import java.io.IOException; import java.io.IOException;
import java.util.List; import java.util.List;

View File

@ -15,7 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.apache.lucene.search.intervals; package org.apache.lucene.queries.intervals;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;

View File

@ -15,7 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.apache.lucene.search.intervals; package org.apache.lucene.queries.intervals;
import java.io.IOException; import java.io.IOException;
import java.util.Arrays; import java.util.Arrays;

View File

@ -15,7 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.apache.lucene.search.intervals; package org.apache.lucene.queries.intervals;
import java.io.IOException; import java.io.IOException;
import java.util.Arrays; import java.util.Arrays;

View File

@ -15,7 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.apache.lucene.search.intervals; package org.apache.lucene.queries.intervals;
import java.io.IOException; import java.io.IOException;

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.lucene.search.intervals; package org.apache.lucene.queries.intervals;
import java.util.Arrays; import java.util.Arrays;

View File

@ -15,7 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.apache.lucene.search.intervals; package org.apache.lucene.queries.intervals;
import org.apache.lucene.search.DocIdSetIterator; import org.apache.lucene.search.DocIdSetIterator;

View File

@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.apache.lucene.search.intervals; package org.apache.lucene.queries.intervals;
import java.io.IOException; import java.io.IOException;

View File

@ -15,7 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.apache.lucene.search.intervals; package org.apache.lucene.queries.intervals;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;

View File

@ -15,7 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.apache.lucene.search.intervals; package org.apache.lucene.queries.intervals;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;

View File

@ -15,7 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.apache.lucene.search.intervals; package org.apache.lucene.queries.intervals;
import java.io.IOException; import java.io.IOException;

View File

@ -15,7 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.apache.lucene.search.intervals; package org.apache.lucene.queries.intervals;
import java.io.IOException; import java.io.IOException;
import java.util.Collection; import java.util.Collection;

View File

@ -15,7 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.apache.lucene.search.intervals; package org.apache.lucene.queries.intervals;
import java.io.IOException; import java.io.IOException;
import java.util.Collection; import java.util.Collection;

View File

@ -15,7 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.apache.lucene.search.intervals; package org.apache.lucene.queries.intervals;
import java.io.IOException; import java.io.IOException;
import java.util.Arrays; import java.util.Arrays;

View File

@ -15,7 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.apache.lucene.search.intervals; package org.apache.lucene.queries.intervals;
import java.io.IOException; import java.io.IOException;
import java.util.Collection; import java.util.Collection;

View File

@ -15,7 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.apache.lucene.search.intervals; package org.apache.lucene.queries.intervals;
import java.io.IOException; import java.io.IOException;
import java.util.Objects; import java.util.Objects;

View File

@ -15,7 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.apache.lucene.search.intervals; package org.apache.lucene.queries.intervals;
import java.io.IOException; import java.io.IOException;

View File

@ -15,7 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.apache.lucene.search.intervals; package org.apache.lucene.queries.intervals;
import java.io.IOException; import java.io.IOException;

View File

@ -15,7 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.apache.lucene.search.intervals; package org.apache.lucene.queries.intervals;
import org.apache.lucene.search.MatchesIterator; import org.apache.lucene.search.MatchesIterator;

View File

@ -15,7 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.apache.lucene.search.intervals; package org.apache.lucene.queries.intervals;
import java.io.IOException; import java.io.IOException;
import java.util.Objects; import java.util.Objects;

View File

@ -15,7 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.apache.lucene.search.intervals; package org.apache.lucene.queries.intervals;
import java.util.Objects; import java.util.Objects;

View File

@ -15,7 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.apache.lucene.search.intervals; package org.apache.lucene.queries.intervals;
import java.io.IOException; import java.io.IOException;

View File

@ -15,7 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.apache.lucene.search.intervals; package org.apache.lucene.queries.intervals;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;

View File

@ -15,7 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.apache.lucene.search.intervals; package org.apache.lucene.queries.intervals;
import java.io.IOException; import java.io.IOException;
import java.util.Collection; import java.util.Collection;

View File

@ -15,7 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.apache.lucene.search.intervals; package org.apache.lucene.queries.intervals;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;

View File

@ -15,7 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.apache.lucene.search.intervals; package org.apache.lucene.queries.intervals;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;

View File

@ -15,7 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.apache.lucene.search.intervals; package org.apache.lucene.queries.intervals;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;

View File

@ -15,7 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.apache.lucene.search.intervals; package org.apache.lucene.queries.intervals;
import java.io.IOException; import java.io.IOException;
import java.util.Collection; import java.util.Collection;

View File

@ -15,7 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.apache.lucene.search.intervals; package org.apache.lucene.queries.intervals;
import java.io.IOException; import java.io.IOException;
import java.util.Collection; import java.util.Collection;

View File

@ -15,7 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.apache.lucene.search.intervals; package org.apache.lucene.queries.intervals;
import java.io.IOException; import java.io.IOException;
import java.util.Collection; import java.util.Collection;

View File

@ -15,7 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.apache.lucene.search.intervals; package org.apache.lucene.queries.intervals;
import java.io.IOException; import java.io.IOException;
import java.util.Collection; import java.util.Collection;

View File

@ -15,7 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.apache.lucene.search.intervals; package org.apache.lucene.queries.intervals;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;

View File

@ -15,7 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.apache.lucene.search.intervals; package org.apache.lucene.queries.intervals;
import java.io.IOException; import java.io.IOException;
import java.util.Arrays; import java.util.Arrays;

View File

@ -15,7 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.apache.lucene.search.intervals; package org.apache.lucene.queries.intervals;
import java.io.IOException; import java.io.IOException;
import java.util.Collection; import java.util.Collection;

View File

@ -15,7 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.apache.lucene.search.intervals; package org.apache.lucene.queries.intervals;
import java.io.IOException; import java.io.IOException;

View File

@ -15,7 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.apache.lucene.search.intervals; package org.apache.lucene.queries.intervals;
import java.io.IOException; import java.io.IOException;
import java.util.Collection; import java.util.Collection;

View File

@ -15,7 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.apache.lucene.search.intervals; package org.apache.lucene.queries.intervals;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;

View File

@ -0,0 +1,68 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* <h2>Intervals queries</h2>
*
* This package contains experimental classes to search over intervals within fields
*
* <h2>IntervalsSource</h2>
*
* The {@link org.apache.lucene.queries.intervals.IntervalsSource} class can be used to construct proximity
* relationships between terms and intervals. They can be built using static methods
* in the {@link org.apache.lucene.queries.intervals.Intervals} class
*
* <h3>Basic intervals</h3>
*
* <ul>
* <li>{@link org.apache.lucene.queries.intervals.Intervals#term(String)} &mdash; Represents a single term</li>
* <li>{@link org.apache.lucene.queries.intervals.Intervals#phrase(java.lang.String...)} &mdash; Represents a phrase</li>
* <li>{@link org.apache.lucene.queries.intervals.Intervals#ordered(IntervalsSource...)}
* &mdash; Represents an interval over an ordered set of terms or intervals</li>
* <li>{@link org.apache.lucene.queries.intervals.Intervals#unordered(IntervalsSource...)}
* &mdash; Represents an interval over an unordered set of terms or intervals</li>
* <li>{@link org.apache.lucene.queries.intervals.Intervals#or(IntervalsSource...)}
* &mdash; Represents the disjunction of a set of terms or intervals</li>
* </ul>
*
* <h3>Filters</h3>
*
* <ul>
* <li>{@link org.apache.lucene.queries.intervals.Intervals#maxwidth(int, IntervalsSource)}
* &mdash; Filters out intervals that are larger than a set width</li>
* <li>{@link org.apache.lucene.queries.intervals.Intervals#maxgaps(int, IntervalsSource)}
* &mdash; Filters out intervals that have more than a set number of gaps between their constituent sub-intervals</li>
* <li>{@link org.apache.lucene.queries.intervals.Intervals#containedBy(IntervalsSource, IntervalsSource)}
* &mdash; Returns intervals that are contained by another interval</li>
* <li>{@link org.apache.lucene.queries.intervals.Intervals#notContainedBy(IntervalsSource, IntervalsSource)}
* &mdash; Returns intervals that are *not* contained by another interval</li>
* <li>{@link org.apache.lucene.queries.intervals.Intervals#containing(IntervalsSource, IntervalsSource)}
* &mdash; Returns intervals that contain another interval</li>
* <li>{@link org.apache.lucene.queries.intervals.Intervals#notContaining(IntervalsSource, IntervalsSource)}
* &mdash; Returns intervals that do not contain another interval</li>
* <li>{@link org.apache.lucene.queries.intervals.Intervals#nonOverlapping(IntervalsSource, IntervalsSource)}
* &mdash; Returns intervals that do not overlap with another interval</li>
* <li>{@link org.apache.lucene.queries.intervals.Intervals#notWithin(IntervalsSource, int, IntervalsSource)}
* &mdash; Returns intervals that do not appear within a set number of positions of another interval</li>
* </ul>
*
* <h2>IntervalQuery</h2>
*
* An {@link org.apache.lucene.queries.intervals.IntervalQuery} takes a field name and an {@link org.apache.lucene.queries.intervals.IntervalsSource},
* and matches all documents that contain intervals defined by the source in that field.
*/
package org.apache.lucene.queries.intervals;

View File

@ -15,11 +15,11 @@
* limitations under the License. * limitations under the License.
*/ */
package org.apache.lucene.search.intervals; package org.apache.lucene.queries.intervals;
import org.apache.lucene.util.LuceneTestCase; import org.apache.lucene.util.LuceneTestCase;
import static org.apache.lucene.search.intervals.Intervals.*; import static org.apache.lucene.queries.intervals.Intervals.*;
public class TestDisjunctionRewrites extends LuceneTestCase { public class TestDisjunctionRewrites extends LuceneTestCase {

View File

@ -15,7 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.apache.lucene.search.intervals; package org.apache.lucene.queries.intervals;
import java.io.IOException; import java.io.IOException;

View File

@ -15,7 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.apache.lucene.search.intervals; package org.apache.lucene.queries.intervals;
import java.io.IOException; import java.io.IOException;

View File

@ -15,7 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.apache.lucene.search.intervals; package org.apache.lucene.queries.intervals;
import org.apache.lucene.analysis.Analyzer; import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.MockTokenizer; import org.apache.lucene.analysis.MockTokenizer;

View File

@ -15,7 +15,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.apache.lucene.search.intervals; package org.apache.lucene.queries.intervals;
import org.apache.lucene.util.LuceneTestCase; import org.apache.lucene.util.LuceneTestCase;

View File

@ -1,68 +0,0 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
* <h2>Intervals queries</h2>
*
* This package contains experimental classes to search over intervals within fields
*
* <h2>IntervalsSource</h2>
*
* The {@link org.apache.lucene.search.intervals.IntervalsSource} class can be used to construct proximity
* relationships between terms and intervals. They can be built using static methods
* in the {@link org.apache.lucene.search.intervals.Intervals} class
*
* <h3>Basic intervals</h3>
*
* <ul>
* <li>{@link org.apache.lucene.search.intervals.Intervals#term(String)} &mdash; Represents a single term</li>
* <li>{@link org.apache.lucene.search.intervals.Intervals#phrase(java.lang.String...)} &mdash; Represents a phrase</li>
* <li>{@link org.apache.lucene.search.intervals.Intervals#ordered(org.apache.lucene.search.intervals.IntervalsSource...)}
* &mdash; Represents an interval over an ordered set of terms or intervals</li>
* <li>{@link org.apache.lucene.search.intervals.Intervals#unordered(org.apache.lucene.search.intervals.IntervalsSource...)}
* &mdash; Represents an interval over an unordered set of terms or intervals</li>
* <li>{@link org.apache.lucene.search.intervals.Intervals#or(org.apache.lucene.search.intervals.IntervalsSource...)}
* &mdash; Represents the disjunction of a set of terms or intervals</li>
* </ul>
*
* <h3>Filters</h3>
*
* <ul>
* <li>{@link org.apache.lucene.search.intervals.Intervals#maxwidth(int, org.apache.lucene.search.intervals.IntervalsSource)}
* &mdash; Filters out intervals that are larger than a set width</li>
* <li>{@link org.apache.lucene.search.intervals.Intervals#maxgaps(int, org.apache.lucene.search.intervals.IntervalsSource)}
* &mdash; Filters out intervals that have more than a set number of gaps between their constituent sub-intervals</li>
* <li>{@link org.apache.lucene.search.intervals.Intervals#containedBy(org.apache.lucene.search.intervals.IntervalsSource, org.apache.lucene.search.intervals.IntervalsSource)}
* &mdash; Returns intervals that are contained by another interval</li>
* <li>{@link org.apache.lucene.search.intervals.Intervals#notContainedBy(org.apache.lucene.search.intervals.IntervalsSource, org.apache.lucene.search.intervals.IntervalsSource)}
* &mdash; Returns intervals that are *not* contained by another interval</li>
* <li>{@link org.apache.lucene.search.intervals.Intervals#containing(org.apache.lucene.search.intervals.IntervalsSource, org.apache.lucene.search.intervals.IntervalsSource)}
* &mdash; Returns intervals that contain another interval</li>
* <li>{@link org.apache.lucene.search.intervals.Intervals#notContaining(org.apache.lucene.search.intervals.IntervalsSource, org.apache.lucene.search.intervals.IntervalsSource)}
* &mdash; Returns intervals that do not contain another interval</li>
* <li>{@link org.apache.lucene.search.intervals.Intervals#nonOverlapping(org.apache.lucene.search.intervals.IntervalsSource, org.apache.lucene.search.intervals.IntervalsSource)}
* &mdash; Returns intervals that do not overlap with another interval</li>
* <li>{@link org.apache.lucene.search.intervals.Intervals#notWithin(org.apache.lucene.search.intervals.IntervalsSource, int, org.apache.lucene.search.intervals.IntervalsSource)}
* &mdash; Returns intervals that do not appear within a set number of positions of another interval</li>
* </ul>
*
* <h2>IntervalQuery</h2>
*
* An {@link org.apache.lucene.search.intervals.IntervalQuery} takes a field name and an {@link org.apache.lucene.search.intervals.IntervalsSource},
* and matches all documents that contain intervals defined by the source in that field.
*/
package org.apache.lucene.search.intervals;