fts4

Exact phrase first before anything else in SQLite FTS?

邮差的信 提交于 2019-12-06 11:07:24
问题 Suppose the search input is 'what is'. This will match 'whatever it is' and also 'what is' which is the exact phrase. Now, how do I make the exact phrase first in the sorting? I've been thinking about this since yesterday and I keep on coming up with different solutions but each has somehow its own flaw. Here are my failed approach though (supposing input = 'what is'): SELECT snippet(fts), 1 as rank FROM fts WHERE body MATCH '"what is"' UNION ALL SELECT snippet(fts), 2 as rank FROM fts WHERE

External content in FTS4 SQLITE

此生再无相见时 提交于 2019-12-06 00:40:53
I have a VIEW view_for_search_unit and a FTS4 table FTS_table_search_unit . I inserted data from view_for_search_unit into the FTS table using this command: INSERT INTO FTS_table_search_unit(docId, name, description) SELECT id, name, description FROM view_for_search_unit After I check data in FTS table using this: SELECT *FROM FTS_table_search_unit it has 1000 perfect records(I use fake data). However, when I use the MATCH function in FTS: SELECT * FROM FTS_table_search_unit WHERE FTS_table_search_unit MATCH 's*' I retrieve 1000 records but all columns in the result are NULL . What is the

Searching in multiple columns using Full Text Search(FTS) with multiple tokens using OR operator

孤街浪徒 提交于 2019-12-05 22:32:19
问题 I am using FTS for querying my database for increasing the search speed as I need to search in text description also, When I am trying to query using single column its working fine like below select * from productsearch where productsearch match ('prod_name:panasonic*tw*') And also, select * from productsearch where productsearch match ('prod_short_desc:samsung*s5*') So, above both queries give me expected result but when I try to combine both queries using OR operator its not giving me any

System.Data.Sqlite and FTS4

孤街浪徒 提交于 2019-12-05 05:18:17
问题 Why when i write a query with fulltext Search syntax like: SELECT * FROM TABLENAME WHERE TABLENAME MATCH 'ColumnA:word1 OR ColumnB:word2' The query result always return 0 rows? I'm using VBnet and the latest Ado.net provider from sqlite.org The problem is when i try the query with and external tool, it works well (with sqlite 3.7.9). Any clues? Thanks in advance 回答1: Although System.Data.Sqlite is compiled using SQLITE_ENABLE_FTS3 and supports FTS, it doesn't compiled with SQLITE_ENABLE_FTS3

Exact phrase first before anything else in SQLite FTS?

浪子不回头ぞ 提交于 2019-12-04 16:03:57
Suppose the search input is 'what is'. This will match 'whatever it is' and also 'what is' which is the exact phrase. Now, how do I make the exact phrase first in the sorting? I've been thinking about this since yesterday and I keep on coming up with different solutions but each has somehow its own flaw. Here are my failed approach though (supposing input = 'what is'): SELECT snippet(fts), 1 as rank FROM fts WHERE body MATCH '"what is"' UNION ALL SELECT snippet(fts), 2 as rank FROM fts WHERE body MATCH 'what* NEAR/3 is*' -- 3 is arbitrary ORDER BY rank The problem on this one is that the two

SQLite FTS4 search with special characters

孤人 提交于 2019-12-04 07:12:26
I have an Android app which searches for data in an SQLite database with FTS4 virtual tables. It works fine, but when the data inside the tables contain special characters (like 'á', 'é', 'í', 'ó', 'ú' or 'ñ') the SQLite MATCH function gives no results. I'm lost at this point. Thanks. Attention: default tokenizer is really poor. To get good results you should implement a custom tokenizer. The path isn't so simple: find the tokenizer (with stemmer?) that should fit your need, or develop it glue it with sqlite.c sources glue a JNI interface to wrap the native library so it will be accessible

Searching in multiple columns using Full Text Search(FTS) with multiple tokens using OR operator

放肆的年华 提交于 2019-12-04 03:35:12
I am using FTS for querying my database for increasing the search speed as I need to search in text description also, When I am trying to query using single column its working fine like below select * from productsearch where productsearch match ('prod_name:panasonic*tw*') And also, select * from productsearch where productsearch match ('prod_short_desc:samsung*s5*') So, above both queries give me expected result but when I try to combine both queries using OR operator its not giving me any result select * from productsearch where productsearch match ('prod_name:panasonic*tw* OR prod_short

How to query an external content FTS4 table but return additional columns from the original content table

ε祈祈猫儿з 提交于 2019-12-01 07:34:15
I am creating an FTS4 external content table in SQLite like this: CREATE TABLE t2(id INTEGER PRIMARY KEY, col_a, col_b, col_text); CREATE VIRTUAL TABLE fts_table USING fts4(content="t2", col_text); I'm using an external content table so that I don't need to store duplicate values of col_text in fts_table . I'm only indexing col_text because col_a and col_b don't need to be indexed. However, when I do a query of fts_table like this SELECT * FROM fts_table WHERE fts_table MATCH 'something'; I don't have access to col_a and col_b from the content table t2 . How do return all these columns ( col_a