Full Text Search and LIKE statement

前端 未结 1 1023
慢半拍i
慢半拍i 2021-01-15 04:45

Does the GAE experimental Full Text Search API provide an alternative to the SQL \"LIKE statement\"?

Thanks!

相关标签:
1条回答
  • 2021-01-15 05:26

    No. The SQL like statement supports arbitrary substring matching - for instance, "abbatton" will be a match for "bat" - while fulltext search implements full text indexing, which uses normalization, stemming, and an inverted index to construct an index that is good at answering the sort of queries users tend to enter for textual documents.

    If you mean "does the Full Text search API provide an alternative for what SQL's LIKE operator is commonly (mis)used for", the answer is yes - since the most common application for SQL's LIKE appears to be fulltext search, the Full Text Search API is actually better suited to this than LIKE for a number of reasons, including efficiency ('LIKE' requires scanning every row of the table), accuracy (Full Text search provides ranking, stemming, and other features), and eliminating false positives (see the example above).

    0 讨论(0)
提交回复
热议问题