Search small adjustments

This commit is contained in:
xingxing
2018-06-05 23:20:56 +08:00
parent a91ec5e9f4
commit a619b7a893
2 changed files with 6 additions and 6 deletions

View File

@@ -91,7 +91,7 @@ public class NoteDataStore {
DatabaseWrapper databaseWrapper = FlowManager.getWritableDatabase(AppDataBase.class);
String query = "select id from note where userid = ? and istrash = 0 and isdeleted = 0 and id in " +
"(select rowid from fts_note where fts_note match ?)";////查询Content中满足条件的记录
Cursor cursor = databaseWrapper.rawQuery(query, new String[]{Account.getCurrent().getUserId(), keyword});
Cursor cursor = databaseWrapper.rawQuery(query, new String[]{Account.getCurrent().getUserId(), "*" + keyword + "*"});
while(cursor.moveToNext()) {
set.add(cursor.getLong(cursor.getColumnIndex("id")));
}

View File

@@ -33,15 +33,15 @@ public class SearchActivity extends BaseActivity {
mSearchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
@Override
public boolean onQueryTextSubmit(String query) {
return false;
NoteFragment.Mode mode = NoteFragment.Mode.SEARCH;
mode.setKeywords(query);
mNoteFragment.setMode(mode);
return true;
}
@Override
public boolean onQueryTextChange(String newText) {
NoteFragment.Mode mode = NoteFragment.Mode.SEARCH;
mode.setKeywords(newText);
mNoteFragment.setMode(mode);
return true;
return false;
}
});