Solved

Help in SQL Full Text Search

Posted on 2016-10-27
3
41 Views
Last Modified: 2016-10-27
Hi guys,

I need to search the address table and have implemented full text search in it. However there is one thing happening. When the building number is a single digit the search doesn't return anything

Doesn't return reslut
DECLARE  @GlobalStringFraction NVARCHAR(100)
SET @GlobalStringFraction ='9 l10 0aj'

 SET @GlobalStringFraction = REPLACE(@GlobalStringFraction, N',',
                                                N'');
PRINT @GlobalStringFraction
            SET @GlobalStringFraction = REPLACE(@GlobalStringFraction, N'WAY',
                                                N'');

PRINT @GlobalStringFraction
            SET @GlobalStringFraction = REPLACE(REPLACE(REPLACE(@GlobalStringFraction,
                                                              N' ', N'<>'),
                                                        N'><', N''), N'<>',
                                                N' ');
PRINT @GlobalStringFraction
            SET @GlobalStringFraction = N'"' + REPLACE(@GlobalStringFraction,
                                                       N' ', N'" AND "')
                + N'"';
PRINT @GlobalStringFraction
DECLARE @str varchar(5000) 
Set @str= (SELECT TOP(1000) Count(*)
            FROM    AddressSearchString AS t
                    INNER JOIN CONTAINSTABLE([dbo].AddressSearchString, *, @GlobalStringFraction)
                    AS k ON t.Id = k.[KEY]); 
					
	PRINT @str 
	PRINT @GlobalStringFraction

Open in new window



But when i replace 9 with with 10 or higher the search returns the result

Returns the Result
DECLARE  @GlobalStringFraction NVARCHAR(100)
SET @GlobalStringFraction ='10 l10 0aj'

 SET @GlobalStringFraction = REPLACE(@GlobalStringFraction, N',',
                                                N'');
PRINT @GlobalStringFraction
            SET @GlobalStringFraction = REPLACE(@GlobalStringFraction, N'WAY',
                                                N'');

PRINT @GlobalStringFraction
            SET @GlobalStringFraction = REPLACE(REPLACE(REPLACE(@GlobalStringFraction,
                                                              N' ', N'<>'),
                                                        N'><', N''), N'<>',
                                                N' ');
PRINT @GlobalStringFraction
            SET @GlobalStringFraction = N'"' + REPLACE(@GlobalStringFraction,
                                                       N' ', N'" AND "')
                + N'"';
PRINT @GlobalStringFraction
DECLARE @str varchar(5000) 
Set @str= (SELECT TOP(1000) Count(*)
            FROM    AddressSearchString AS t
                    INNER JOIN CONTAINSTABLE([dbo].AddressSearchString, *, @GlobalStringFraction)
                    AS k ON t.Id = k.[KEY]); 
					
	PRINT @str 
	PRINT @GlobalStringFraction

Open in new window


It seems that it is taking 0-9 as noise words. But if i disable stoplist my search goes considerably slow on front end

I have attached some sample data herewith

regards
Ali
Data.xlsx
0
Comment
Question by:shah36
  • 2
3 Comments
 
LVL 69

Accepted Solution

by:
Scott Pletcher earned 500 total points
ID: 41862568
You can adjust the noise word to remove 0 thru 9 but not to include everything else.  That is, you can create a custom noise list.
0
 

Author Comment

by:shah36
ID: 41862574
Thanks! is a custom noise list inherited by system noise list? I mean if i just eliminate some words from custom stop list will other noise words still be there?
0
 

Author Closing Comment

by:shah36
ID: 41862604
Thank you very much for giving me this idea. I have used custom stop list and created it from system stop list. have removed 0-9 words and it doesn't slow down as well.

thanks again
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
sqlquerystress - To test db performance 8 41
SqlDataBase 7 46
MS SQL with ODBC 5 35
Simple SQL query from two tables 13 52
In this article I will describe the Detach & Attach method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

785 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