Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Site search on any word match

Status
Not open for further replies.

nawrioj

Programmer
Feb 14, 2005
22
US
Does anyone has a suggestion on how to do site search on any word match. So If we provide a keyword "new black shoes", the site search will query the database for keyword "new", "black", and "shoes".

I need to bear in mind that I don't want any Duplication.

Anybody has an idea of how to approach this ?

thanks,
nawrioj
 
1) Write/search for a function that will take the list of keywords and return a table with one word per row.

2) Query your data against this result:

Code:
SELECT DISTINCT id, field_to_search
FROM mytable t1 JOIN dbo.fnSplitString('new black shoes') t2 ON t1.field_to_search LIKE '%' + t2.word + '%'

--James
 
I'm not that experience using stored procedure though I'm using it right now for the project. Do you treat stored procedure like we're using vbscript ? Can we use split function for the stored procedure ?

Thanks
 
No but ESquared has developed a split function.
Passing a list of values to a Stored Procedure (Part II) faq183-5207
-Karl

[red] Cursors, triggers, user-defined functions and dynamic SQL are an axis of evil![/red]
[green]Life's uncertain...eat dessert first...www.deerfieldbakery.com[/green]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top