Links
dtSearch Text Retrieval Engine Programmer's Reference
ISearchFilter Interface
dten600.idl | Interfaces | Legend | Members | Methods | Properties | Send Feedback

Provides a way to designate which documents can be returned by a search.

Class Hierarchy
[ object, uuid(6D615A9E-73D4-4FEF-A0DA-6973C26C17B2), dual, helpstring("ISearchFilter Interface"), pointer_default(unique) ]
interface ISearchFilter : IDispatch;
File
Remarks

SearchFilter is useful in situations where a text search using must be combined with a search of a database. The database search is done first, and then the results of the database search are used to limit the dtSearch search.

Document Ids

Search filters do not use names to identify documents because a filter may specify thousands, or hundreds of thousands, of documents, and a table of filenames would take too much memory and would take too long to check. Instead, each document is identified by (a) the index it belongs to, and (b) the document's DocId, a unique integer that is assigned to each document in an index. The docId for a document can be obtained by searching for the document by name, and then examining the document's properties in search results. See: Document Ids 

A docId that is selected may be returned in search results. A document that is not selected will not be returned in search results, even if it otherwise satisfies the search request. 

If the criteria for the SearchFilter can be expressed as one or more search requests, you can use SelectItemsBySearch to select documents in the SearchFilter.

Indexes and Index identifiers

A search filter can cover any number of indexes. To add an index to a search filter, call AddIndex() with the full path to the index. The path must be expressed exactly as it will be expressed in the search job. The AddIndex() method returns an integer that is used to identify that index when selecting and de-selecting documents for the filter. (This makes the selection and de-selection functions, which may be called thousands of times, more effiicent.)

Implementation

A search filter is implemented in the dtSearch Engine using a table of bit vectors, one for each index in the filter. Each bit vector has one bit for each document in its index. For example, a search filter for a single index with 1,000,000 documents would have 1,000,000 bits, or 125 kilobytes of data.

Example
 // Set up a filter that will only allow documents 1 through 10 in the index
 // to be returned.
 dim filter as dtengine.SearchFilter
 set filter = theEngine.NewSearchFilter
 dim iIndex as integer
 iIndex = filter.AddIndex("c:dataindex")
 ' Select documents with ids from 1 to 10
 filter.SelectItems(iIndex, 1, 10, true);
 ' Select documents containing "apple"
 filter.SelectItemsBySearch(iIndex, "apple", true);
 ... set up search job ...
 searchJob.SetFilter(filter)
 // Execute the search
 searchJob.Execute()

 

See Filter.vbs for more sample code using SearchFilter.

Group
Methods
Method 
Description 
Add an index to the filter, returning an integer that can be used to identify the index in the selection functions. 
And 
Combine this filter with another filter in a logical "AND" operation. Only documents included in both filters will be included in this filter following an AND 
Combine this filter with another filter in a logical "AND NOT" operation. 
GetItemArray returns an array of 32-bit integers containing all of the document ids selected in a search filter. 
GetItemArrayVBS is identical to GetItemArray, except that it returns the document ids in an array of Variants, so the array can be used in VBScript. 
Returns the path of one of the indexes in the filter 
Or 
Combine this filter with another filter in a logical "OR" operation. All documents included in either filter will be included in this filter following an OR. 
Read 
Read the filter from a file 
Read a series of search filters from disk files. The filenames list is a space-delimited list of filenames. Filenames containing spaces should be quoted in the string. Returns the number of search filters read successfully. All of the search filters are logically combined with an "OR" operation. 
Select all of the documents in the index 
Set the selection state of a range of document ids, from firstId to lastId, to the selection state indicated by fSelected 
Set the selection state of all documents in an index that match search request. 
Select no documents in the index. By default, no documents are selected when a search filter is created, so there is no need to call selectNone to initialize the filter. 
Save the filter to a file 
Properties
Property 
Description 
Number of indexes in the filter 
Legend
 
Property 
 
read only 
 
Method 
Links
You are here: COM Interface > Interfaces > ISearchFilter Interface
Copyright (c) 1995-2008 dtSearch Corp. All rights reserved.