Close
dtSearch Text Retrieval Engine Programmer's Reference
Using SearchFilters to implement document security

Describes how to use search filters to integrate limited access rights and full-text searching.

Requirement: Implement searching for a document manager that keeps access rights in a database. Users are assigned to one or more security categories, and each category corresponds to a subset of the document collection. When a user searches the documents, the user must only see items in search results that the user is permitted to access. 

To use SearchFilters to implement security, an application would first create a series of SearchFilters, one for each security category, based information in the database (or other repository) that specifies security rights. When a user submits a query, the application would select the SearchFilter that corresponds to the user's security category and attach it to the search. When the search executes, it will only return documents that the SearchFilter permits. 

If possible, the SearchFilters should be constructed each time the index is created or updated, so they will be immediately available for searching. To do this, document ids are stored in the database as described in the database indexing example. Once an update completes, a SearchFilter is generated for each security category and saved as a file. When a user searches, the SearchFilter that corresponds to the user's security category is used to limit the search. If the user belongs to multiple security categories, the SearchFilters can be combined.