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 Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

generating SQL query from Search engine style input string??

Status
Not open for further replies.

mayB2morrow

Programmer
Joined
Sep 3, 2004
Messages
10
Location
GB
Hi there,

I am currently working on a project which involves the implementation of some database seraching based on user input.

I need to mimic the functionality of a search engine search box in my search - i.e. parse characters such as "", +, - , or etc. to create advanced search criteria.

I need some code which would convert this user input into SQL search criteria.

e.g if someone were to type into my search box....

"experts exchange" or Phil Marsay -unix

would translate to something like...

field like '%experts exchange%' or (field like '%Phil%' and field like '%marsay%') and field not like '%unix%'

You get the idea, I am sure this must have been done somewhere before. I'm not really interested in ranking results or anything like that - the search results will just match everything in the criteria or not show up.

Any help, pointers to info, or code snippets most greatfully accepted! Preferably c# as that is what I am working on, but if there are any examples in other languages, I will gladly take a look at those too!

Thanks in advance,

Phil Marsay
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top