Places:Full Text Indexing: Difference between revisions

Jump to navigation Jump to search
m
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. The result of nsNavHistoryQuery::search will do a full-text search with nsNavHistoryQuery::searchTerms. This is very powerful with the number of options that you can specify. Conjunctive queries can be executed.  
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 search function uses the searchTerms to call nsNavFullTextIndex::searchDocument(term). This returns a url list based on a certain ranking. This function further filters based on other criteria such as date etc.. provided in the query options. The filtered url list is returned
<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===
24

edits

Navigation menu