Quantcast
Channel: SQLServerCentral » SQL Server 2014 » Development - SQL Server 2014 » Latest topics
Viewing all articles
Browse latest Browse all 3145

Text search without FULLTEXT....

$
0
0
Hi,I'm trying to implement a text search in a table's data...What I did was create a table (idRecord, word) with all the words of a record.I also have a function that brakes a string into to search words...With the following code I do a search:[code="SQL"]DECLARE @wordsToLookUp TABLE(item VARCHAR(255))DECLARE @wordCount INTINSERT INTO @wordsToLookUp (item) SELECT item FROM dbo.Iterativewordchop('med imov', 0)SELECT @WordCount = COUNT(1) FROM @wordsToLookUpSELECT @wordCountSELECT e.[id] FROM entities e WHERE EXISTS (SELECT 1 FROM entitiesFullText CW INNER JOIN @wordsToLookUp WLU ON CW.word LIKE '%' + WLU.item + '%' WHERE e.[id] = CW.[id] GROUP BY [id] HAVING COUNT(1) >= @wordCount)[/code]Apparently this works fine.... But there's a catch... If I search for 'med imov' and a record has meda and medb and not imov the record is returned....Is there an "easy" and fast way to search each word in @wordsToLookUp individually?Thanks,Pedro

Viewing all articles
Browse latest Browse all 3145

Trending Articles