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!

Index Server and Google-Style Searches

Status
Not open for further replies.

Genimuse

Programmer
May 15, 2003
1,797
0
0
US
Has anyone written a parser in ASP that turns a Google-syntax into Index Server language, either Dialect 1 or Dialect 2?

Basically it would, for example, turn
Code:
"american dream" goats camels +hairy -bald
into something like (and I'm not too strong on the dialect yet)
Code:
@contents {phrase}american dream{/phrase}
@contents {freetext}goats camels{/freetext}
@contents {weight value = 1.0} hair
@contents !bald
Heck, I don't even know if those all belong on the same line or separate lines, or if that will even generate the right search... hence my hope that someone's already figured it out. :) Please feel free to tell me how I'm screwing it up.

I'm hoping to use Google-style searches since my users are familiar with them. Learning a new syntax isn't going to help them much, if I can help it.
 
Simple algorithm:

1. Locate all spaces (except the ones between "quotes")
2. Break up the string, using the locations from (1)
3. Check the firsy character of each piece.
4. Build your Index Server syntax, using (2) and (3)

 
Aye, it is simple, algorhithmically (I've written language parsers several times now, so that part's fairly trivial). It's translating it to Index Server Dialect 2 speak that I don't know how to do (don't know the dialect, not experimenting if I can help it). That, and I'm hoping to avoid the work. :)

Thanks for the suggestion!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top