Directory directory = LuceneCocoonHelper.getDirectory(index, false);
lcs.setDirectory(directory);
hits = lcs.search(queryString, LuceneXMLIndexer.BODY_FIELD);
// wrap the hits by an pager help object for accessing only a range of hits
LuceneCocoonPager pager = new LuceneCocoonPager(hits);
int start_index = START_INDEX_DEFAULT;
if (this.startIndex != null) {
start_index = this.startIndex.intValue();
if (start_index <= 0) {
start_index = 0;
}
pager.setStartIndex(start_index);
}
int page_length = PAGE_LENGTH_DEFAULT;
if (this.pageLength != null) {
page_length = this.pageLength.intValue();
if (page_length <= 0) {
page_length = hits.length();
}
pager.setCountOfHitsPerPage(page_length);
}
return pager;
}