A category tree like this:
root_1
sub_1
sub_2
... to sub_20
Every document has a sub category(like sub_2
). Now, I only wrote sub_2
in lucene index:
new NumericField("category",...).setIntValue(sub_2.getID());
I want to get all root_1
's documents, using BooleanQuery
(merge the sub_1
to sub_20
) to search or write an other category in every entry document:
new NumericField("category",...).setIntValue(sub_2.getID());
new NumericField("category",...).setIntValue(root_1.getID());//sub_2's ancestor category
Which is the better choice?