}
try {
TreeSet categories = new TreeSet();
Roller roller = RollerFactory.getRoller();
WeblogManager weblogMgr = roller.getWeblogManager();
WeblogEntryData entry = null;
Document doc = null;
String handle = null;
Timestamp now = new Timestamp(new Date().getTime());
for(int i = offset; i < offset+limit; i++) {
entry = null; // reset for each iteration
doc = hits.doc(i);
handle = doc.getField(FieldConstants.WEBSITE_HANDLE).stringValue();
if(websiteSpecificSearch &&
handle.equals(searchRequest.getWeblogHandle())) {
entry = weblogMgr.getWeblogEntry(
doc.getField(FieldConstants.ID).stringValue());
} else {
entry = weblogMgr.getWeblogEntry(
doc.getField(FieldConstants.ID).stringValue());
if (doc.getField(FieldConstants.CATEGORY) != null) {
categories.add(
doc.getField(FieldConstants.CATEGORY).stringValue());