This project has moved and is read-only. For the latest updates, please go here.

SearchGrammar issue

Mar 11, 2012 at 1:39 PM

Hi Roman,

Thanks for the Irony project. I use SearchGrammar from the example to convert Google-like search string into full-text SQL query.

It works pretty good except one simple case - when search string starts from the keyword which should be excluded from result (like "-keyword") - then parsing fails with "Syntax error, expected: Term, ~, +, Phrase" exception.

If search string looks like "keyword1 -keyword2" - parsing completed correctly.

Can you advice how to fix it? Do I need to make some changes in SearchGrammar description or implement some additional handling?

Thanks in advance,


Mar 11, 2012 at 4:28 PM

this is known "issue" and in fact done deliberately - SQL server FTS syntax does not allow expression start with NOT.

Mar 11, 2012 at 6:04 PM
Edited Mar 11, 2012 at 6:04 PM

Is there any known workaround for the "issue"? If FTS does not allow expressions starting with NOT then it should be somehow possible to rearrange subexpressions so that the whole expression does not start from NOT. Or maybe it's possible to add a kind of stub as the first subexpression?

Please advice.

Mar 11, 2012 at 6:26 PM

you'd better ask Mike about this, on the forum for the article - I see you already asked the question. Also check his book about FTS, he may have more explanations there

Mar 11, 2012 at 6:45 PM

Ok. Thanks for the explanation.