我读过,在这个文档页上(https://developers.google.com/cloud-search/docs/reference/rest/v1/query/search),表示可以在查询参数中使用or运算符。我使用了各种语法,用圆括号或双引号括起搜索关键字,如:
(可再生能源)或(可再生能源论坛)或(可再生能源)或(可再生能源)。。。。
“可再生能源”或“可再生能源论坛”或“可再生能源”或“可再生能源”。。。。
仅使用可再生能源,我得到12个结果,令我惊讶的是,添加其他短语或结果显着减少(只有7),而不是增加或保持不变。也许我不太明白在查询参数中使用什么样的语法才能正确识别or运算符。
我想澄清的是,在文档索引模式中,只有一个字段具有最高的重要性,所有其他字段都设置为“无”。
在查询中,我只使用数据源限制来指定特定的数据源和查询参数。没有其他参数可以影响结果。
这是我如何用java构建查询的:
如何生成搜索查询请求
带筛选器选项的数据源限制。这里我只设置数据源和对象类型,子过滤器是空的
如何使用stringjoiner编写查询
以下是通过 Postman 电话获得的结果:
查询结果->可再生能源
查询结果->(可再生能源)或(可再生能源效率)或(可再生能源立法)或(可再生能源论坛)或(可再生能源市场)或(可再生能源)或(可再生能源效率)或(可再生能源法律)或(可再生能源论坛)或(可再生能源市场)
查询结果->(可再生能源和能源)或(可再生能源和能源效率)或(可再生能源和能源立法)或(可再生能源和能源论坛)或(可再生能源和能源市场)或(可再生能源和能源)或(可再生能源和能源效率)或(可再生能源和能源法律)或(可再生能源和能源论坛)或(可再生能源和能源法律)市场)
这是我的数据源架构:
{
"objectDefinitions": [
{
"name": "tag",
"propertyDefinitions": [
{
"name": "description",
"isReturnable": true,
"textPropertyOptions": {
"retrievalImportance": {
"importance": "NONE"
}
},
"displayOptions": {
"displayLabel": "Description"
}
},
{
"name": "hash",
"isReturnable": true,
"textPropertyOptions": {
"retrievalImportance": {
"importance": "NONE"
},
"operatorOptions": {
"operatorName": "hash",
"exactMatchWithOperator": true
}
},
"displayOptions": {
"displayLabel": "Hash"
}
},
{
"name": "id",
"isReturnable": true,
"textPropertyOptions": {
"retrievalImportance": {
"importance": "NONE"
},
"operatorOptions": {
"operatorName": "id",
"exactMatchWithOperator": true
}
},
"displayOptions": {
"displayLabel": "Id"
}
},
{
"name": "lastModified",
"isReturnable": true,
"isSortable": true,
"datePropertyOptions": {
"operatorOptions": {
"operatorName": "modified",
"lessThanOperatorName": "modifiedbefore",
"greaterThanOperatorName": "modifiedafter"
}
},
"displayOptions": {
"displayLabel": "Modified date"
}
},
{
"name": "name",
"isReturnable": true,
"isWildcardSearchable": true,
"textPropertyOptions": {
"retrievalImportance": {
"importance": "NONE"
},
"operatorOptions": {
"operatorName": "name"
}
},
"displayOptions": {
"displayLabel": "Name"
}
},
{
"name": "namespace",
"isReturnable": true,
"textPropertyOptions": {
"retrievalImportance": {
"importance": "NONE"
},
"operatorOptions": {
"operatorName": "namespace",
"exactMatchWithOperator": true
}
}
},
{
"name": "path",
"isReturnable": true,
"textPropertyOptions": {
"retrievalImportance": {
"importance": "NONE"
},
"operatorOptions": {
"operatorName": "path",
"exactMatchWithOperator": true
}
}
},
{
"name": "referenceCount",
"isReturnable": true,
"isSortable": true,
"integerPropertyOptions": {
"orderedRanking": "DESCENDING",
"operatorOptions": {
"operatorName": "reference",
"lessThanOperatorName": "referencebelow",
"greaterThanOperatorName": "referenceabove"
}
},
"displayOptions": {
"displayLabel": "Reference Count"
}
},
{
"name": "en",
"isReturnable": true,
"textPropertyOptions": {
"retrievalImportance": {
"importance": "NONE"
},
"operatorOptions": {
"operatorName": "en"
}
},
"displayOptions": {
"displayLabel": "Title En"
}
},
{
"name": "it",
"isReturnable": true,
"isWildcardSearchable": true,
"isSuggestable": true,
"textPropertyOptions": {
"retrievalImportance": {
"importance": "HIGHEST"
},
"operatorOptions": {
"operatorName": "it"
}
},
"displayOptions": {
"displayLabel": "Title It"
}
},
{
"name": "automlHash",
"isReturnable": true,
"textPropertyOptions": {
"retrievalImportance": {
"importance": "NONE"
},
"operatorOptions": {
"operatorName": "automlhash",
"exactMatchWithOperator": true
}
},
"displayOptions": {
"displayLabel": "AutoML Hash"
}
}
]
}
]
}
暂无答案!
目前还没有任何答案,快来回答吧!