views:

48

answers:

1

hi, i am developing a very basic prototype of web search engine and now i want to know what is the best way to analyze user raw query and detect what who want to search. like Google, Bing, Yahoo etc...

an example user raw query is something like this:

Google+Maps+"South+Africa"+Brazil+OR+Italy+OR+Spain+-Argentina+Netherlands

and i want to split this to a generic list of each term(single) like this:

IEnumerable<KeyValuePair<TermType, string>>
<TermType.All, "Google">
<TermType.All, "Maps">
<TermType.Exact, "South">
<TermType.Exact, "Africa">
<TermType.Any, "Brazil">
<TermType.Any, "Italy">
<TermType.Any, "Spain">
<TermType.None, "Argentina">
<TermType.None, "Netherland">

i don't want complete code, i want guidance, solution, tips or anything that's help me to write best for analyze user raw query.

thanks in advance

+1  A: 

Don't think in terms of the query string. Think first in terms of the logical search operations you wish to permit, and how your engine will satisfy them.

How each set of logical operations can be translated from one or more query strings then becomes an implementation detail.

John Saunders
it's translated like popular search engines. each of terms from left(or based on language can be from right side) starts and filters search results for each term(by TermType which detected for each).
Sadegh