SQL Server 2008 Full Text Search Questions

I have some questions about the built-in full-text SQL 2K8 search.

Let's say I have the following tables:

  • Car with columns: id (int-pk), makeid (fk), description (nvarchar), year (int), functions (int-bitwise value - only 32 functions)
  • CarMake with columns: id (int-pk), mfgname (nvarchar)
  • CarFeatures with columns: id (int - 1, 2, 4, 8, etc.), featurename (nvarchar)

If someone is looking for "red honda civic 2002 4 door", how would I parse the input string so that I can also look in the tables "CarMake" and "CarFeatures"?

+3
source share
1 answer

, . , . :

Create View dbo.CarData
WITH SCHEMABINDING
As

Select dbo.Cars.Id
    , dbo.CarMake.Manufactuer
        + ' ' + dbo.Cars.[Year]
        + Coalesce(' ' + dbo.Cars.Description,'')
        + ' ' + Case When Features & 1 <> 0 Then (Select Name From dbo.CarFeature Where Id = 1) Else '' End
        + ' ' + Case When Features & 2 <> 0 Then (Select Name From dbo.CarFeature Where Id = 2)  Else '' End
        + ' ' + Case When Features & 4 <> 0 Then (Select Name From dbo.CarFeature Where Id = 4)  Else '' End
        + ' ' + Case When Features & 8 <> 0 Then (Select Name From dbo.CarFeature Where Id = 8)  Else '' End
        + ' ' + Case When Features & 16 <> 0 Then (Select Name From dbo.CarFeature Where Id = 16)  Else '' End As Description
From dbo.Cars
    Join dbo.CarMake
        On CarMake.Id = Cars.MakeId

:

Select ...
From CarData
Where Contains(Description, Replace('red honda civic 2002 4 doors', ' ', ' AND '))

. , "... 4 " 2004 2- 4WD . , , , .

, , Google . , , make .. , .

Btw, , , , , , . Feature to Car .

+2

Source: https://habr.com/ru/post/1737965/


All Articles