知识点
相关文章
更多最近更新
更多solr返回的字段带有中括号问题
2019-03-27 00:49|来源: 网路
在solr返回的结果集的content字段返回格式为: "content": ["测试content" ],
经过对比title 和content字段,发现content配置多了一个mutiple属性:
<field name="title" type="text_ik" indexed="true" stored="true"/>
<field name="content" type="text_ik" indexed="true" stored="true" multiValued="true"/>
去掉:content 的multiValued="true"属性,得到想要的结果:
转自:http://www.cnblogs.com/a198720/p/3890119
相关问答
更多-
是的 ,lucene查询允许在查询中使用括号,并且您提供的语法完全有效。 但是, 不 ,这两个查询不会得到相同的结果。 这不是一些Lucene怪癖,但这两个查询在逻辑上并不相同。 根据德摩根定律 :不是一个而不是一个=不是(一个或多个) field1:val1 NOT field2:val2 NOT field3:val3等效于field1:val1 NOT (field2:val2 OR field3:val3) 。 这些将返回包含“val1”的结果,但不包含“val2”或“val3” field1:va ...
-
/?q=query&fl=field1,field2,field3 /?q=query&fl=field1,field2,field3
-
将“商店”设置更改为true:
stored属性将确保您的原始值保留在索引中以供检索。 否则,您可以在该字段中搜索,但不能获取它。 Change your "store" setting to true: ES已经为此进行了渗透 - 对于Solr,您通常会将文档索引为基于内存的核心/索引中的单个文档,然后针对该文档运行查询(这是ES至少在内部执行的操作,IIRC)。 ES has percolate for this - for Solr you'll usually index the document as a single document in a memory based core / index and then run the queries against that (which is wha ...字段名称应仅包含字母数字或下划线字符,不能以数字开头。 选择字段名称时,建议使用java变量命名约定。 更多参考 https://cwiki.apache.org/confluence/display/solr/Defining+Fields Field names should consist of alphanumeric or underscore characters only and not start with a digit. When selection a field name - jav ...Solr在multiValue字段中返回每个值的每个文档(Solr return each document per value in the multiValue field)[2022-03-20]
如果您希望多次返回文档并对这两个字段进行排序,则可以为每个组合插入单独的记录。 这是很多重复的数据,但假设这是你实现它的唯一方法。 您可以使用分组功能,但它不适用于多值字段。 If you want the documents to be returned multiple times and sort on both the fields, you have the insert individual records for each combination. This is a lot of dupli ...两个以上字段值之和,并将其作为solr中的新字段返回(sum of more than two fields value and return it as new field in solr)[2022-03-22]
使用fl参数并添加totalCost ,其中包含extra和food值的总和。 如下 localhost:8983/solr/collection1/select?indent=on&q=*:*&wt=json&fl=name,totalCost:sum(food,extra) 希望这可以帮助 Use fl parameter and add totalCost which takes sum of extra and food values. like below localhost:8983/solr ...抱歉,Solr不支持将突出显示的术语返回到原始文档字段。 Solr确实以这种方式突出显示,因为有可能(基于您的荧光笔的配置方式)可能没有任何突出显示所有查询结果的结果。 此外,由于它支持突出显示多个字段,并使用第二个xml结构返回可能的多个突出显示结果,并通过索引文档的id字段对它们进行分组,以便它们可以正确地与找到它们的文档相关联。 如果要将原始文档字段替换为要显示的突出显示字段,则需要在返回Solr查询结果后执行自己的处理。 Sorry, Solr does not support returning ...这目前不可能; 看到这个bug和前一个问题 。 This is not currently possible; see this bug and this previous question.您可以使用DocTransformer实现此目的。 只需从类继承并在transform方法中实现所需的逻辑: public void transform(SolrDocument doc, int docId) { String oldValue = doc.getFieldValue(fieldName); doc.put(newField,getNewValue(oldValue)); } You can achieve this using a DocTransformer . Ju ...