SOLR 使用 CONCAT 函数查询丢失字段中的一些单词 - 如何使其处理所有单词?



>我有一个SOLR文档:

{
"id": "Test1",
"MyInt": 100500,
"FirstString": ["Test First String"],
"SecondString": ["Test Second String"]
}

此核心的托管架构为:

...
<field name="MyInt" type="plong" /> 
<field name="FirstString" type="text_general" /> 
<field name="SecondString" type="text_general" /> 
...

键入"text_general" - 这是为了正确搜索。

我需要在/select 中获取两个文本字段的连接。 我创建这样的请求:

http://localhost:8983/solr/testcore/select?q=*:*&fl=Result:concat(FirstString,';',SecondString)

期望在结果中看到一些强烈的texthing,例如:

Result:"Test First String;Test Second String"

但实际上,SOLR 删除了部分单词,每个字段中只留下 1 个单词。也许要寻找的最重要的事情:

Result:"First;Second"

不要让我在/select 中将 wt=json 更改为 wt=csv,我知道这个功能,但在这种情况下它不适合。

请告知SALS这种奇怪行为的原因是什么?

也许这是因为数据存储在 type="text_general" 字段中,multiValued=true ?我用type="string"字段做了一个实验 - 问题重复。

我不明白如何让 SOLR 从 concat 函数查询中的text_general字段中获取所有单词?

您认为这是因为使用了text_general字段类型的假设是正确的;当您使用concat时,只会从该字段中返回第一个标记。但是,您说它在使用string字段时也不起作用 - 这是错误的。当使用string字段类型(即不发生处理并且文本逐字存储为单个标记(时,行为与您请求的那样:

{
"responseHeader":{
"zkConnected":true,
"status":0,
"QTime":4,
"params":{
"q":"*:*",
"fl":"FirstField_string, LastField_string, Result:concat(FirstField_string,';',LastField_string)",
"_":"1581267948122"}},
"response":{"numFound":1,"start":0,"docs":[
{
"FirstField_string":"Test First String",
"LastField_string":"Test Second String",
"Result":"Test First String;Test Second String"}]
}}

字段名称更改只是因为我尝试了您的原始字段名称。这要求字段multiValued="false"

相关内容

最新更新