Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
鉴于以下示例文档:
FIELD_A: [1_aa] [1_cc] FIELD_B: [2_xx] [1_bb]
查询会发现类似:
find 'aa' in FIELD_A and 'xx' in FIELD_B
查询应该匹配前缀(例如:)FIELD_A,所以上面的查询不会期望结果。FIELD_B1_
FIELD_A
FIELD_B
1_
这有意义吗?这在 Lucene 中是否可行,还是有更好的方法来构建索引?
我会为每个前缀创建单独的文档。然后使用连词查询(两个字段都BooleanQuery带有Occur.MUST)。
BooleanQuery
Occur.MUST
例如文档1_:
`标题:“1_”
FIELD_A:[aa] [cc]
FIELD_B:[bb]`
和文件2_:
2_
`标题:“2_”
FIELD_B:[xx]`
希望这能回答你的问题。