]> git.ktnx.net Git - mobile-ledger.git/blobdiff - app/src/main/java/net/ktnx/mobileledger/dao/TransactionDAO.java
lookup transactions by description directly in transactions table
[mobile-ledger.git] / app / src / main / java / net / ktnx / mobileledger / dao / TransactionDAO.java
index 8e0156b77cf1993e29abbedabe2c9f79e14a1c94..869e88c2d28e0217d534a040cc6a7adebe963cb0 100644 (file)
@@ -79,12 +79,11 @@ public abstract class TransactionDAO extends BaseDAO<Transaction> {
     @Query("SELECT * FROM transactions WHERE id = :transactionId")
     public abstract TransactionWithAccounts getByIdWithAccountsSync(long transactionId);
 
-    @Query("SELECT DISTINCT description, CASE WHEN description_upper LIKE :term||'%%' THEN 1 " +
-           "               WHEN description_upper LIKE '%%:'||:term||'%%' THEN 2 " +
-           "               WHEN description_upper LIKE '%% '||:term||'%%' THEN 3 " +
-           "               ELSE 9 END AS ordering " + "FROM description_history " +
-           "WHERE description_upper LIKE '%%'||:term||'%%' " +
-           "ORDER BY ordering, description_upper, rowid ")
+    @Query("SELECT DISTINCT description, CASE WHEN description LIKE :term||'%%' THEN 1 " +
+           "               WHEN description LIKE '%%:'||:term||'%%' THEN 2 " +
+           "               WHEN description LIKE '%% '||:term||'%%' THEN 3 " +
+           "               ELSE 9 END AS ordering FROM transactions " +
+           "WHERE description LIKE '%%'||:term||'%%' " + "ORDER BY ordering, description, rowid ")
     public abstract List<DescriptionContainer> lookupDescriptionSync(@NonNull String term);
 
     @androidx.room.Transaction