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/27 07:11:43 UTC

svn commit: r660383 - in /directory/apacheds/branches/bigbang: core/src/main/java/org/apache/directory/server/core/filtering/BaseEntryFilteringCursor.java xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultSearchEngine.java

Author: akarasulu
Date: Mon May 26 22:11:34 2008
New Revision: 660383

URL: http://svn.apache.org/viewvc?rev=660383&view=rev
Log:
fixing bugs in search for returning descendants of an attribute type in addition to properly processing returns of requested attributes

Modified:
    directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/filtering/BaseEntryFilteringCursor.java
    directory/apacheds/branches/bigbang/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultSearchEngine.java

Modified: directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/filtering/BaseEntryFilteringCursor.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/filtering/BaseEntryFilteringCursor.java?rev=660383&r1=660382&r2=660383&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/filtering/BaseEntryFilteringCursor.java (original)
+++ directory/apacheds/branches/bigbang/core/src/main/java/org/apache/directory/server/core/filtering/BaseEntryFilteringCursor.java Mon May 26 22:11:34 2008
@@ -367,7 +367,7 @@
                 
                 for ( AttributeTypeOptions attrOptions:getOperationContext().getReturningAttributes() )
                 {
-                    if ( attrOptions.getAttributeType().equals( at ) )
+                    if ( attrOptions.getAttributeType().equals( at ) || attrOptions.getAttributeType().isAncestorOf( at ) )
                     {
                         isNotRequested = false;
                         break;
@@ -393,7 +393,7 @@
                 
                 for ( AttributeTypeOptions attrOptions:getOperationContext().getReturningAttributes() )
                 {
-                    if ( attrOptions.getAttributeType().equals( at ) )
+                    if ( attrOptions.getAttributeType().equals( at ) || attrOptions.getAttributeType().isAncestorOf( at ) )
                     {
                         isNotRequested = false;
                         break;
@@ -419,7 +419,7 @@
                 
                 for ( AttributeTypeOptions attrOptions:getOperationContext().getReturningAttributes() )
                 {
-                    if ( attrOptions.getAttributeType().equals( at ) )
+                    if ( attrOptions.getAttributeType().equals( at ) || attrOptions.getAttributeType().isAncestorOf( at ) )
                     {
                         isNotRequested = false;
                         break;
@@ -434,6 +434,28 @@
             
             return;
         }
+        
+        if ( getOperationContext().getReturningAttributes() != null )
+        {
+            for ( AttributeType at : entry.getOriginalEntry().getAttributeTypes() )
+            {
+                boolean isNotRequested = true;
+                
+                for ( AttributeTypeOptions attrOptions:getOperationContext().getReturningAttributes() )
+                {
+                    if ( attrOptions.getAttributeType().equals( at ) || attrOptions.getAttributeType().isAncestorOf( at ) )
+                    {
+                        isNotRequested = false;
+                        break;
+                    }
+                }
+    
+                if ( isNotRequested )
+                {
+                    entry.removeAttributes( at );
+                }
+            }
+        }
     }
     
     

Modified: directory/apacheds/branches/bigbang/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultSearchEngine.java
URL: http://svn.apache.org/viewvc/directory/apacheds/branches/bigbang/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultSearchEngine.java?rev=660383&r1=660382&r2=660383&view=diff
==============================================================================
--- directory/apacheds/branches/bigbang/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultSearchEngine.java (original)
+++ directory/apacheds/branches/bigbang/xdbm-search/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultSearchEngine.java Mon May 26 22:11:34 2008
@@ -139,6 +139,7 @@
             
             IndexEntry<Long, ServerEntry> indexEntry = new ForwardIndexEntry<Long, ServerEntry>();
             indexEntry.setId( effectiveBaseId );
+            optimizer.annotate( filter );
             Evaluator<? extends ExprNode, ServerEntry> evaluator = evaluatorBuilder.build( filter );
             
             if ( evaluator.evaluate( indexEntry ) )