Reputation: 5202
How to get results from SQL table.
In my application I used fulltext search.
I want to get:
for example If user enter word like "Great Events". Then result should be comes as below sequence.
The first results should be all updates with the entire search term "Great Events".
Only after you show these results, then display updates with term "Great Events", "Greater Events" etc.
Basically words that contain the terms "Great Events".
Then show results from updates that have both words "Great" and "Events", and its variations.
Finally, show results from updates that have one of the two words...
My table likes:
Columns
UserUpdates
How to do using SQL script.. ?
Upvotes: 0
Views: 2505
Reputation: 693
You could create a fulltext catalog and add a fulltext index on your table to solve this.
Do do this , you might create a simple parser in c# to take the search terms and create a search keyword; turning the search for "great events" to something like :
'"great events" OR (Great AND Events)'
You can than create a query like this, based on that search keyword:
SELECT * FROM CONTAINSTABLE ([YourFullTextIndexTable], *, '"great events" OR (Great AND Events)' , 2057,0) ORDER BY RANK DESC
The above is for british english (2057) and the default stoplist (0).
This would return records with "Great Events" as a phrase first followed by records with Great and Events in there somewhere.
Upvotes: 1