Passing a column into CONTAINSTABLE/CONTAINS

  • I am running a search, passing a column with keywords into inner joint.

    SELECT          SentimentCategoriesAncors._pk AncorID, Clip._pk ClipID
    FROM          SentimentCategoriesAncors INNER JOIN Clip ON Clip.title  LIKE '%' + SentimentCategoriesAncors.incude + '%'

    I need get some speed and put some fuzzy logic in play. So, I indexed Clip.title into Full-Text Search and trying to do something like this

    SELECT          SentimentCategoriesAncors._pk  AncorID, Clip._pk  ClipID
    FROM          SentimentCategoriesAncors, ClipWHERE  CONTAINS(title, SentimentCategoriesAncors.incude)

    … it does not take it and expects a hard string.  Did anybody was able to hack it or to encode the column name somehow. I do not want to go with dynamic SQL… Thanks.

  • Using LIKE %SomeVal% is always going to be slow as SQL has to do a table/index scan.

    However, I have gotten pretty good performance using Trigram searches

    https://sqlperformance.com/2017/09/sql-performance/sql-server-trigram-wildcard-search

     

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply