You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@directory.apache.org by ak...@apache.org on 2008/05/24 02:33:41 UTC
svn commit: r659727 -
/directory/apacheds/branches/bigbang/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeEvaluator.java
Author: akarasulu
Date: Fri May 23 17:33:39 2008
New Revision: 659727
URL: http://svn.apache.org/viewvc?rev=659727&view=rev
Log:
fixing bug where we forgot to properly check for condition where the context entry is tested for subtree scope - we do not store the context entry id in the subtree index so we needed to handle it explicitly
Modified:
directory/apacheds/branches/bigbang/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeEvaluator.java
Modified: directory/apacheds/branches/bigbang/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeEvaluator.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeEvaluator.java?rev=659727&r1=659726&r2=659727&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeEvaluator.java (original)
+++ directory/apacheds/branches/bigbang/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/SubtreeScopeEvaluator.java Fri May 23 17:33:39 2008
@@ -43,6 +43,18 @@
/** The entry identifier of the scope base */
private final Long baseId;
+ /**
+ * Whether or not to accept all candidates. If this evaluator's baseId is
+ * set to the context entry's id, then obviously all candidates will be
+ * subordinate to this root ancestor or in subtree scope. This check is
+ * done on initialization and used there after. One reason we need do
+ * this is because the subtree scope index (sub level index) does not map
+ * the values for the context entry id to it's subordinates since it would
+ * have to include all entries. This is a waste of space and lookup time
+ * since we know all entries will be subordinates in this case.
+ */
+ private final boolean baseIsContextEntry;
+
/** True if the scope requires alias dereferencing while searching */
private final boolean dereferencing;
@@ -68,11 +80,12 @@
}
baseId = db.getEntryId( node.getBaseDn() );
+ baseIsContextEntry = db.getContextEntryId().longValue() == baseId.longValue();
dereferencing = node.getDerefAliases().isDerefInSearching() ||
node.getDerefAliases().isDerefAlways();
}
-
+
/**
* Asserts whether or not a candidate has one level scope while taking
* alias dereferencing into account.
@@ -85,6 +98,18 @@
*/
public boolean evaluate( IndexEntry<?,E> candidate ) throws Exception
{
+ /*
+ * This condition catches situations where the candidate is equal to
+ * the base entry and when the base entry is the context entry. Note
+ * we do not store a mapping in the subtree index of the context entry
+ * to all it's subordinates since that would be the entire set of
+ * entries in the db.
+ */
+ if ( baseIsContextEntry || baseId.longValue() == candidate.getId().longValue() )
+ {
+ return true;
+ }
+
boolean isDescendant = db.getSubLevelIndex().forward( baseId, candidate.getId() );
/*