Misc
Misc

Reputation: 11

SQLite Full-Text Search with PDO

I created the sqlite-FTS4 table with multiple columns such as:

CREATE VIRTUAL TABLE [selection_fts] USING fts4 (tender_id, tender_orderName_clean, tender_fm, branch, lot_name_clean);

and I try to execute code like

$q = $db->query("SELECT * FROM selection_fts WHERE selection_fts MATCH (\"(tender_orderName_clean:двер* OR lot_name_clean:двер*) AND tender_fm:Министерство Иностранных Дел AND branch:на строительство\") limit 0,250");
$rows = $q->fetchAll(PDO::FETCH_ASSOC);
var_dump($rows);
die();

The code above returns 0 rows, but in my SQlite manager I see some results. Do you please explain my mistake?

Upvotes: 1

Views: 566

Answers (1)

Erno Voutilainen
Erno Voutilainen

Reputation: 11

Although this is an old question, I just ran into the same issue and found out that (atleast in my case) the exact MATCH to the database entry didn't return any results. When I took irrelevant parts out of the MATCH string, I got results back.

Might be a bug in the SQLite driver, maybe...

Upvotes: 1

Related Questions