Royi Namir
Royi Namir

Reputation: 148714

Why doesn't my Full text search yields results?

I have a simple View:

http://i.imgur.com/fb0OKx0.png

Let's select top 5 rows : (the view doesn't have top 5 - it's just for clarity here)

SELECT TOP 5 [CustomerId]
      ,[EngLastFirst]
      ,[EngFirstLast]
      ,[LocalLastFirst]
      ,[LocalFirstLast]
  FROM [WebERP].[dbo].[View_CustomersNames]

Result :

enter image description here

Let's create a Full Text Index (Right click on the view):

enter image description here

OK. so now we also have a catalog :

Right click on the catalog - to see properties :

enter image description here

All the properties are default :

enter image description here

Let's click rebuild on the catalog:

enter image description here

Great

Let's run a simple CONTAINS query :

SELECT * FROM View_CustomersNames vcn 
        where CONTAINS( vcn.*, '"aerSwy*"') 

As you see from earlier code - the record does exists :

enter image description here

But it returns no results

While like does return results:

SELECT * FROM View_CustomersNames vcn 
        where  vcn.engLAstFirst LIKE '%aerSwy%'   

enter image description here

Question:

Why I'm not getting result for this query ?

SELECT * FROM View_CustomersNames vcn 
        where CONTAINS( vcn.*, '"aerSwy*"')

NB - I might be missing something which is very basic (new to Full Text Search)

Edit

In production environment - it does work. in my local environment - it doesn't

enter image description here

Upvotes: 4

Views: 96

Answers (2)

Royi Namir
Royi Namir

Reputation: 148714

Found the problem — It was permissions

Here :

enter image description here

And now the CONTAINS works :

enter image description here

Upvotes: 3

Grant Wilson
Grant Wilson

Reputation: 23

You should remove TOP 5 from your view. I don't believe that will work in SQL. Order your results however you need to like Keith said. Here is a link to some basic SQL examples. http://www.w3schools.com/sql/sql_quickref.asp Try using some of these as a reference when reconstructing your statements. These should help guide you on manipulating your sql to do what you need it to. also, I don't think you need to put the name of the database after you reference the table name in your SQL statement.

Upvotes: -1

Related Questions