gpt4 book ai didi

elasticsearch - Elasticsearch荧光笔标记的数量

转载 作者:行者123 更新时间:2023-12-03 01:47:05 25 4
gpt4 key购买 nike

我正在使用普通荧光笔(Elasticsearch 5.2)。这是一个例子

PUT bookstore
{
"mappings": {
"books": {
"properties": {
"list": {
"properties": {
"summary": {
"type": "text"
},
"title": {
"type": "text"
}
}
}
}
}
}
}
POST bookstore/books/1
{
"list": [
{
"summary": "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.",
"title": "Elasticsearch"
}
]
}
GET bookstore/books/_search
{
"query": {
"simple_query_string": {
"query": "scrambled"
}
},
"highlight": {
"fields": {
"*": {
"require_field_match": false,
"number_of_fragments": 1,
"fragment_size": 70
}
}
}
}
"highlight": {
"list.summary": [
" <em>scrambled</em> it to make a type specimen book. It has survived not only five"
]
}

我的问题是,如何使突出显示的单词居中?在这种情况下,突出显示的单词在开头,在其他情况下在结尾。我如何确保它在中间?

理想情况下,我要指定突出显示的文本前后的标记数量,而不是片段大小。

最佳答案

最后,不支持此功能。一种解决方法是设置number_of_fragments:0。这将返回带有突出显示的完整字段。此后,很容易在应用程序级别上应用任何自定义逻辑。

http://elasticsearch-users.115913.n3.nabble.com/Controlling-highlight-fragments-td1563243.html

关于elasticsearch - Elasticsearch荧光笔标记的数量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43114464/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com