4Manuals

  • PDF Cloud HOME

编写索引时 Download


我正在使用Lucene 8.3,并遇到StandardAnalyzer的意外行为。为了找出问题,我设法与Luke产生相同的行为。这是路加福音的描述:

我正在使用StandardAnalyzer创建一个新文档。一个字段:name = myField; type = StringField; options =储值; value ='Foo'

然后切换到搜索:解析术语“ myField:Foo”表明它已转换为小写字母。这是StandardAnalyzer的预期行为。但是,搜索将得出零结果。切换到WhitespaceAnalyzer将解析相同的术语保留大小写。搜索将提供我刚刚输入的一份新文档。

在我看来,在文档创建/索引编写过程中,StandardAnalyzer不会将文本转换为小写。我的Java代码中也有同样的情况。

我想念什么?我还需要观察其他设置吗?

1 个答案:

答案 0 :(得分:0)

string input = @"INSERT [dbo].[Table] ([Key], [Name], [Value], [Module]) VALUES (1, N'Product', N'Value 1', N'Value 2')"; Regex regex = new Regex("N'([^']+)'"); MatchCollection matches = regex.Matches(input); //Loop though matches backwards so the index values don't get misaligned for (int i = matches.Count - 1; i >= 0; i--) { //Get the capture group info for the content between the single quotes Group captureGroup = matches[i].Groups[1]; //Replace the contents of the input string with some updated value input = input.Substring(0, captureGroup.Index) + SomeStringMethod(captureGroup.Value) + input.Substring(captureGroup.Index + captureGroup.Length); } Console.WriteLine(input); 未分析。使用StringField。

常用字段类型在此处记录:http://lucene.apache.org/core/8_3_0/core/org/apache/lucene/document/Field.html



Similar searches
    为什么我的动画从Blender到UE4出错了? Samsung RF26V Refrigerator User Manual 优化错误:箱约束优化(Julia Optim.jl) Samsung DA68-01890Q Refrigerator User Manual 使用Promisses为命名视图动态导入VueRouter