Solved

How to get the SQL free text search using contains query to return with ranking

Posted on 2014-07-21
4
291 Views
Last Modified: 2014-08-04
I am doing a contains search on the columns on the database. I have already run separate queries to confirm text1, text2 and text3 are on the database. then I have the following query :

select * from Item I where contains(i.*,'text1') and contains(i.*,'text2') and contains(i.*,'text3')

how do I get the results with ranking from Sql server on the matches?
0
Comment
Question by:TrialUser
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 34

Accepted Solution

by:
Brian Crowe earned 500 total points
ID: 40209543
use CONTAINSTABLE

http://msdn.microsoft.com/en-us/library/ms189760.aspx

I have found FREETEXTTABLE more useful in my applications as it performs pluralization and thesaurus checks as well.
0
 

Author Comment

by:TrialUser
ID: 40209645
Thanks for your help.
1) So containstable will not do pluralization and thesaurus check?
2) is containstable just the same as the contains query but with a ranking of the results?
0
 
LVL 34

Expert Comment

by:Brian Crowe
ID: 40209794
Yes to both,  With some tweaking the contains and containstable can do some intricate searching but for things like product and FAQ searches where I have applied it, I have found freetext/freetexttable a better fit.
0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 40218471
how do I get the results with ranking from Sql server on the matches?
For obvious reasons, you cannot use CONTAINS.  You have to use CONTAINSTABLE instead.
0

Featured Post

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
What if you have to shut down the entire Citrix infrastructure for hardware maintenance, software upgrades or "the unknown"? I developed this plan for "the unknown" and hope that it helps you as well. This article explains how to properly shut down …
Using examples as well as descriptions, and references to Books Online, show the documentation available for datatypes, explain the available data types and show how data can be passed into and out of variables.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

626 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question