FTSearch (NotesDocumentCollection - JavaScript™)
Conducts a full-text search of all the documents in a collection and reduces the collection to a sorted collection of those documents that match.
Defined in
NotesDocumentCollectionSyntax
FTSearch(query:string) : void | Parameter | Description |
|---|---|
query |
A full-text query. See the section "Query Syntax" that follows. |
maxdocs |
The maximum number of documents you want returned from the query. Set this parameter to 0 to receive all matching documents. |
Usage
This method moves the current pointer to the first document in the collection.The collection of documents
that match the full-text query are sorted by relevance, with highest
relevance first. You can access the relevance score of each document
in the collection using getFTSearchScore in NotesDocument.
If the database is not full-text indexed, this method works, but less efficiently. To test for an index, use isFTIndexed. To create an index, use createFTIndex or updateFTIndex.
This
method searches all documents in a database. To search only documents
found in a particular view, use the FTSearch method in NotesView.
Query syntax
To search for a word or phrase, enter the word or phrase as is, except that search keywords must be enclosed in quotes. Remember to escape quotes if you are inside a literal.
Wildcards, operators, and other syntax are permitted. For the complete syntax rules, see "Refining a search query using operators" in Notes® Help. You can also search for "query syntax" in the Domino® Designer Eclipse help system.
Examples
This button gets all the documents that match a user-specified query.var dc:NotesDocumentCollection = database.getAllDocuments();
var query:string = requestScope.query;
if (!query.isEmpty()) {
query = "\"" + query + "\"";
database.updateFTIndex(true);
dc.FTSearch(query, 16);
if (dc.getCount() > 0) {
requestScope.status = dc.getCount().toFixed() + " hit(s):"
var doc:NotesDocument = dc.getFirstDocument();
while (doc != null) {
requestScope.status += "\n" + doc.getItemValueString("subject");
var tmpdoc = dc.getNextDocument();
doc.recycle();
doc = tmpdoc;
}
} else {
requestScope.status = "No hits"
}
} else {
requestScope.status = "No query"
}