在第1行无法对Lucene词法错误使用错误的转义字符,无法解析遇到的< EOF>.肯蒂科12 [英] Using the wrong escape character for Lucene lexical error at line 1 Cannot Parse Encountered <EOF>. Kentico 12

查看:253
本文介绍了在第1行无法对Lucene词法错误使用错误的转义字符,无法解析遇到的< EOF>.肯蒂科12的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个与以下问题类似的问题:,我已经尝试了所有转义.还有什么呢?

I have a similar issue as the following question: Lucene error while parsing Query: Cannot parse '': Encountered "" at line 1, column 0, and I had already tried all the escaping. What else could it be?

我正在使用Kentico 12修补程序14及其Lucene.NET 3.0.3实现.我的智能搜索索引使用标准分析器,如下所示:

I'm using Kentico 12 hotfix 14, with their Lucene.NET 3.0.3 implementation. My Smart Search Index uses the Standard analyzer, see below:

当我使用以下lucene语法拉回美国文化的结果时,我得到了预期的行.该语法由Kentico自动创建,并且需要它来检索正确的区域性.这是直接从属性值复制的.

I get the expected rows back when I use the following lucene syntax to pull back an en-US culture result. This syntax is automatically created by Kentico and is needed to retrieve the correct culture. This was directly copied from the property value.

"+_culture:([en-us TO en-us] [invariantifieldivaluei TO invariantifieldivaluei])"

当我添加(或单独使用)以下值时(多种形式-不带括号等):

When I add (or use alone) the following value (in many different forms - without parenthesis, etc):

 "+length:(24\")"

我总是会收到词法错误:

I always get the Lexical error:

"Cannot parse '+_culture:([en-us TO en-us] [invariantifieldivaluei TO invariantifieldivaluei])  +length:(24\")': Lexical error at line 1, column 95.  Encountered: <EOF> after : \"\\\")\""

如您所见,我相信我已经正确地忽略了长度值.我在这里想念什么?

As you can see, I believe that I have escaped the value for the length correctly. What am I missing here?

不需要转义工作的其他值就可以了,例如:

Other values, that don't require escaping work just fine, such as:

+material:(nitrile)

是否对我在使用24英寸值做错事情有任何想法?错误的分析器?需要Kentico修补程序?错误的过滤器顺序?感谢您的宝贵时间!

Any thoughts on what I'm doing wrong with the 24" value? Wrong analyzer? Needed Kentico hotfix? Wrong order of filters? Thanks for your time!

推荐答案

似乎我不是第一个在Kentico中处理此问题的人,并找到了以下帮助程序方法: CMS.Search.SearchSyntaxHelper.EscapeKeyWords(string ).我将此方法应用于特定的搜索过滤器值,并且按预期工作!父类中也有很多好的方法,请检查一下.

Seems I'm not the first to deal with this within Kentico, and found the following helper method: CMS.Search.SearchSyntaxHelper.EscapeKeyWords(string). I applied this method to my specific search filter values and it's working as expected! Lots of good methods within the parent class too, check them out.

这篇关于在第1行无法对Lucene词法错误使用错误的转义字符,无法解析遇到的&lt; EOF&gt;.肯蒂科12的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆