implemented full-text search

This commit is contained in:
2025-09-03 21:53:19 +02:00
parent 379d156fd2
commit e372720dd2
6 changed files with 38 additions and 10 deletions

View File

@@ -93,7 +93,11 @@ CREATE TABLE IF NOT EXISTS {0} (
public Map<Long, Time> find(long userId, List<String> keys, boolean fulltext) {
try {
var query = select(ALL).from(TABLE_TIMES).where(USER_ID,equal(userId));
for (var key : keys) query.where(format("CONCAT({0},\" \",{1})",SUBJECT,DESCRIPTION),like("%"+key+"%"));
if (fulltext) {
for (var key : keys) query.where(format("CONCAT({0},\" \",{1})",SUBJECT,DESCRIPTION),like("%"+key+"%"));
} else {
for (var key : keys) query.where(SUBJECT,like("%"+key+"%"));
}
var rs = query.exec(db);
var times = new HashMap<Long,Time>();
while (rs.next()) {
@@ -103,7 +107,6 @@ CREATE TABLE IF NOT EXISTS {0} (
rs.close();
return times;
} catch (Exception e) {
throw new UmbrellaException("Failed to search for times");
}
}