1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one 3 * or more contributor license agreements. See the NOTICE file 4 * distributed with this work for additional information 5 * regarding copyright ownership. The ASF licenses this file 6 * to you under the Apache License, Version 2.0 (the 7 * "License"); you may not use this file except in compliance 8 * with the License. You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, 13 * software distributed under the License is distributed on an 14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 * KIND, either express or implied. See the License for the 16 * specific language governing permissions and limitations 17 * under the License. 18 * 19 */ 20 package org.apache.directory.server.xdbm.search; 21 22 23 import org.apache.directory.api.ldap.model.constants.JndiPropertyConstants; 24 import org.apache.directory.api.ldap.model.exception.LdapException; 25 import org.apache.directory.api.ldap.model.filter.ExprNode; 26 import org.apache.directory.api.ldap.model.schema.SchemaManager; 27 import org.apache.directory.server.core.api.interceptor.context.SearchOperationContext; 28 import org.apache.directory.server.core.api.partition.PartitionTxn; 29 30 31 /** 32 * Given a search filter and a scope the search engine identifies valid 33 * candidate entries returning their ids. 34 * 35 * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a> 36 */ 37 public interface SearchEngine 38 { 39 /** 40 * TODO put this in the right place 41 * The alias dereferencing mode key for JNDI providers 42 */ 43 String ALIASMODE_KEY = JndiPropertyConstants.JNDI_LDAP_DAP_DEREF_ALIASES; 44 45 /** 46 * TODO put this in the right place 47 * The alias dereferencing mode value for JNDI providers 48 */ 49 String ALWAYS = "always"; 50 51 /** 52 * TODO put this in the right place 53 * The alias dereferencing mode value for JNDI providers 54 */ 55 String NEVER = "never"; 56 57 /** 58 * TODO put this in the right place 59 * The alias dereferencing mode value for JNDI providers 60 */ 61 String FINDING = "finding"; 62 63 /** 64 * TODO put this in the right place 65 * The alias dereferencing mode value for JNDI providers 66 */ 67 String SEARCHING = "searching"; 68 69 70 /** 71 * Gets the optimizer for this DefaultSearchEngine. 72 * 73 * @return the optimizer 74 */ 75 Optimizer getOptimizer(); 76 77 78 /** 79 * Conducts a search on a database. It returns a set of UUID we found for the 80 * given filter. 81 * 82 * @param partitionTxn The transaction to use 83 * @param schemaManager The SchemaManager instance 84 * @param searchContext the search context 85 * @return A set of UUID representing the full result, up to he sizeLimit 86 * @throws LdapException if the search fails 87 */ 88 PartitionSearchResult computeResult( PartitionTxn partitionTxn, SchemaManager schemaManager, 89 SearchOperationContext searchContext ) throws LdapException; 90 91 92 /** 93 * Builds an Evaluator for a filter expression. 94 * 95 * @param partitionTxn The transaction to use 96 * @param filter the filter root AST node 97 * @return true if the filter passes the entry, false otherwise 98 * @throws LdapException if something goes wrong while accessing the db 99 */ 100 Evaluator<? extends ExprNode> evaluator( PartitionTxn partitionTxn, ExprNode filter ) throws LdapException; 101 }