Home > database >  Sqlite query problem
Sqlite query problem

Time:11-01

Sqlite3 string matching in the problem of field data:
Existing string title (10 to 20 words), a keyword table, table 1 field in a table keyword (for each keyword is composed of one or more words, 2 w and 6 w keywords)
For example:
Title: Huawei P40 pro
Keywords list: keyword
'huawei'
'huawei p40'
'huawei pro'
'p40 pro'
'p40 +'
Want to accomplish as a result, the query title keywords and keywords contained in the data does not exist in other words, the results should be all data, other than the 'p40 + my current approach is to split the title, fuzzy query keywords contained in the title word data first, then the replace is empty, finally selected keyword is empty data
Select * from table1 the where (keywrod like '% huawei %' or keywrod like '% % P40 orkeywrod like' % pro %) and replace (replace (replace (keywrod, 'huawei', '), 'P40', '), 'pro', ')=",
This approach can be implemented, but if the long title will replace many, sqlite will overflow, do you have any good ideas and methods, education
  • Related