C# 我可以进行包含特殊字符的全文搜索吗?
我在c#应用程序中使用反讽进行全文搜索,效果很好。现在我需要的是搜索包含一些特殊字符的文本,如[,],;,,,,,,,,,,,,,,,,/,。当我使用上面的特殊字符进行搜索时,它显示的错误是“语法错误,应为:-&()短语StringLiteral Term | ~<而非or(解析器状态:S5)” 有没有办法进行包含特殊字符的全文搜索 这是我在调用过程中出错的代码:_compiler.Parse(_compilerContext,source)C# 我可以进行包含特殊字符的全文搜索吗?,c#,full-text-search,irony,C#,Full Text Search,Irony,我在c#应用程序中使用反讽进行全文搜索,效果很好。现在我需要的是搜索包含一些特殊字符的文本,如[,],;,,,,,,,,,,,,,,,,/,。当我使用上面的特殊字符进行搜索时,它显示的错误是“语法错误,应为:-&()短语StringLiteral Term | ~
您能向我们展示导致此错误的代码吗?此示例没有真正的帮助,语法和查询将更有帮助;)
private void ConvertQuery()
{
// Define Grammer
SearchGrammar _grammar = new SearchGrammar();
LanguageCompiler _compiler = new LanguageCompiler(_grammar);
CompilerContext _compilerContext = new CompilerContext(_compiler);
_compilerContext.Options |= CompilerOptions.MatchBraces | CompilerOptions.CollectTokens;
if (_compiler.Grammar.FlagIsSet(LanguageFlags.SupportsInterpreter))
{
_compilerContext.Options |= CompilerOptions.AnalyzeCode;
}
// Parse each token to construct the SQL command.
foreach (SearchToken token in tokens)
{
if (!token.IsDefined) continue;
SourceFile source = new SourceFile(token.RawText, "Source", 8);
AstNode root = _compiler.Parse(_compilerContext, source);
string parseError = CheckParseErrors(_compilerContext);
if (parseError != string.Empty)
{
token.ParseErrorMessage = parseError;
token.IsParseError = true;
}
else
{
token.SQLText = SearchGrammar.ConvertQuery(root, SearchGrammar.TermType.Exact, token);
}
}
}