我已经为我的桶创建了一个全文搜索索引,我能够在web中使用它并获得一些搜索结果。不过,我仍然找不到一个适当的例子,说明如何使用在现有存储库中创建存储库或方法来执行全文搜索。
以下是我的索引定义:
{
"type": "fulltext-index",
"name": "FTI_Users",
"uuid": "48316628ed720269",
"sourceType": "gocbcore",
"sourceName": "Users",
"sourceUUID": "d8a535cb7b46f6b4f85b24bc0887e740",
"planParams": {
"maxPartitionsPerPIndex": 1024,
"indexPartitions": 1
},
"params": {
"doc_config": {
"docid_prefix_delim": "",
"docid_regexp": "",
"mode": "type_field",
"type_field": "type"
},
"mapping": {
"analysis": {},
"default_analyzer": "standard",
"default_datetime_parser": "dateTimeOptional",
"default_field": "_all",
"default_mapping": {
"dynamic": true,
"enabled": true
},
"default_type": "_default",
"docvalues_dynamic": false,
"index_dynamic": true,
"store_dynamic": true,
"type_field": "_type"
},
"store": {
"indexType": "scorch",
"segmentVersion": 15
}
},
"sourceParams": {}
}我发现的只是这个简短的Spring文档https://docs.spring.io/spring-data/couchbase/docs/current/reference/html/#:~:text=for%20more%20information.-,Full%20Text%20Search,-(FTS),他们建议使用Cluster类。
首先,如果可能的话,我想使用Spring存储库而不是这个类。如果不是,如何转换从
cluster.searchQuery("FTI_Users", SearchQuery.queryString(query))变成我的实体对象的列表?
发布于 2022-09-15 18:03:55
在春季数据库库中,FTS没有集成。
使用8.3对象转换进行对象映射。https://docs.spring.io/spring-data/couchbase/docs/current/reference/html/#couchbase.transactions
有(曾经?)一行错字。需要使用target.export()而不是target.getContent()
ctx.insert(couchbaseClientFactory.getDefaultCollection(),target.getId(),target.export();
https://stackoverflow.com/questions/73591722
复制相似问题