phrase
查询中term
和Structured
有何不同?
我的CloudSearch域中有这些数据:
{
"guid": 9,
"operating_systems": [
"12345", "123"
],
"manufacturer": "sealand",
"model": "gaming tree whale plum",
"identifier": "gaming tree whale plum",
"type": "computer",
"created_at": "1982-10-14T14:43:54Z"
}
"model"
类型为text
,"identifier"
类型为literal
,"created_at"
类型为date
。
让我们进行一些查询:
(phrase field=model 'tree whale') match
(phrase field= identifier 'tree whale') no match
(phrase 'tree whale') match
(phrase field=created_at '1982-10-14T14:43:54Z') match (this shouldn't match according to docs)
(term field=model 'tree whale') match
(term field= identifier 'tree whale') no match
(term 'tree whale') match
(term field=created_at '1982-10-14T14:43:54Z') match
phrase
对term
我无法做什么,反之亦然?
答案 0 :(得分:1)
term
VS phrase
的语法和用法之间几乎没有区别。但是,处理phrases
时的搜索行为可以terms
无法自定义,可以用来提高效果:
Terms
用于匹配文本字段,phrases
用于更复杂的搜索。
浏览网络文档,只需阅读所有PDF文件: http://docs.aws.amazon.com/cloudsearch/latest/developerguide/cloudsearch-dg.pdf
答案 1 :(得分:1)
如果有人想知道,事实证明短语搜索与整个短语匹配,而术语搜索匹配可能是短语但可能是在文档周围散布的单词。例如:
文本:
"model": gaming tree whale plum
以下举行:
(phrase field=model 'tree whale') match
(phrase field=model 'tree plum') no match
(term field=model 'tree whale') match
(term field=model 'tree plum') match