Skip to content

Commit

Permalink
Merge branch 'enhancement_blockUnkwon-default-true' of github.com:Mar…
Browse files Browse the repository at this point in the history
…cusSorealheis/lucene-solr into enhancement_blockUnkwon-default-true

* 'enhancement_blockUnkwon-default-true' of github.com:MarcusSorealheis/lucene-solr: (37 commits)
  SOLR-13699 - maxChars no longer working on CopyField with javabin
  SOLR-13699 - maxChars no longer working on CopyField with Javabin
  SOLR-13655: Fix precommit
  SOLR-11601: Improve geodist error message when using with LLPSF.
  SOLR-13655: Added CHANGES entry
  SOLR-13655:Upgrade Collections.unModifiableSet to Set.of and Set.copyOf (apache#817)
  SOLR-13702: Fix precommit
  SOLR-13702: Some components register twice their metric names (apache#834)
  LUCENE-8952: Use a sort key instead of true distance in NearestNeighbor. (apache#832)
  SOLR-13707: API to expose the currently used package name, details for each plugin
  SOLR-13707: API to expose the currently used package name, details for each plugin (apache#841)
  Additional logging in test framework methods that 'waitFor' something to better trace order of operations when failures occur
  SOLR-13257: Support deterministic replica routing
  SOLR-13706: Config API output is broken for "highlight" component
  LUCENE-8755: Spatial-extras quad and packed-quad trees now index  points a little faster, and also fix an edge case bug.  Fixes apache#824
  removed unnecessary comments
  SOLR-13650: AwaitsFix TestContainerReqHandler.testCacheFromGlobalLoader
  SOLR-13650:ref guide typo
  SOLR-13704: correct error codes for client errors in expand component
  SOLR-13650: ref guide
  ...
  • Loading branch information
MarcusSorealheis committed Aug 27, 2019
2 parents 91bb0f8 + a7c31dc commit 2ba69c0
Show file tree
Hide file tree
Showing 114 changed files with 3,896 additions and 820 deletions.
17 changes: 17 additions & 0 deletions lucene/CHANGES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,11 @@ API Changes
* LUCENE-8909: IndexWriter#getFieldNames() method is used to get fields present in index. After LUCENE-8316, this
method is no longer required. Hence, deprecate IndexWriter#getFieldNames() method. (Adrien Grand, Munendra S N)

* LUCENE-8755: SpatialPrefixTreeFactory now consumes the "version" parsed with Lucene's Version class. The quad
and packed quad prefix trees are sensitive to this. It's recommended to pass the version like you
should do likewise for analysis components for tokenized text, or else changes to the encoding in future versions
may be incompatible with older indexes. (Chongchen Chen, David Smiley)

New Features

* LUCENE-8936: Add SpanishMinimalStemFilter (vinod kumar via Tomoko Uchida)
Expand All @@ -75,6 +80,8 @@ New Features
and a simple way to find which subqueries have matched on a given document
(Alan Woodward, Jim Ferenczi)

* LUCENE-8769: Introduce Range Query For Multiple Connected Ranges (Atri Sharma)

Improvements

* LUCENE-8874: Show SPI names instead of class names in Luke Analysis tab. (Tomoko Uchida)
Expand All @@ -95,6 +102,8 @@ Improvements

* SOLR-13663: Introduce <SpanPositionRange> into XML Query Parser (Alessandro Benedetti via Mikhail Khludnev)

* LUCENE-8952: Use a sort key instead of true distance in NearestNeighbor (Julie Tibshirani).

Optimizations

* LUCENE-8922: DisjunctionMaxQuery more efficiently leverages impacts to skip
Expand All @@ -106,6 +115,14 @@ the total hits is not requested.
* LUCENE-8941: Matches on wildcard queries will defer building their full
disjunction until a MatchesIterator is pulled (Alan Woodward)

* LUCENE-8755: spatial-extras quad and packed quad prefix trees now index points faster.
(Chongchen Chen, David Smiley)

Bug Fixes

* LUCENE-8755: spatial-extras quad and packed quad prefix trees could throw a
NullPointerException for certain cell edge coordinates (Chongchen Chen, David Smiley)

Other

* LUCENE-8778 LUCENE-8911: Define analyzer SPI names as static final fields and document the names in Javadocs.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
* @see PointValues
*/
public final class DoublePoint extends Field {

/**
* Return the least double that compares greater than {@code d} consistently
* with {@link Double#compare}. The only difference with
Expand Down Expand Up @@ -106,7 +105,13 @@ public Number numericValue() {
return decodeDimension(bytes.bytes, bytes.offset);
}

private static BytesRef pack(double... point) {
/**
* Pack a double point into a BytesRef
*
* @param point double[] value
* @throws IllegalArgumentException is the value is null or of zero length
*/
public static BytesRef pack(double... point) {
if (point == null) {
throw new IllegalArgumentException("point must not be null");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
* @see PointValues
*/
public final class FloatPoint extends Field {

/**
* Return the least float that compares greater than {@code f} consistently
* with {@link Float#compare}. The only difference with
Expand Down Expand Up @@ -106,7 +105,13 @@ public Number numericValue() {
return decodeDimension(bytes.bytes, bytes.offset);
}

private static BytesRef pack(float... point) {
/**
* Pack a float point into a BytesRef
*
* @param point float[] value
* @throws IllegalArgumentException is the value is null or of zero length
*/
public static BytesRef pack(float... point) {
if (point == null) {
throw new IllegalArgumentException("point must not be null");
}
Expand Down
9 changes: 7 additions & 2 deletions lucene/core/src/java/org/apache/lucene/document/IntPoint.java
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
* @see PointValues
*/
public final class IntPoint extends Field {

private static FieldType getType(int numDims) {
FieldType type = new FieldType();
type.setDimensions(numDims, Integer.BYTES);
Expand Down Expand Up @@ -80,7 +79,13 @@ public Number numericValue() {
return decodeDimension(bytes.bytes, bytes.offset);
}

private static BytesRef pack(int... point) {
/**
* Pack an integer point into a BytesRef
*
* @param point int[] value
* @throws IllegalArgumentException is the value is null or of zero length
*/
public static BytesRef pack(int... point) {
if (point == null) {
throw new IllegalArgumentException("point must not be null");
}
Expand Down
11 changes: 8 additions & 3 deletions lucene/core/src/java/org/apache/lucene/document/LongPoint.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@
import java.util.Collection;

import org.apache.lucene.index.PointValues;
import org.apache.lucene.search.BooleanClause.Occur;
import org.apache.lucene.search.BooleanQuery;
import org.apache.lucene.search.BoostQuery;
import org.apache.lucene.search.PointInSetQuery;
import org.apache.lucene.search.PointRangeQuery;
import org.apache.lucene.search.Query;
import org.apache.lucene.search.BooleanClause.Occur;
import org.apache.lucene.util.BytesRef;
import org.apache.lucene.util.NumericUtils;

Expand All @@ -47,7 +47,6 @@
* @see PointValues
*/
public final class LongPoint extends Field {

private static FieldType getType(int numDims) {
FieldType type = new FieldType();
type.setDimensions(numDims, Long.BYTES);
Expand Down Expand Up @@ -83,7 +82,13 @@ public Number numericValue() {
return decodeDimension(bytes.bytes, bytes.offset);
}

private static BytesRef pack(long... point) {
/**
* Pack a long point into a BytesRef
*
* @param point long[] value
* @throws IllegalArgumentException is the value is null or of zero length
*/
public static BytesRef pack(long... point) {
if (point == null) {
throw new IllegalArgumentException("point must not be null");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,34 @@
*/
package org.apache.lucene.queryparser.xml;

import javax.xml.XMLConstants;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import java.io.InputStream;
import java.util.Locale;

import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.queryparser.classic.QueryParser;
import org.apache.lucene.queryparser.xml.builders.*;
import org.apache.lucene.queryparser.xml.builders.BooleanQueryBuilder;
import org.apache.lucene.queryparser.xml.builders.BoostingTermBuilder;
import org.apache.lucene.queryparser.xml.builders.ConstantScoreQueryBuilder;
import org.apache.lucene.queryparser.xml.builders.DisjunctionMaxQueryBuilder;
import org.apache.lucene.queryparser.xml.builders.MatchAllDocsQueryBuilder;
import org.apache.lucene.queryparser.xml.builders.PointRangeQueryBuilder;
import org.apache.lucene.queryparser.xml.builders.RangeQueryBuilder;
import org.apache.lucene.queryparser.xml.builders.SpanFirstBuilder;
import org.apache.lucene.queryparser.xml.builders.SpanNearBuilder;
import org.apache.lucene.queryparser.xml.builders.SpanNotBuilder;
import org.apache.lucene.queryparser.xml.builders.SpanOrBuilder;
import org.apache.lucene.queryparser.xml.builders.SpanOrTermsBuilder;
import org.apache.lucene.queryparser.xml.builders.SpanPositionRangeBuilder;
import org.apache.lucene.queryparser.xml.builders.SpanQueryBuilder;
import org.apache.lucene.queryparser.xml.builders.SpanQueryBuilderFactory;
import org.apache.lucene.queryparser.xml.builders.SpanTermBuilder;
import org.apache.lucene.queryparser.xml.builders.TermQueryBuilder;
import org.apache.lucene.queryparser.xml.builders.TermsQueryBuilder;
import org.apache.lucene.queryparser.xml.builders.UserInputQueryBuilder;
import org.apache.lucene.search.Query;
import org.apache.lucene.search.spans.SpanQuery;
import org.w3c.dom.Document;
Expand All @@ -27,14 +52,6 @@
import org.xml.sax.ErrorHandler;
import org.xml.sax.SAXException;

import javax.xml.XMLConstants;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;

import java.io.InputStream;
import java.util.Locale;

/**
* Assembles a QueryBuilder which uses only core Lucene Query objects
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
*/
package org.apache.lucene.queryparser.xml;

import java.io.IOException;
import java.io.InputStream;

import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.analysis.MockAnalyzer;
import org.apache.lucene.analysis.MockTokenFilter;
Expand All @@ -32,9 +35,6 @@
import org.junit.AfterClass;
import org.xml.sax.SAXException;

import java.io.IOException;
import java.io.InputStream;

public class TestCoreParser extends LuceneTestCase {

final private static String defaultField = "contents";
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*
* 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.
*/

package org.apache.lucene.document;

import org.apache.lucene.search.MultiRangeQuery;

import static org.apache.lucene.document.DoublePoint.decodeDimension;
import static org.apache.lucene.document.DoublePoint.pack;

/** Builder for multi range queries for DoublePoints */
public class DoublePointMultiRangeBuilder extends MultiRangeQuery.Builder {
public DoublePointMultiRangeBuilder(String field, int numDims) {
super(field, Double.BYTES, numDims);
}

@Override
public MultiRangeQuery build() {
return new MultiRangeQuery(field, numDims, bytesPerDim, clauses) {
@Override
protected String toString(int dimension, byte[] value) {
return Double.toString(decodeDimension(value, 0));
}
};
}

public void add(double[] lowerValue, double[] upperValue) {
if (upperValue.length != numDims || lowerValue.length != numDims) {
throw new IllegalArgumentException("Passed in range does not conform to specified dimensions");
}

for (int i = 0; i < numDims; i++) {
if (upperValue[i] < lowerValue[i]) {
throw new IllegalArgumentException("Upper value of range should be greater than lower value of range");
}
}
add(pack(lowerValue).bytes, pack(upperValue).bytes);
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/*
* 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.
*/

package org.apache.lucene.document;

import org.apache.lucene.search.MultiRangeQuery;

import static org.apache.lucene.document.FloatPoint.decodeDimension;
import static org.apache.lucene.document.FloatPoint.pack;

/**
* Builder for multi range queries for FloatPoints
*/
public class FloatPointMultiRangeBuilder extends MultiRangeQuery.Builder {
public FloatPointMultiRangeBuilder(String field, int numDims) {
super(field, Float.BYTES, numDims);
}

@Override
public MultiRangeQuery build() {
return new MultiRangeQuery(field, numDims, bytesPerDim, clauses) {
@Override
protected String toString(int dimension, byte[] value) {
return Float.toString(decodeDimension(value, 0));
}
};
}

public void add(float[] lowerValue, float[] upperValue) {
if (upperValue.length != numDims || lowerValue.length != numDims) {
throw new IllegalArgumentException("Passed in range does not conform to specified dimensions");
}

for (int i = 0; i < numDims; i++) {
if (upperValue[i] < lowerValue[i]) {
throw new IllegalArgumentException("Upper value of range should be greater than lower value of range");
}
}
add(pack(lowerValue).bytes, pack(upperValue).bytes);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/*
* 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.
*/

package org.apache.lucene.document;

import org.apache.lucene.search.MultiRangeQuery;

import static org.apache.lucene.document.IntPoint.decodeDimension;
import static org.apache.lucene.document.IntPoint.pack;

/** Builder for multi range queries for IntPoints */
public class IntPointMultiRangeBuilder extends MultiRangeQuery.Builder {
public IntPointMultiRangeBuilder(String field, int numDims) {
super(field, Integer.BYTES, numDims);
}

@Override
public MultiRangeQuery build() {
return new MultiRangeQuery(field, numDims, bytesPerDim, clauses) {
@Override
protected String toString(int dimension, byte[] value) {
return Integer.toString(decodeDimension(value, 0));
}
};
}

public void add(int[] lowerValue, int[] upperValue) {
if (upperValue.length != numDims || lowerValue.length != numDims) {
throw new IllegalArgumentException("Passed in range does not conform to specified dimensions");
}

for (int i = 0; i < numDims; i++) {
if (upperValue[i] < lowerValue[i]) {
throw new IllegalArgumentException("Upper value of range should be greater than lower value of range");
}
}
add(pack(lowerValue).bytes, pack(upperValue).bytes);
}
}
Loading

0 comments on commit 2ba69c0

Please sign in to comment.