vasagam
vasagam

Reputation: 87

asp.net boolean search string function

Any of you know how to do boolean search engine in asp.net c# application, i have to search the given string (search the string using boolean logic AND,OR,NOT) in my asp.net application(only aspx and html files)...

please help me...

Upvotes: 1

Views: 2460

Answers (2)

DavRob60
DavRob60

Reputation: 3557

In the find and replace window :CTRL + SHIFT + F

  • check "use" and select "regular expression"

This triangular button next to the Find what field becomes available when the Use check box is selected in Find options. Click this button to display a list of wildcards or regular expressions, depending upon the Use option selected. Choosing any item from this list adds it into the Find what string. - MSDN

So you will have to build your "boolean logic search" using Regular expression (And now you have 2 problems)

Also set the Look at these files types: to *.html;*.aspx; and Look in Entire Solution

enter image description here

Upvotes: 0

Heinzi
Heinzi

Reputation: 172468

Basically, you need to parse the input (split the string, then iterate through the words) and construct a tree. Since the operators (AND, OR, ...) are between the keywords, you need an infix parser.

You can either write one yourself (the keyword "infix parser" should return enough Google results to get you started -- note that this is not a trivial task if you don't have at least some computer science background) or use a tool such as ANTLR, which is supposed to make writing parsers easy.

Here's a related question; I'm not sure if the answer is applicable to your case, though:

Upvotes: 1

Related Questions