我面临与包含(&,#)之类的文本相关的搜索问题 当我搜索-> Filewith&DownloadSuccessfully.docx并选择debugquery时,我看到我的解析查询分为两部分,如下所示,因此它没有产生任何结果,并且我的应用程序给出了错误->
"rawquerystring":"Filewith&DownloadSuccessfully.docx",
"querystring":"Filewith&DownloadSuccessfully.docx",
"parsedquery":"content:filewith content:downloadsuccessfully.docx",
"parsedquery_toString":"content:filewith content:downloadsuccessfully.docx",
"QParser":"LuceneQParser"
错误->
using (HttpResponseMessage response = solrClient.Value.GetAsync(urlFormat).Result)
{
using (HttpContent content = response.Content)
{
downloadString = content.ReadAsStringAsync().Result;
}
}
//downloadString contains this error
"error":{
"metadata":[
"error-class","org.apache.solr.common.SolrException",
"root-error-class","org.apache.solr.parser.TokenMgrError"],
"msg":"org.apache.solr.search.SyntaxError: Cannot parse 'content:\"Filewith': Lexical error
at line 1, column 18. Encountered: <EOF> after : \"\\\"Filewith\"",
"code":400}}
我使用的是StandardTokenizer,我无法将其更改为WhiteSpaceTokenizer,因为我没有自由索引整个生产数据。因此,我只能修改C#客户端代码。
请提出建议?