使用Elasticsearch完成建议器,我在返回与单字查询匹配的多字输入建议时遇到问题.
结构示例:
PUT /test_index/
{
"mappings": {
"item": {
"properties": {
"test_suggest": {
"type": "completion",
"index_analyzer": "whitespace",
"search_analyzer": "whitespace",
"payloads": false
}
}
}
}
}
PUT /test_index/item/1
{
"test_suggest": {
"input": [
"cat dog",
"elephant"
]
}
}
Run Code Online (Sandbox Code Playgroud)
工作查询:
POST /test_index/_suggest
{
"test_suggest":{
"text":"cat",
"completion": {
"field" : "test_suggest"
}
}
}
Run Code Online (Sandbox Code Playgroud)
结果
{
"_shards": {
"total": 5,
"successful": 5,
"failed": 0
},
"test_suggest": [
{
"text": "cat",
"offset": 0,
"length": 3,
"options": [
{
"text": "cat dog",
"score": …Run Code Online (Sandbox Code Playgroud) 使用VUE属性-装饰(或实际上其Component和Prop的VUE级组分)和VUE-chartjs-打字稿,我试图让BarChart与性-componentchartData和options。以下代码在为应用程序提供服务时实际上有效:
<script lang="ts">
import { Bar, mixins } from 'vue-chartjs-typescript'
import Vue from 'vue'
import { Component, Prop } from 'vue-property-decorator'
const { reactiveProp } = mixins
@Component({
extends: Bar,
mixins: [reactiveProp],
})
export default class BarChart extends Vue {
@Prop()
chartData: any
@Prop({default: function () { return {} }})
options!: object
mounted() {
this.renderChart(this.chartData, this.options)
}
}
</script>
Run Code Online (Sandbox Code Playgroud)
但是,它在构建应用程序时失败。我的 IDE (PyCharm Pro) 也给出了同样的错误: …