How do I pass a list of 'allowed' IDs to f

2019-07-11 17:52发布

I need to return just the documents that a user has access to from a Lucene search. I can get a list of IDs from a database that make up the 'allowed' subset. How can I pass these to Lucene? The articles I've found on the web suggest I need to use a BitSet and FieldCache (am I right?), but I'm having trouble finding good examples. Does anyone have any?

I'm using C#, but any language would be great. Thanks.

2条回答
▲ chillily
2楼-- · 2019-07-11 18:28

A simple way would be to build a MultiPhraseQuery with an array of all the matching IDs, via MultiPhraseQuery.add(Term[] terms). You can build one of these things with thousands of terms, and Lucene (as always) performs extremely well.

查看更多
仙女界的扛把子
3楼-- · 2019-07-11 18:28

Once I knew I needed to use a custom filter, asking this question got the right answer.

查看更多
登录 后发表回答