美好的一天。
我使用couchDB存储某些实体的数据,包括“firstName”,“lastName”,“dob”和“idNumber”。 (还存在各种其他动态数据,但现在不重要。)
我创建了一个全文搜索索引来索引特定类型的文档,并设置为仅搜索上述字段。搜索完全适用于“firstName”和“lastName”以及部分匹配。
但是,对于idNumber,必须给出确切的数字。对idNumber的部分搜索不起作用。例如,如果'7605054321089'是idNumber并且我搜索'760505432',则不返回任何内容。如果我完全输入idNumber,则会成功返回。我已经摆弄了FTS部分下的属性,但无济于事。
我的出生日期根本不起作用。我不能搜索那个字段,但是我已经把它停在那里,直到我让idNumber至少工作。
描述过滤器的JSon如下(对不起大小):
{
"type": "fulltext-index",
"name": "entities_fts",
"uuid": "5c5dc5e32083535f",
"sourceType": "couchbase",
"sourceName": "entities",
"sourceUUID": "04bb2840ed12d26003797737e5a19908",
"planParams": {
"maxPartitionsPerPIndex": 32,
"numReplicas": 0,
"hierarchyRules": null,
"nodePlanParams": null,
"pindexWeights": null,
"planFrozen": false
},
"params": {
"mapping": {
"byte_array_converter": "json",
"default_analyzer": "standard",
"default_datetime_parser": "dateTimeOptional",
"default_field": "_all",
"default_mapping": {
"display_order": "1",
"dynamic": true,
"enabled": false
},
"default_type": "_default",
"index_dynamic": true,
"store_dynamic": false,
"type_field": "header.type",
"types": {
"person": {
"display_order": "0",
"dynamic": false,
"enabled": true,
"properties": {
"basic": {
"display_order": "1",
"dynamic": false,
"enabled": true,
"properties": {
"dob": {
"dynamic": false,
"enabled": true,
"fields": [
{
"analyzer": "",
"display_order": "0",
"include_in_all": true,
"include_term_vectors": true,
"index": true,
"name": "",
"store": false,
"type": "datetime"
}
]
},
"firstNames": {
"dynamic": false,
"enabled": true,
"fields": [
{
"analyzer": "",
"display_order": "2",
"include_in_all": true,
"include_term_vectors": true,
"index": true,
"name": "",
"store": false,
"type": "text"
}
]
},
"lastNames": {
"dynamic": false,
"enabled": true,
"fields": [
{
"analyzer": "",
"display_order": "1",
"include_in_all": true,
"include_term_vectors": false,
"index": true,
"name": "",
"store": false,
"type": "text"
}
]
}
}
},
"extended": {
"display_order": "0",
"dynamic": false,
"enabled": true,
"properties": {
"idNumber": {
"dynamic": false,
"enabled": true,
"fields": [
{
"analyzer": "keyword",
"display_order": "0",
"include_in_all": true,
"include_term_vectors": false,
"index": true,
"name": "",
"store": false,
"type": "text"
}
]
}
}
}
}
}
}
},
"store": {
"kvStoreName": "forestdb"
}
},
"sourceParams": {
"clusterManagerBackoffFactor": 0,
"clusterManagerSleepInitMS": 0,
"clusterManagerSleepMaxMS": 2000,
"dataManagerBackoffFactor": 0,
"dataManagerSleepInitMS": 0,
"dataManagerSleepMaxMS": 2000,
"feedBufferAckThreshold": 0,
"feedBufferSizeBytes": 0
}
}
非常感谢任何帮助,谢谢。
答案 0 :(得分:1)
对于couchbase FTS中的idNumber搜索,可能是因为您正在尝试完全匹配搜索?您可能想尝试前缀搜索...
{
"from": 0,
"size": 10,
"query": {
"field": "name",
"prefix": "bobble"
}
}
https://github.com/blevesearch/bleve/blob/master/test/tests/basic/searches.json#L91