Geary.ImapDb.SearchQuery: Rename to Geary.FtsSearchQuery
There's nothing IMAP-specific about the class, so move it to common and rename to reflect what it is actually used for.
This commit is contained in:
parent
2ab7b2c39e
commit
20a4fd3ed2
8 changed files with 27 additions and 24 deletions
|
|
@ -7,9 +7,9 @@
|
|||
*/
|
||||
|
||||
/**
|
||||
* Internal implementation of {@link Geary.SearchQuery}.
|
||||
* A search query implementation that provides full-text search.
|
||||
*/
|
||||
private class Geary.ImapDB.SearchQuery : Geary.SearchQuery {
|
||||
internal class Geary.FtsSearchQuery : Geary.SearchQuery {
|
||||
|
||||
|
||||
private const string EMAIL_TEXT_STEMMED_TERMS = "geary-stemmed-terms";
|
||||
|
|
@ -22,9 +22,9 @@ private class Geary.ImapDB.SearchQuery : Geary.SearchQuery {
|
|||
private unowned SnowBall.Stemmer stemmer;
|
||||
|
||||
|
||||
public SearchQuery(Gee.List<Term> expression,
|
||||
string raw,
|
||||
SnowBall.Stemmer stemmer) {
|
||||
public FtsSearchQuery(Gee.List<Term> expression,
|
||||
string raw,
|
||||
SnowBall.Stemmer stemmer) {
|
||||
base(expression, raw);
|
||||
this.stemmer = stemmer;
|
||||
|
||||
|
|
@ -585,7 +585,7 @@ private class Geary.ImapDB.Account : BaseObject {
|
|||
debug("Search query: %s", q.to_string());
|
||||
|
||||
check_open();
|
||||
ImapDB.SearchQuery query = check_search_query(q);
|
||||
FtsSearchQuery query = check_search_query(q);
|
||||
|
||||
// Do this outside of transaction to catch invalid search ids up-front
|
||||
string? search_ids_sql = get_search_ids_sql(search_ids);
|
||||
|
|
@ -696,7 +696,7 @@ private class Geary.ImapDB.Account : BaseObject {
|
|||
public async Gee.Set<string>? get_search_matches_async(Geary.SearchQuery q,
|
||||
Gee.Collection<ImapDB.EmailIdentifier> ids, Cancellable? cancellable = null) throws Error {
|
||||
check_open();
|
||||
ImapDB.SearchQuery query = check_search_query(q);
|
||||
FtsSearchQuery query = check_search_query(q);
|
||||
|
||||
Gee.Set<string>? search_matches = null;
|
||||
yield db.exec_transaction_async(Db.TransactionType.RO, (cx) => {
|
||||
|
|
@ -1223,7 +1223,7 @@ private class Geary.ImapDB.Account : BaseObject {
|
|||
// not per key-value
|
||||
public Gee.Map<ImapDB.EmailIdentifier, Gee.Set<string>> do_get_search_matches(
|
||||
Db.Connection cx,
|
||||
ImapDB.SearchQuery query,
|
||||
FtsSearchQuery query,
|
||||
Gee.Map<int64?, ImapDB.EmailIdentifier> id_map,
|
||||
GLib.Cancellable? cancellable
|
||||
) throws GLib.Error {
|
||||
|
|
@ -1327,8 +1327,8 @@ private class Geary.ImapDB.Account : BaseObject {
|
|||
}
|
||||
}
|
||||
|
||||
private ImapDB.SearchQuery check_search_query(Geary.SearchQuery q) throws Error {
|
||||
ImapDB.SearchQuery? query = q as ImapDB.SearchQuery;
|
||||
private FtsSearchQuery check_search_query(Geary.SearchQuery q) throws Error {
|
||||
var query = q as FtsSearchQuery;
|
||||
if (query == null) {
|
||||
throw new EngineError.BAD_PARAMETERS("Geary.SearchQuery not associated with %s", name);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -580,7 +580,7 @@ private abstract class Geary.ImapEngine.GenericAccount : Geary.Account {
|
|||
string text,
|
||||
GLib.Cancellable? cancellable
|
||||
) throws GLib.Error {
|
||||
return new ImapDB.SearchQuery(expression, text, this.stemmer);
|
||||
return new FtsSearchQuery(expression, text, this.stemmer);
|
||||
}
|
||||
|
||||
public override async Gee.MultiMap<Geary.Email, Geary.FolderPath?>? local_search_message_id_async(
|
||||
|
|
|
|||
|
|
@ -67,6 +67,7 @@ engine_vala_sources = files(
|
|||
|
||||
'common/common-contact-harvester.vala',
|
||||
'common/common-contact-store-impl.vala',
|
||||
'common/common-fts-search-query.vala',
|
||||
'common/common-message-data.vala',
|
||||
|
||||
'db/db.vala',
|
||||
|
|
@ -179,7 +180,6 @@ engine_vala_sources = files(
|
|||
'imap-db/imap-db-fts5-matches.c',
|
||||
'imap-db/imap-db-gc.vala',
|
||||
'imap-db/imap-db-message-row.vala',
|
||||
'imap-db/imap-db-search-query.vala',
|
||||
'imap-db/imap-db-sqlite.c',
|
||||
|
||||
'imap-engine/imap-engine.vala',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue