Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix split package org.apache.lucene.queryparser.classic #78307

Merged
merged 1 commit into from
Sep 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions server/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -269,8 +269,7 @@ tasks.named("licenseHeaders").configure {

tasks.named('splitPackagesAudit').configure {
// Lucene packages should be owned by Lucene!
ignoreClasses 'org.apache.lucene.queryparser.classic.XQueryParser',
'org.apache.lucene.queries.BinaryDocValuesRangeQuery',
ignoreClasses 'org.apache.lucene.queries.BinaryDocValuesRangeQuery',
'org.apache.lucene.queries.BlendedTermQuery',
'org.apache.lucene.queries.SpanMatchNoDocsQuery',
'org.apache.lucene.search.grouping.CollapseTopFieldDocs',
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
import org.apache.lucene.queries.spans.SpanOrQuery;
import org.apache.lucene.queries.spans.SpanQuery;
import org.apache.lucene.queryparser.classic.ParseException;
import org.apache.lucene.queryparser.classic.QueryParser;
import org.apache.lucene.queryparser.classic.Token;
import org.apache.lucene.queryparser.classic.XQueryParser;
import org.apache.lucene.search.BooleanClause;
import org.apache.lucene.search.BoostAttribute;
import org.apache.lucene.search.BoostQuery;
Expand Down Expand Up @@ -64,12 +64,12 @@
import static org.elasticsearch.index.search.QueryParserHelper.resolveMappingFields;

/**
* A {@link XQueryParser} that uses the {@link MapperService} in order to build smarter
* A {@link QueryParser} that uses the {@link MapperService} in order to build smarter
* queries based on the mapping information.
* This class uses {@link MultiMatchQueryParser} to build the text query around operators and {@link XQueryParser}
* This class uses {@link MultiMatchQueryParser} to build the text query around operators and {@link QueryParser}
* to assemble the result logically.
*/
public class QueryStringQueryParser extends XQueryParser {
public class QueryStringQueryParser extends QueryParser {
private static final String EXISTS_FIELD = "_exists_";

private final SearchExecutionContext context;
Expand Down Expand Up @@ -433,12 +433,11 @@ private Query getRangeQuerySingle(String field, String part1, String part2,
}

@Override
protected Query handleBareFuzzy(String field, Token fuzzySlop, String termImage) throws ParseException {
if (fuzzySlop.image.length() == 1) {
return getFuzzyQuery(field, termImage, fuzziness.asDistance(termImage));
protected float getFuzzyDistance(Token fuzzyToken, String termStr) {
if (fuzzyToken.image.length() == 1) {
return fuzziness.asDistance(termStr);
}
float distance = Fuzziness.fromString(fuzzySlop.image.substring(1)).asDistance(termImage);
return getFuzzyQuery(field, termImage, distance);
return Fuzziness.fromString(fuzzyToken.image.substring(1)).asDistance(termStr);
}

@Override
Expand Down