mirror of https://github.com/apache/lucene.git
- LUCENE-796: Don't call super.get*Query(....) to let sub-classes override.
git-svn-id: https://svn.apache.org/repos/asf/lucene/java/trunk@525682 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
80d54c70ae
commit
9d7f9911a4
|
@ -37,6 +37,10 @@ API Changes
|
||||||
5. LUCENE-834: Changed some access levels for certain Span classes to allow them to be overridden. They have
|
5. LUCENE-834: Changed some access levels for certain Span classes to allow them to be overridden. They have
|
||||||
been marked expert only and not for public consumption. (Grant Ingersoll)
|
been marked expert only and not for public consumption. (Grant Ingersoll)
|
||||||
|
|
||||||
|
6. LUCENE-796: Removed calls to super.* from various get*Query methods in
|
||||||
|
MultiFieldQueryParser, in order to allow sub-classes to override them.
|
||||||
|
(Steven Parkes via Otis Gospodnetic)
|
||||||
|
|
||||||
Bug fixes
|
Bug fixes
|
||||||
|
|
||||||
1. LUCENE-804: Fixed build.xml to pack a fully compilable src dist. (Doron Cohen)
|
1. LUCENE-804: Fixed build.xml to pack a fully compilable src dist. (Doron Cohen)
|
||||||
|
|
|
@ -35,9 +35,8 @@ import java.util.Map;
|
||||||
*/
|
*/
|
||||||
public class MultiFieldQueryParser extends QueryParser
|
public class MultiFieldQueryParser extends QueryParser
|
||||||
{
|
{
|
||||||
|
protected String[] fields;
|
||||||
private String[] fields;
|
protected Map boosts;
|
||||||
private Map boosts;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a MultiFieldQueryParser.
|
* Creates a MultiFieldQueryParser.
|
||||||
|
@ -100,7 +99,7 @@ public class MultiFieldQueryParser extends QueryParser
|
||||||
if (field == null) {
|
if (field == null) {
|
||||||
Vector clauses = new Vector();
|
Vector clauses = new Vector();
|
||||||
for (int i = 0; i < fields.length; i++) {
|
for (int i = 0; i < fields.length; i++) {
|
||||||
Query q = super.getFieldQuery(fields[i], queryText);
|
Query q = getFieldQuery(fields[i], queryText);
|
||||||
if (q != null) {
|
if (q != null) {
|
||||||
//If the user passes a map of boosts
|
//If the user passes a map of boosts
|
||||||
if (boosts != null) {
|
if (boosts != null) {
|
||||||
|
@ -137,7 +136,7 @@ public class MultiFieldQueryParser extends QueryParser
|
||||||
if (field == null) {
|
if (field == null) {
|
||||||
Vector clauses = new Vector();
|
Vector clauses = new Vector();
|
||||||
for (int i = 0; i < fields.length; i++) {
|
for (int i = 0; i < fields.length; i++) {
|
||||||
clauses.add(new BooleanClause(super.getFuzzyQuery(fields[i], termStr, minSimilarity),
|
clauses.add(new BooleanClause(getFuzzyQuery(fields[i], termStr, minSimilarity),
|
||||||
BooleanClause.Occur.SHOULD));
|
BooleanClause.Occur.SHOULD));
|
||||||
}
|
}
|
||||||
return getBooleanQuery(clauses, true);
|
return getBooleanQuery(clauses, true);
|
||||||
|
@ -150,7 +149,7 @@ public class MultiFieldQueryParser extends QueryParser
|
||||||
if (field == null) {
|
if (field == null) {
|
||||||
Vector clauses = new Vector();
|
Vector clauses = new Vector();
|
||||||
for (int i = 0; i < fields.length; i++) {
|
for (int i = 0; i < fields.length; i++) {
|
||||||
clauses.add(new BooleanClause(super.getPrefixQuery(fields[i], termStr),
|
clauses.add(new BooleanClause(getPrefixQuery(fields[i], termStr),
|
||||||
BooleanClause.Occur.SHOULD));
|
BooleanClause.Occur.SHOULD));
|
||||||
}
|
}
|
||||||
return getBooleanQuery(clauses, true);
|
return getBooleanQuery(clauses, true);
|
||||||
|
@ -162,7 +161,7 @@ public class MultiFieldQueryParser extends QueryParser
|
||||||
if (field == null) {
|
if (field == null) {
|
||||||
Vector clauses = new Vector();
|
Vector clauses = new Vector();
|
||||||
for (int i = 0; i < fields.length; i++) {
|
for (int i = 0; i < fields.length; i++) {
|
||||||
clauses.add(new BooleanClause(super.getWildcardQuery(fields[i], termStr),
|
clauses.add(new BooleanClause(getWildcardQuery(fields[i], termStr),
|
||||||
BooleanClause.Occur.SHOULD));
|
BooleanClause.Occur.SHOULD));
|
||||||
}
|
}
|
||||||
return getBooleanQuery(clauses, true);
|
return getBooleanQuery(clauses, true);
|
||||||
|
@ -175,16 +174,13 @@ public class MultiFieldQueryParser extends QueryParser
|
||||||
if (field == null) {
|
if (field == null) {
|
||||||
Vector clauses = new Vector();
|
Vector clauses = new Vector();
|
||||||
for (int i = 0; i < fields.length; i++) {
|
for (int i = 0; i < fields.length; i++) {
|
||||||
clauses.add(new BooleanClause(super.getRangeQuery(fields[i], part1, part2, inclusive),
|
clauses.add(new BooleanClause(getRangeQuery(fields[i], part1, part2, inclusive),
|
||||||
BooleanClause.Occur.SHOULD));
|
BooleanClause.Occur.SHOULD));
|
||||||
}
|
}
|
||||||
return getBooleanQuery(clauses, true);
|
return getBooleanQuery(clauses, true);
|
||||||
}
|
}
|
||||||
return super.getRangeQuery(field, part1, part2, inclusive);
|
return super.getRangeQuery(field, part1, part2, inclusive);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parses a query which searches on the fields specified.
|
* Parses a query which searches on the fields specified.
|
||||||
|
@ -217,7 +213,6 @@ public class MultiFieldQueryParser extends QueryParser
|
||||||
return bQuery;
|
return bQuery;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parses a query, searching on the fields specified.
|
* Parses a query, searching on the fields specified.
|
||||||
* Use this if you need to specify certain fields as required,
|
* Use this if you need to specify certain fields as required,
|
||||||
|
@ -261,7 +256,6 @@ public class MultiFieldQueryParser extends QueryParser
|
||||||
return bQuery;
|
return bQuery;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Parses a query, searching on the fields specified.
|
* Parses a query, searching on the fields specified.
|
||||||
* Use this if you need to specify certain fields as required,
|
* Use this if you need to specify certain fields as required,
|
||||||
|
|
Loading…
Reference in New Issue