eliminate duplicate results; order by data properly

This commit is contained in:
anon 2024-08-05 23:20:45 +02:00
parent fb9a75dee8
commit 24611f5cca
2 changed files with 12 additions and 5 deletions

View File

@ -1,4 +1,3 @@
+ make case insensitive search optional
+ make fuzzy searching optional
+ make (potentially slow) queries cancel using multi threading + make (potentially slow) queries cancel using multi threading
+ the same suggestion should only show up once + levenstein seems horribly buggy with single character results
+ rebinding queries should be faster than repreparing them

View File

@ -15,24 +15,32 @@ bool is_caseless = false;
const char * const literal_query = const char * const literal_query =
"SELECT * FROM entries " "SELECT * FROM entries "
"WHERE data GLOB CONCAT('*', ?, '*') " "WHERE data GLOB CONCAT('*', ?, '*') "
"GROUP BY data "
"ORDER BY stamp DESC "
"LIMIT ? " "LIMIT ? "
"OFFSET ?;" "OFFSET ?;"
; ;
const char * const literal_caseless_query = const char * const literal_caseless_query =
"SELECT * FROM entries " "SELECT * FROM entries "
"WHERE data LIKE CONCAT('%', ?, '%') " "WHERE data LIKE CONCAT('%', ?, '%') "
"GROUP BY data "
"ORDER BY stamp DESC "
"LIMIT ? " "LIMIT ? "
"OFFSET ?;" "OFFSET ?;"
; ;
const char * const levenstein_query = const char * const levenstein_query =
"SELECT * FROM entries " "SELECT * FROM entries "
"ORDER BY DAMERAU_LEVENSHTEIN_SUBSTRING(data, ?) " "GROUP BY data "
"ORDER BY DAMERAU_LEVENSHTEIN_SUBSTRING(data, ?), "
"stamp DESC "
"LIMIT ? " "LIMIT ? "
"OFFSET ?;" "OFFSET ?;"
; ;
const char * const levenstein_caseless_query = const char * const levenstein_caseless_query =
"SELECT * FROM entries " "SELECT * FROM entries "
"ORDER BY DAMERAU_LEVENSHTEIN_SUBSTRING(LOWER(data), LOWER(?)) " "GROUP BY data "
"ORDER BY DAMERAU_LEVENSHTEIN_SUBSTRING(LOWER(data), LOWER(?)), "
"stamp DESC "
"LIMIT ? " "LIMIT ? "
"OFFSET ?;" "OFFSET ?;"
; ;