vendredi 31 juillet 2015

FTS4 sqlite MATCH not working

i tried several methods from here:

SQLite FTS example doesn't work

and here -> Full text search example in Android (best tutorial so far i think)

but my search return just 0 results!

what i've tried:

   String key = "a";
        Cursor c = db.query(true, "texts_virtual",
                new String[]{"id","title_normalized"},
                "title_normalized MATCH '"+key+"'",
                null, null, null, null, null);

= 0 Results;

 String query = "a";
    String[] params = {"%" +query+ "%"};

    Cursor c = db.rawQuery("SELECT * FROM texts_virtual WHERE title_normalized MATCH ?", params);

= 0 Results too

i know that the virtual table is correctly working because i can do this:

String queryText = "a"; //here i test other texts and they worked too
        String query = "select * from texts_virtual where title_normalized like ? order by number";
        String[] params = {"%" + queryText + "%"};
        Cursor c = db.rawQuery(query, params);

so this prove that the texts_virtual is working, what is not working are the queries, but i dont know why, not error, nothing, just 0 results

and after i make it work, im planning to use multiple terms search in 2 columns

user type "WordA WordB WordC"

it search for each word in the 2columns and return the results, but this if for a future task....

Aucun commentaire:

Enregistrer un commentaire