24
edits
Mindboggler (talk | contribs) |
Mindboggler (talk | contribs) |
||
| Line 79: | Line 79: | ||
===nsNavHistoryQuery=== | ===nsNavHistoryQuery=== | ||
This class is already implemented with all features except searching text. The mechanism of searching is no different from what described in http://developer.mozilla.org/en/docs/Places:Query_System | This class is already implemented with all features except searching text. The mechanism of searching is no different from what described in http://developer.mozilla.org/en/docs/Places:Query_System. | ||
The | <pre> | ||
var historyService = Components.classes["@mozilla.org/browser/nav-history-service;1"] .getService(Components.interfaces.nsINavHistoryService);// no query parameters will get all history | |||
var options = historyService.getNewQueryOptions(); | |||
var query = historyService.getNewQuery(); | |||
query.searchTerms = "Mozilla Firefox"; | |||
// execute the query | |||
var result = historyService.executeQuery(query, options); | |||
</prev> | |||
The result will contain a list of URI. A number of options can be specified in query and options making it very powerful. Conjunctive queries can be also be executed with historyService.executeQueries and a list of query as parameter. | |||
Internally the function calls nsNavFullTextIndex::searchDocument(searchTerms) which returns a list of URI ranked according to algorithm described in SearchDocument(terms) function that will be described later in this document. The list of URI is further filtered by the other parameters set in query and options variable. In case of executeQueries method, the list is aggregated with results from multiple queries. | |||
===nsNavFullTextIndex=== | ===nsNavFullTextIndex=== | ||
edits