I have searches like:
George AND NOT Washington OR Abraham
Dog OR cat AND NOT A WOLF
for these searches, I would like to get results for George or Abraham, but not in Washington, etc.
Basically I want to take a string and provide a contextual search in a full-text search for directory stored procedures.
I assume I should use Regex, but I am very new to Regex in C #.
I found this article: http://support.microsoft.com/kb/246800 , which I think I need to do, but I was hoping that I could have some help with the implementation.
Assuming you take the string as a parameter and want to return the string:
string input = 'George Washington AND NOT Martha OR Dog';
private string interpretSearchQuery(input)
{
// HALP!
/* replace ' AND ' | ' AND NOT ' with
* " AND "
* " AND NOT "
*
* replace ' OR ' | ' OR NOT ' with
* " OR "
* " OR NOT "
*
* add " to beginning of string and " to end of string
*/
return '"George Washington" AND NOT "Martha" OR "Dog"';
}