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 63009
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T18:33:55+00:00 2026-05-10T18:33:55+00:00

In my full text search query, I want to assign particular columns a higher

  • 0

In my full text search query, I want to assign particular columns a higher weightage. Consider this query:

SELECT Key_Table.RANK, FT_Table.* FROM Restaurants AS FT_Table INNER JOIN FREETEXTTABLE(Restaurants, *, 'chilly chicken') AS Key_Table ON FT_Table.RestaurantID = Key_Table.[KEY] ORDER BY Key_Table.RANK DESC 

Now, I want the Name column to have a higher weightage in the results (Name, Keywords and Location are full-text indexed). Currently, if the result is found in any of the three columns, the ranks are not affected.

For example, I’d like a row with Name ‘Chilly Chicken’ to have higher rank than one with Keywords ‘Chilly Chicken’, but another name.

Edit:

I’m not eager to use ContainsTable, because that would mean separating the phrases (Chilly AND Chicken, etc.), which would involve me having to search all possible combinations – Chilly AND Chicken, Chilly OR Chicken, etc. I would like the FTS engine to automatically figure out which results match best, and I think FREETEXT does a fine job this way.

Apologies if I’ve misunderstood how CONTAINS/CONTAINSTABLE works.

  • 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. 2026-05-10T18:33:56+00:00Added an answer on May 10, 2026 at 6:33 pm

    The best solution is to use ContainsTable. Use a union to create a query that searches all 3 columns and adds an integer used to indicate which column was searched. Sort the results by that integer and then rank desc.

    The rank is internal to sql server and not something you can adjust.

    You could also manipulate the returned rank by dividing the rank by the integer (Name would be divided by 1, Keyword and Location by 2 or higher). That would cause the appearance of different rankings.

    Here’s some example sql
    : –Recommend using start change tracking and start background updateindex (see books online)

         SELECT 1 AS ColumnLocation, Key_Table.Rank, FT_Table.* FROM Restaurants AS FT_Table  INNER JOIN ContainsTable(Restaurant, Name, 'chilly chicken') AS Key_Table ON  FT_Table.RestaurantId = Key_Table.[Key]  UNION SELECT 2 AS ColumnLocation, Key_Table.Rank, FT_Table.* FROM Restaurants AS FT_Table  INNER JOIN ContainsTable(Restaurant, Keywords, 'chilly chicken') AS Key_Table ON  FT_Table.RestaurantId = Key_Table.[Key]  UNION SELECT 3 AS ColumnLocation, Key_Table.Rank, FT_Table.* FROM Restaurants AS FT_Table  INNER JOIN ContainsTable(Restaurant, Location, 'chilly chicken') AS Key_Table ON  FT_Table.RestaurantId = Key_Table.[Key]  ORDER BY ColumnLocation, Rank DESC 

    In a production environment, I would insert the output of the query into a table variable to perform any additional manipulation before returning the results (may not be necessary in this case). Also, avoid using *, just list the columns you really need.

    Edit: You’re right about using ContainsTable, you would have to modify the keywords to be ”chilly*’ AND ‘chicken*”, I do this using a process that tokenizes an input phrase. If you don’t want to do that, just replace every instance of ContainsTable above with FreeTextTable, the query will still work the same.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i want to write a query with Full-Text-Search on a column with varbinary(max) type
I have used full text search mysql. My code is select * from uh_property
In MS SQL Full-text search, I'm using ISABOUT in my queries. For example, this
I have implemented Full Text Search on one of Sql Server 2008 Table. Query
I want to create a full text search using MsSql 2005. Here is the
Okay, so I'm trying to make a full text search in multiple columns, something
Have a question about full text search. I have a query that works, but
We want to use SQL SERVER 2008 Full Text Search and seem to run
I want to use the Hibernate Search full text search capabilities. I have a
I'm trying to add a full text search to a system. The query I

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.