I have a searchable domain class mapped to a table that has a flag column. Currently, when Lucene creates an index it generates a query like this (returns all data in the table):
select this_.id as id0_0_,
this_.flag as flag2_0_0_,
this_.email as email0_0_, this_.first_name as first6_0_0_, this_.last_name as last8_0_0_
from ais_person this_
order by this_.id asc
Is it possible to build an index for only those rows which contain a specific flag value, so that the generated query would look like this:
select this_.id as id0_0_,
this_.flag as flag2_0_0_,
this_.email as email0_0_, this_.first_name as first6_0_0_, this_.last_name as last8_0_0_
from ais_person this_
where this_.flag = 'Y'
order by this_.id asc
Yes, i think you can do that. Following is the pseudo-code.
Document doc = new Document();
doc.add(Field.Text("flag", Y));
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.