The FTS query language supports query templates. These are intended to help when building application specific searches.
FTS查询语言支持查询模板。它们旨在帮助构建特定于应用程序的搜索。

A template is a query but with additional support to specify template substitution.
模板是一个查询,但具有指定模板替换的附加支持。

  • %field
    Insert the parse tree for the current ftstest and replace all references to fields in the current parse tree with the supplied field.
    插入当前ftstest的分析树,并用提供的字段替换对当前分析树中字段的所有引用。

  • %(field1, field2)

  • %(field1, field2)
    (The comma is optional.) Create a disjunction, and for each field, add the parse tree for the current ftstest to the disjunction, and then replace all references to fields in the current parse tree with the current field from the list.
    (逗号是可选的。)创建析取,对于每个字段,将当前ftstest的解析树添加到析取,然后用列表中的当前字段替换对当前解析树中字段的所有引用。

Name Template Example Query Expanded Query
t1 %cm:name t1:n1 cm:name:n1
t1 %cm:name t1:”n1” cm:name:”n1”
t1 %cm:name ~t1:n1^4 ~cm:name:n1^4
t2 %(cm:name, cm:title) t2:”woof” (cm:name:”woof” OR cm:title:”woof”)
t2 %(cm:name, cm:title) ~t2:woof^4 (~cm:name:woof OR ~cm:title:woof)^4
t3 %cm:name AND my:boolean:true t3:banana (cm:name:banana AND my:boolean:true)

Templates can refer to other templates.
模板可以引用其他模板。

nameAndTitle -> %(cm:name, cm:title)
nameAndTitleAndDesciption -> %(nameAndTitle, cm:description)
文档更新时间: 2020-02-09 23:03   作者:凌云文档