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-7205: Remove repeated nl.getLength() calls in
|
||||
(Boolean|DisjunctionMax|FuzzyLikeThis)QueryBuilder. (Christine Poerschke)
|
||||
|
||||
======================= Lucene 6.0.0 =======================
|
||||
|
||||
System Requirements
|
||||
|
|
|
@ -49,7 +49,8 @@ public class BooleanQueryBuilder implements QueryBuilder {
|
|||
bq.setMinimumNumberShouldMatch(DOMUtils.getAttribute(e, "minimumNumberShouldMatch", 0));
|
||||
|
||||
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);
|
||||
if (node.getNodeName().equals("Clause")) {
|
||||
Element clauseElem = (Element) node;
|
||||
|
|
|
@ -49,7 +49,8 @@ public class DisjunctionMaxQueryBuilder implements QueryBuilder {
|
|||
|
||||
List<Query> disjuncts = new ArrayList<>();
|
||||
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);
|
||||
if (node instanceof Element) { // all elements are disjuncts.
|
||||
Element queryElem = (Element) node;
|
||||
|
|
|
@ -50,7 +50,8 @@ public class FuzzyLikeThisQueryBuilder implements QueryBuilder {
|
|||
FuzzyLikeThisQuery fbq = new FuzzyLikeThisQuery(maxNumTerms, analyzer);
|
||||
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);
|
||||
float minSimilarity = DOMUtils.getAttribute(fieldElem, "minSimilarity", DEFAULT_MIN_SIMILARITY);
|
||||
int prefixLength = DOMUtils.getAttribute(fieldElem, "prefixLength", DEFAULT_PREFIX_LENGTH);
|
||||
|
|
Loading…
Reference in New Issue