lib/search: make optional word args available in public api
This commit is contained in:
@@ -17,12 +17,26 @@ class JaDBConnection {
|
||||
searchKanjiWithDbConnection(this._connection, kanji);
|
||||
|
||||
/// Search for a word in the database.
|
||||
Future<List<WordSearchResult>?> searchWord(String word) =>
|
||||
searchWordWithDbConnection(this._connection, word);
|
||||
Future<List<WordSearchResult>?> searchWord(
|
||||
String word, {
|
||||
SearchMode searchMode = SearchMode.Auto,
|
||||
int page = 0,
|
||||
int pageSize = 10,
|
||||
}) =>
|
||||
searchWordWithDbConnection(
|
||||
this._connection,
|
||||
word,
|
||||
searchMode,
|
||||
page,
|
||||
pageSize,
|
||||
);
|
||||
|
||||
/// Search for a word in the database, and return the count of results.
|
||||
Future<int?> searchWordCount(String word) =>
|
||||
searchWordCountWithDbConnection(this._connection, word);
|
||||
Future<int?> searchWordCount(
|
||||
String word, {
|
||||
SearchMode searchMode = SearchMode.Auto,
|
||||
}) =>
|
||||
searchWordCountWithDbConnection(this._connection, word, searchMode);
|
||||
|
||||
/// Given a list of radicals, search which kanji contains all
|
||||
/// of the radicals, find their other radicals, and return those.
|
||||
|
||||
@@ -23,11 +23,11 @@ enum SearchMode {
|
||||
|
||||
Future<List<WordSearchResult>?> searchWordWithDbConnection(
|
||||
DatabaseExecutor connection,
|
||||
String word, {
|
||||
SearchMode searchMode = SearchMode.Auto,
|
||||
int page = 0,
|
||||
int pageSize = 10,
|
||||
}) async {
|
||||
String word,
|
||||
SearchMode searchMode,
|
||||
int page,
|
||||
int pageSize,
|
||||
) async {
|
||||
if (word.isEmpty) {
|
||||
return null;
|
||||
}
|
||||
@@ -80,9 +80,9 @@ Future<List<WordSearchResult>?> searchWordWithDbConnection(
|
||||
|
||||
Future<int?> searchWordCountWithDbConnection(
|
||||
DatabaseExecutor connection,
|
||||
String word, {
|
||||
SearchMode searchMode = SearchMode.Auto,
|
||||
}) async {
|
||||
String word,
|
||||
SearchMode searchMode,
|
||||
) async {
|
||||
if (word.isEmpty) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user