MailRecord[] aRetArr;
BooleanQuery oFld = new BooleanQuery();
for (int f=0; f<aFolderName.length; f++)
oFld.add(new TermQuery(new Term("container",aFolderName[f])),BooleanClause.Occur.SHOULD);
BooleanQuery oQry = new BooleanQuery();
oQry.add(new TermQuery(new Term("workarea",sWorkArea)),BooleanClause.Occur.MUST);
oQry.add(oFld, BooleanClause.Occur.MUST);
if (null!=sSender)
oQry.add(new TermQuery(new Term("author",Gadgets.ASCIIEncode(sSender))),BooleanClause.Occur.MUST);
if (null!=sRecipient)
oQry.add(new TermQuery(new Term("recipients",sRecipient)),BooleanClause.Occur.MUST);
if (null!=sSubject)
oQry.add(new TermQuery(new Term("title",Gadgets.ASCIIEncode(sSubject))),BooleanClause.Occur.MUST);
if (dtFromDate!=null && dtToDate!=null)
oQry.add(new RangeQuery(new Term("created",DateTools.dateToString(dtFromDate, DateTools.Resolution.DAY)),
new Term("created",DateTools.dateToString(dtToDate, DateTools.Resolution.DAY)), true), BooleanClause.Occur.MUST);
else if (dtFromDate!=null)
oQry.add(new RangeQuery(new Term("created",DateTools.dateToString(dtFromDate, DateTools.Resolution.DAY)),
new Term("created",DateTools.dateToString(new Date(299,11,31), DateTools.Resolution.DAY)), true), BooleanClause.Occur.MUST);
else if (dtToDate!=null)
oQry.add(new RangeQuery(new Term("created",DateTools.dateToString(new Date(79,11,31), DateTools.Resolution.DAY)),
new Term("created",DateTools.dateToString(dtToDate, DateTools.Resolution.DAY)), true), BooleanClause.Occur.MUST);
if (null!=sText)
oQry.add(new TermQuery(new Term("text",sText)),BooleanClause.Occur.SHOULD);
String sSegments = Gadgets.chomp(sLuceneIndexPath,File.separator)+"k_mime_msgs"+File.separator+sWorkArea;
if (DebugFile.trace) DebugFile.writeln("new IndexSearcher("+sSegments+")");
IndexSearcher oSearch = new IndexSearcher(sSegments);