Lines Matching defs:query

27  * Decides whether a given source should be queried for a given query, taking
28 * into account the source's query threshold and query after zero results flag.
37 // The last query we've seen
43 // returned zero results for some prefix of the current query. mEmptyCorpora
44 // maps from corpus to the length of the query which returned
45 // zero results. When a query is shortened (e.g., by deleting characters)
55 * Returns whether we should query the given source for the given query.
57 public boolean shouldQueryCorpus(Corpus corpus, String query) {
58 updateQuery(query);
59 if (query.length() == 0
60 && !corpus.isWebCorpus() // always query web, to warm up connection
64 if (query.length() >= corpus.getQueryThreshold()) {
77 * Called to notify ShouldQueryStrategy when a source reports no results for a query.
79 public void onZeroResults(Corpus corpus, String query) {
80 // Make sure this result is actually for a prefix of the current query.
81 if (mLastQuery.startsWith(query) && !corpus.queryAfterZeroResults()
82 && !TextUtils.isEmpty(query)) {
83 if (DBG) Log.d(TAG, corpus + " returned 0 results for '" + query + "'");
84 mEmptyCorpora.put(corpus, query.length());
88 private void updateQuery(String query) {
89 if (query.startsWith(mLastQuery)) {
90 // This is a refinement of the last query, no changes to mEmptyCorpora needed
91 } else if (mLastQuery.startsWith(query)) {
92 // This is a widening of the last query: clear out any sources
93 // that reported zero results after this query.
96 if (iter.next().getValue() > query.length()) {
101 // This is a completely different query, clear everything.
104 mLastQuery = query;