mirror of https://github.com/apache/lucene.git
LUCENE-7205: Remove repeated nl.getLength() calls in (Boolean|DisjunctionMax|FuzzyLikeThis)QueryBuilder.
This commit is contained in:
parent
ca83f60438
commit
87d7de0d98
|
@ -77,6 +77,9 @@ Other
|
||||||
|
|
||||||
* LUCENE-7174: Upgrade randomizedtesting to 2.3.4. (Uwe Schindler, Dawid Weiss)
|
* LUCENE-7174: Upgrade randomizedtesting to 2.3.4. (Uwe Schindler, Dawid Weiss)
|
||||||
|
|
||||||
|
* LUCENE-7205: Remove repeated nl.getLength() calls in
|
||||||
|
(Boolean|DisjunctionMax|FuzzyLikeThis)QueryBuilder. (Christine Poerschke)
|
||||||
|
|
||||||
======================= Lucene 6.0.0 =======================
|
======================= Lucene 6.0.0 =======================
|
||||||
|
|
||||||
System Requirements
|
System Requirements
|
||||||
|
|
|
@ -49,7 +49,8 @@ public class BooleanQueryBuilder implements QueryBuilder {
|
||||||
bq.setMinimumNumberShouldMatch(DOMUtils.getAttribute(e, "minimumNumberShouldMatch", 0));
|
bq.setMinimumNumberShouldMatch(DOMUtils.getAttribute(e, "minimumNumberShouldMatch", 0));
|
||||||
|
|
||||||
NodeList nl = e.getChildNodes();
|
NodeList nl = e.getChildNodes();
|
||||||
for (int i = 0; i < nl.getLength(); i++) {
|
final int nlLen = nl.getLength();
|
||||||
|
for (int i = 0; i < nlLen; i++) {
|
||||||
Node node = nl.item(i);
|
Node node = nl.item(i);
|
||||||
if (node.getNodeName().equals("Clause")) {
|
if (node.getNodeName().equals("Clause")) {
|
||||||
Element clauseElem = (Element) node;
|
Element clauseElem = (Element) node;
|
||||||
|
|
|
@ -49,7 +49,8 @@ public class DisjunctionMaxQueryBuilder implements QueryBuilder {
|
||||||
|
|
||||||
List<Query> disjuncts = new ArrayList<>();
|
List<Query> disjuncts = new ArrayList<>();
|
||||||
NodeList nl = e.getChildNodes();
|
NodeList nl = e.getChildNodes();
|
||||||
for (int i = 0; i < nl.getLength(); i++) {
|
final int nlLen = nl.getLength();
|
||||||
|
for (int i = 0; i < nlLen; i++) {
|
||||||
Node node = nl.item(i);
|
Node node = nl.item(i);
|
||||||
if (node instanceof Element) { // all elements are disjuncts.
|
if (node instanceof Element) { // all elements are disjuncts.
|
||||||
Element queryElem = (Element) node;
|
Element queryElem = (Element) node;
|
||||||
|
|
|
@ -50,7 +50,8 @@ public class FuzzyLikeThisQueryBuilder implements QueryBuilder {
|
||||||
FuzzyLikeThisQuery fbq = new FuzzyLikeThisQuery(maxNumTerms, analyzer);
|
FuzzyLikeThisQuery fbq = new FuzzyLikeThisQuery(maxNumTerms, analyzer);
|
||||||
fbq.setIgnoreTF(DOMUtils.getAttribute(e, "ignoreTF", DEFAULT_IGNORE_TF));
|
fbq.setIgnoreTF(DOMUtils.getAttribute(e, "ignoreTF", DEFAULT_IGNORE_TF));
|
||||||
|
|
||||||
for (int i = 0; i < nl.getLength(); i++) {
|
final int nlLen = nl.getLength();
|
||||||
|
for (int i = 0; i < nlLen; i++) {
|
||||||
Element fieldElem = (Element) nl.item(i);
|
Element fieldElem = (Element) nl.item(i);
|
||||||
float minSimilarity = DOMUtils.getAttribute(fieldElem, "minSimilarity", DEFAULT_MIN_SIMILARITY);
|
float minSimilarity = DOMUtils.getAttribute(fieldElem, "minSimilarity", DEFAULT_MIN_SIMILARITY);
|
||||||
int prefixLength = DOMUtils.getAttribute(fieldElem, "prefixLength", DEFAULT_PREFIX_LENGTH);
|
int prefixLength = DOMUtils.getAttribute(fieldElem, "prefixLength", DEFAULT_PREFIX_LENGTH);
|
||||||
|
|
Loading…
Reference in New Issue