try {
IIndexService indexService = IndexPlugin.getDefault().getIndexService();
loadLogFile("sample-1.log.xml");
createLogResourceWithPK("UTF-8", Locale.getDefault(), getTimeZone());
indexService.synchronize(getLogResource(), null);
IQueryContext ctx = indexService.createQueryContext(getLogResource());
try {
List<ARestriction<?>> ops = new LinkedList<ARestriction<?>>();
ops.add(getRestrictionFactory().newRestriction(Log4JFieldProvider.FIELD_MESSAGE,
Operators.OPERATOR_CONTAINS, "recovery manager"));
ResultPage p = indexService.query(ctx, ops, 0, 1000);
assertEquals(2, p.getItems().size());
assertEquals(2, p.getTotalHits());
} finally {
ctx.close();
}
} catch (Exception e) {
getLogger().error(e.getLocalizedMessage(), e);
fail("Exception should not occur: " + e.getLocalizedMessage());
}