Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8035501
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T02:19:56+00:00 2026-06-05T02:19:56+00:00

I am trying to determine all the possible words that are next to a

  • 0

I am trying to determine all the possible words that are next to a word in a column that has a full text index on it.

I am using sys.dm_fts_index_keywords to get all the possible keywords ignoring all the words in the stoplist.

An example of what I’m trying to figure out:
If I have the string: “I like the cafe at my office” and I am looking at the word “cafe” I would like to know the words next to it are.

It doesn’t matter if I include stop list words or not when I’m doing the next to search. I just thought it would be easier to leverage the full text index that is already in place.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T02:19:58+00:00Added an answer on June 5, 2026 at 2:19 am

    You can use the FT index to find the match, but then youll have to parse the phrase and find the adjacent words. Unfortunately, FTS doesnt give you the position of the match afaik, else this might be easier.

    Here is an example setup:

    declare @find varchar(100) = 'cafe';
    
    declare @phrase varchar(100) = 'I like the cafe at my office';
    
    ;with 
    x(x)
    as (    select cast('<w>'+replace(@phrase, ' ', '</w><w>')+'</w>' as xml)
        ),
    words(pos, word)    
    as  (   select  dense_rank() over (order by n),
                    p.n.value('.', 'varchar(100)')
            from x
            cross
            apply x.nodes('/w')p(n) 
        )
    select  d.* 
    from    words w
    cross
    apply   (   select  * 
                from    words 
                where   pos in (w.pos-1, w.pos+1)
            )d(pos, word)
    where   w.word=@find
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Trying to determine if it is possible to bind the SelectedValue of a ComboBox
I am trying to determine if a phone is located in this polygon using
I'm trying to determine the iPhone user's location using a CLLocationManager and CLGeocoder. My
I'm trying to determine how to count the matching rows on a table using
I am trying to determine how I want to tackle this... this is all
Is it possible to determine all the possible execution paths by reading the bytecode
I am trying to determine if it is possible to setup an interceptor like
I am trying to determine the city in USA the user is in using
Possible Duplicate: Determine Whether Two Date Ranges Overlap I am trying to work out
I am trying to determine if it is possible to use Generics in the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.