Strings of the form ${namespaceprefix:variablename} are used to parameterize queries.
格式为${namespaceprefix:variablename}的字符串用于参数化查询。
So to parameterize a full text search using the parameter ‘sys:text’:
使用参数’sys:text’参数化全文搜索:
QueryParameterDefImpl paramDef = new QueryParameterDefImpl(QName.createQName('sys:text', namespacePrefixResolver) (DataTypeDefinition) null, true, 'fox');
ResultsSet results = null;
try {
results = serviceRegistry.getSearchService().query(getStoreRef(), 'lucene', 'TEXT:\'${sys:text}\'', null,
new QueryParameterDefinition[] { paramDef });
...
} finally {
if(results != null) {
results.close();
}
}
This searches for nodes that contain ‘fox’ in the TEXT. This does a straight replacement of pattern ‘${sys:text}’ with ‘fox’ in the query definition before executing the Lucene query.
这将搜索文本中包含“fox”的节点。在执行Lucene查询之前,这会在查询定义中将模式’${sys:text}’直接替换为’fox’。
文档更新时间: 2020-02-11 08:35 作者:凌云文档