| | |
| | | import org.opends.server.api.Backend; |
| | | import org.opends.server.api.ClientConnection; |
| | | import org.opends.server.api.EntryCache; |
| | | import org.opends.server.api.VirtualAttributeProvider; |
| | | import org.opends.server.api.plugin.PluginResult.SubordinateDelete; |
| | | import org.opends.server.api.plugin.PluginResult.SubordinateModifyDN; |
| | | import org.opends.server.backends.pluggable.spi.Cursor; |
| | |
| | | searchOperation.setResultCode(ResultCode.UNAVAILABLE_CRITICAL_EXTENSION); |
| | | return null; |
| | | } |
| | | VLVRequestControl vlvRequest = searchOperation.getRequestControl(VLVRequestControl.DECODER); |
| | | |
| | | VLVRequestControl vlvRequest = searchOperation.getRequestControl(VLVRequestControl.DECODER); |
| | | if (vlvRequest != null && pageRequest != null) |
| | | { |
| | | LocalizableMessage message = ERR_JEB_SEARCH_CANNOT_MIX_PAGEDRESULTS_AND_VLV.get(); |
| | |
| | | |
| | | if (entryIDList == null) |
| | | { |
| | | // See if we could use a virtual attribute rule to process the |
| | | // search. |
| | | for (VirtualAttributeRule rule : DirectoryServer.getVirtualAttributes()) |
| | | if (processSearchWithVirtualAttributeRule(searchOperation, true)) |
| | | { |
| | | if (rule.getProvider().isSearchable(rule, searchOperation, true)) |
| | | { |
| | | rule.getProvider().processSearch(rule, searchOperation); |
| | | return null; |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | // Create an index filter to get the search result candidate entries |
| | |
| | | entryIDList.retainAll(scopeList); |
| | | if (debugBuffer != null) |
| | | { |
| | | debugBuffer.append(" scope="); |
| | | debugBuffer.append(searchScope); |
| | | debugBuffer.append(" scope=").append(searchScope); |
| | | scopeList.toString(debugBuffer); |
| | | } |
| | | if (scopeList.isDefined()) |
| | |
| | | debugBuffer.append(" final="); |
| | | entryIDList.toString(debugBuffer); |
| | | |
| | | Attribute attr = Attributes.create(ATTR_DEBUG_SEARCH_INDEX, debugBuffer.toString()); |
| | | Entry debugEntry = new Entry(DN.valueOf("cn=debugsearch"), null, null, null); |
| | | debugEntry.addAttribute(attr, new ArrayList<ByteString>()); |
| | | |
| | | Entry debugEntry = buildDebugSearchIndexEntry(debugBuffer); |
| | | searchOperation.returnEntry(debugEntry, null); |
| | | return null; |
| | | } |
| | | |
| | | if (entryIDList.isDefined()) |
| | | { |
| | | if (rootContainer.getMonitorProvider().isFilterUseEnabled()) |
| | | { |
| | | rootContainer.getMonitorProvider().updateIndexedSearchCount(); |
| | | } |
| | | rootContainer.getMonitorProvider().updateIndexedSearchCount(); |
| | | searchIndexed(txn, entryIDList, candidatesAreInScope, searchOperation, pageRequest); |
| | | } |
| | | else |
| | | { |
| | | if (rootContainer.getMonitorProvider().isFilterUseEnabled()) |
| | | { |
| | | rootContainer.getMonitorProvider().updateUnindexedSearchCount(); |
| | | } |
| | | rootContainer.getMonitorProvider().updateUnindexedSearchCount(); |
| | | |
| | | searchOperation.addAdditionalLogItem(keyOnly(getClass(), "unindexed")); |
| | | |
| | | // See if we could use a virtual attribute rule to process the |
| | | // search. |
| | | for (VirtualAttributeRule rule : DirectoryServer.getVirtualAttributes()) |
| | | if (processSearchWithVirtualAttributeRule(searchOperation, false)) |
| | | { |
| | | if (rule.getProvider().isSearchable(rule, searchOperation, false)) |
| | | { |
| | | rule.getProvider().processSearch(rule, searchOperation); |
| | | return null; |
| | | } |
| | | return null; |
| | | } |
| | | |
| | | ClientConnection clientConnection = searchOperation.getClientConnection(); |
| | |
| | | |
| | | if (sortRequest != null) |
| | | { |
| | | // FIXME -- Add support for sorting unindexed searches using |
| | | // indexes |
| | | // FIXME -- Add support for sorting unindexed searches using indexes |
| | | // like DSEE currently does. |
| | | searchOperation.addResponseControl(new ServerSideSortResponseControl(UNWILLING_TO_PERFORM, null)); |
| | | |
| | |
| | | } |
| | | } |
| | | |
| | | private boolean processSearchWithVirtualAttributeRule(final SearchOperation searchOperation, boolean isPreIndexed) |
| | | { |
| | | for (VirtualAttributeRule rule : DirectoryServer.getVirtualAttributes()) |
| | | { |
| | | VirtualAttributeProvider<?> provider = rule.getProvider(); |
| | | if (provider.isSearchable(rule, searchOperation, isPreIndexed)) |
| | | { |
| | | provider.processSearch(rule, searchOperation); |
| | | return true; |
| | | } |
| | | } |
| | | return false; |
| | | } |
| | | |
| | | private Entry buildDebugSearchIndexEntry(StringBuilder debugBuffer) throws DirectoryException |
| | | { |
| | | Attribute attr = Attributes.create(ATTR_DEBUG_SEARCH_INDEX, debugBuffer.toString()); |
| | | Entry entry = new Entry(DN.valueOf("cn=debugsearch"), null, null, null); |
| | | entry.addAttribute(attr, new ArrayList<ByteString>()); |
| | | return entry; |
| | | } |
| | | |
| | | /** |
| | | * We were not able to obtain a set of candidate entry IDs for the |
| | | * search from the indexes. |
| | |
| | | // Iterate through the index candidates. |
| | | if (continueSearch) |
| | | { |
| | | final SearchFilter filter = searchOperation.getFilter(); |
| | | for (Iterator<EntryID> it = entryIDList.iterator(begin); it.hasNext();) |
| | | { |
| | | final EntryID id = it.next(); |
| | |
| | | } |
| | | |
| | | // Process the candidate entry. |
| | | if (entry != null && isInScope(candidatesAreInScope, searchScope, aBaseDN, entry) |
| | | && (manageDsaIT || entry.getReferralURLs() == null) && searchOperation.getFilter().matchesEntry(entry)) |
| | | if (entry != null |
| | | && isInScope(candidatesAreInScope, searchScope, aBaseDN, entry) |
| | | && (manageDsaIT || entry.getReferralURLs() == null) |
| | | && filter.matchesEntry(entry)) |
| | | { |
| | | if (pageRequest != null |
| | | && searchOperation.getEntriesSent() == pageRequest.getSize()) |