mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

Fabio Pistolesi
06.48.2015 75ee22ead20ad8d1b059974b56f48351b4e7995a
OPENDJ-2119 CR-7476 debugsearchindex incorrect output with AND search on only one attribute

Running a search while asking for debug information about filter processing should return for each AVA what happened.
If we detect the search can be simplified as a bounded range, though, only partial information is printed, since we "forget"
to update the debug information, normally updated by each evaluation.
2 files modified
32 ■■■■ changed files
opendj-sdk/opendj-server-legacy/src/main/java/org/opends/server/backends/jeb/AttributeIndex.java 16 ●●●● patch | view | raw | blame | history
opendj-sdk/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/AttributeIndex.java 16 ●●●● patch | view | raw | blame | history
opendj-sdk/opendj-server-legacy/src/main/java/org/opends/server/backends/jeb/AttributeIndex.java
@@ -507,10 +507,18 @@
    // in IndexFilter#evaluateLogicalAndFilter method.
    // One solution could be to implement a boundedRangeAssertion that combine
    // the two operations in one.
    EntryIDSet results = evaluate(filter1, debugBuffer, monitor);
    EntryIDSet results2 = evaluate(filter2, debugBuffer, monitor);
    results.retainAll(results2);
    return results;
    StringBuilder tmpBuff1 = debugBuffer != null ? new StringBuilder(): null;
    StringBuilder tmpBuff2 = debugBuffer != null ? new StringBuilder(): null;
    EntryIDSet results1 = evaluate(filter1, tmpBuff1, monitor);
    EntryIDSet results2 = evaluate(filter2, tmpBuff2, monitor);
    if (debugBuffer != null)
    {
      debugBuffer
          .append(filter1).append(tmpBuff1).append(results1)
          .append(filter2).append(tmpBuff2).append(results2);
    }
    results1.retainAll(results2);
    return results1;
  }
  private EntryIDSet evaluate(SearchFilter filter, StringBuilder debugBuffer, DatabaseEnvironmentMonitor monitor)
opendj-sdk/opendj-server-legacy/src/main/java/org/opends/server/backends/pluggable/AttributeIndex.java
@@ -572,10 +572,18 @@
    // in IndexFilter#evaluateLogicalAndFilter method.
    // One solution could be to implement a boundedRangeAssertion that combine
    // the two operations in one.
    EntryIDSet results = evaluate(indexQueryFactory, filter1, debugBuffer, monitor);
    EntryIDSet results2 = evaluate(indexQueryFactory, filter2, debugBuffer, monitor);
    results.retainAll(results2);
    return results;
    StringBuilder tmpBuff1 = debugBuffer != null ? new StringBuilder() : null;
    StringBuilder tmpBuff2 = debugBuffer != null ? new StringBuilder() : null;
    EntryIDSet results1 = evaluate(indexQueryFactory, filter1, tmpBuff1, monitor);
    EntryIDSet results2 = evaluate(indexQueryFactory, filter2, tmpBuff2, monitor);
    if (debugBuffer != null)
    {
      debugBuffer
          .append(filter1).append(tmpBuff1).append(results1)
          .append(filter2).append(tmpBuff2).append(results2);
    }
    results1.retainAll(results2);
    return results1;
  }
  private EntryIDSet evaluate(IndexQueryFactory<IndexQuery> indexQueryFactory, SearchFilter filter,