Solr Lucene在多值字段中查找索引?
我有一个名称的多值字段,我必须在列表中找到匹配值的索引Solr Lucene在多值字段中查找索引?,solr,lucene,solarium,Solr,Lucene,Solarium,我有一个名称的多值字段,我必须在列表中找到匹配值的索引 DOC example: profile_id: 1 names: [ "My name", "something", "My second name", "My nickname"] 查询: profile_id:1 AND names:"My secon name"~ 预期结果: my doc, and the index of the matched, 2 可能吗?与TermQuery一样匹配文档,但它也跟踪出现在同一文档中的
DOC example:
profile_id: 1
names: [ "My name", "something", "My second name", "My nickname"]
查询:
profile_id:1 AND names:"My secon name"~
预期结果:
my doc, and the index of the matched, 2
可能吗?与TermQuery一样匹配文档,但它也跟踪出现在同一文档中的相同术语的位置
Spans positionInfoForAllMatchingDocs = spanQuery.getSpans(..arguments..);
int position = -1;
while(positionInfoForAllMatchingDocs.next()){
position = positionInfoForAllMatchingDocs.start() // Returns the start position of the current match.
System.out.println("Found match in the document with id: " + positionInfoForAllMatchingDocs.doc() + " at position: " + position); // You obviously want to replace this sysout with something elegant.
}
- 确保计划检索位置信息的字段已使用field.TermVector.with_POSITIONS或field.TermVector.with_POSITIONS和_offset编制索引李>