Seems this changes breaks a test in core-integ:
org.apache.directory.server.core.operations.search.SearchIT.testSearchEmptyDNWithSubLevelScope()

With this change the sublevel scope search beginning at root only
returns entries from ou=system, but not from ou=schema.

Kind Regards,
Stefan


On 08/03/2013 11:01 AM, [email protected] wrote:
> Author: elecharny
> Date: Sat Aug  3 09:01:08 2013
> New Revision: 1509945
> 
> URL: http://svn.apache.org/r1509945
> Log:
> Limit the number of gathered candidates to 100 to avoid the construction of a 
> huge set of candidates (for instance if the filter is something like 
> ObjectClass=person with 1 million entries)
> 
> Modified:
>     
> directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultOptimizer.java
> 
> Modified: 
> directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultOptimizer.java
> URL: 
> http://svn.apache.org/viewvc/directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultOptimizer.java?rev=1509945&r1=1509944&r2=1509945&view=diff
> ==============================================================================
> --- 
> directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultOptimizer.java
>  (original)
> +++ 
> directory/apacheds/trunk/xdbm-partition/src/main/java/org/apache/directory/server/xdbm/search/impl/DefaultOptimizer.java
>  Sat Aug  3 09:01:08 2013
> @@ -304,21 +304,35 @@ public class DefaultOptimizer<E> impleme
>          {
>              Index<V, E, String> idx = ( Index<V, E, String> ) db.getIndex( 
> node.getAttributeType() );
>  
> -            //return idx.count( node.getValue().getValue() );
> -
>              Cursor<String> result = idx.forwardValueCursor( 
> node.getValue().getValue() );
>              Set<String> values = new HashSet<String>();
> +            int nbFound = 0;
>  
>              for ( String value : result )
>              {
>                  values.add( value );
> +                nbFound++;
> +
> +                // Arbitrary stop gathering the candidates if we have more 
> than 100
> +                if ( nbFound == 100 )
> +                {
> +                    break;
> +                }
>              }
>  
>              result.close();
>  
> -            node.set( "candidates", values );
> +            if ( nbFound < 100 )
> +            {
> +                // Store the found candidates in the node
> +                node.set( "candidates", values );
>  
> -            return values.size();
> +                return values.size();
> +            }
> +            else
> +            {
> +                return idx.count( node.getValue().getValue() );
> +            }
>          }
>  
>          // count for non-indexed attribute is unknown so we presume da worst
> 
> 

Reply via email to