Package net.sf.logsaw.index

Examples of net.sf.logsaw.index.IIndexService.query()


      IQueryContext ctx = indexService.createQueryContext(getLogResource());
      try {
        List<ARestriction<?>> ops = new LinkedList<ARestriction<?>>();
        ops.add(getRestrictionFactory().newRestriction(Log4JFieldProvider.FIELD_LEVEL, Operators.OPERATOR_LESS_THAN,
            Log4JFieldProvider.FIELD_LEVEL.getLevelProvider().findLevel("warn")));
        ResultPage p = indexService.query(ctx, ops, 0, 1000);
        assertEquals(4, p.getItems().size());
        assertEquals(4, p.getTotalHits());
      } finally {
        ctx.close();
      }
View Full Code Here


      IQueryContext ctx = indexService.createQueryContext(getLogResource());
      try {
        List<ARestriction<?>> ops = new LinkedList<ARestriction<?>>();
        ops.add(getRestrictionFactory().newRestriction(Log4JFieldProvider.FIELD_LEVEL, Operators.OPERATOR_GREATER_THAN,
            Log4JFieldProvider.FIELD_LEVEL.getLevelProvider().findLevel("info")));
        ResultPage p = indexService.query(ctx, ops, 0, 1000);
        assertEquals(1, p.getItems().size());
        assertEquals(1, p.getTotalHits());
      } finally {
        ctx.close();
      }
View Full Code Here

      IQueryContext ctx = indexService.createQueryContext(getLogResource());
      try {
        List<ARestriction<?>> ops = new LinkedList<ARestriction<?>>();
        ops.add(getRestrictionFactory().newRestriction(Log4JFieldProvider.FIELD_LEVEL, Operators.OPERATOR_EQUALS,
            Log4JFieldProvider.FIELD_LEVEL.getLevelProvider().findLevel("warn")));
        ResultPage p = indexService.query(ctx, ops, 0, 1000);
        assertEquals(1, p.getItems().size());
        assertEquals(1, p.getTotalHits());
      } finally {
        ctx.close();
      }
View Full Code Here

      IQueryContext ctx = indexService.createQueryContext(getLogResource());
      try {
        List<ARestriction<?>> ops = new LinkedList<ARestriction<?>>();
        ops.add(getRestrictionFactory().newRestriction(Log4JFieldProvider.FIELD_LEVEL, Operators.OPERATOR_NOT_EQUALS,
            Log4JFieldProvider.FIELD_LEVEL.getLevelProvider().findLevel("info")));
        ResultPage p = indexService.query(ctx, ops, 0, 1000);
        assertEquals(1, p.getItems().size());
        assertEquals(1, p.getTotalHits());
      } finally {
        ctx.close();
      }
View Full Code Here

            Operators.OPERATOR_AFTER, new Date(1248183795312L)));
        ops.add(getRestrictionFactory().newRestriction(Log4JFieldProvider.FIELD_TIMESTAMP,
            Operators.OPERATOR_BEFORE, new Date(1248183796234L)));
        ops.add(getRestrictionFactory().newRestriction(Log4JFieldProvider.FIELD_MESSAGE,
            Operators.OPERATOR_CONTAINS, "manager"));
        ResultPage p = indexService.query(ctx, ops, 0, 1000);
        assertEquals(2, p.getItems().size());
        assertEquals(2, p.getTotalHits());
      } finally {
        ctx.close();
      }
View Full Code Here

      IQueryContext ctx = indexService.createQueryContext(getLogResource());
      try {
        List<ARestriction<?>> ops = new LinkedList<ARestriction<?>>();
        ops.add(getRestrictionFactory().newRestriction(Log4JFieldProvider.FIELD_MESSAGE,
            Operators.OPERATOR_CONTAINS, "Recovery"));
        ResultPage p = indexService.query(ctx, ops, 0, 1000);
        assertEquals(2, p.getItems().size());
        assertEquals(2, p.getTotalHits());
      } finally {
        ctx.close();
      }
View Full Code Here

      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();
      }
View Full Code Here

      loadLogFile("server.10-11-09.log.xml");
      createLogResourceWithPK("UTF-8", Locale.getDefault(), TimeZone.getTimeZone("Europe/Berlin"));
      indexService.synchronize(getLogResource(), null);
      IQueryContext ctx = indexService.createQueryContext(getLogResource());
      try {
        ResultPage p = indexService.query(ctx, new LinkedList<ARestriction<?>>(), 0, 1000);
        assertEquals("2009-11-10T23:08:46.453", Log4JFieldProvider.FIELD_TIMESTAMP.toInputValue(
            p.getItems().get(0).get(Log4JFieldProvider.FIELD_TIMESTAMP), getLogResource()));
        List<ARestriction<?>> ops = new LinkedList<ARestriction<?>>();
        ops.add(getRestrictionFactory().newRestriction(Log4JFieldProvider.FIELD_TIMESTAMP,
            Operators.OPERATOR_AFTER, Log4JFieldProvider.FIELD_TIMESTAMP.fromInputValue("2009-11-10T23:08:47.609", getLogResource())));
View Full Code Here

        List<ARestriction<?>> ops = new LinkedList<ARestriction<?>>();
        ops.add(getRestrictionFactory().newRestriction(Log4JFieldProvider.FIELD_TIMESTAMP,
            Operators.OPERATOR_AFTER, Log4JFieldProvider.FIELD_TIMESTAMP.fromInputValue("2009-11-10T23:08:47.609", getLogResource())));
        ops.add(getRestrictionFactory().newRestriction(Log4JFieldProvider.FIELD_TIMESTAMP,
            Operators.OPERATOR_BEFORE, Log4JFieldProvider.FIELD_TIMESTAMP.fromInputValue("2009-11-10T23:08:50.609", getLogResource())));
        p = indexService.query(ctx, ops, 0, 1000);
        assertEquals(2, p.getItems().size());
      } finally {
        ctx.close();
      }
    } catch (Exception e) {
View Full Code Here

      loadLogFile("sample-1.log.xml");
      createLogResourceWithPK("UTF-8", Locale.getDefault(), getTimeZone());
      indexService.synchronize(getLogResource(), null);
      IQueryContext ctx = indexService.createQueryContext(getLogResource());
      try {
        ResultPage p = indexService.query(ctx, new LinkedList<ARestriction<?>>(), 0, 1000);
        assertEquals(5, p.getItems().size());
        loadLogFile("sample-2.log.xml");
        getLogResource().configure(SimpleLogResourceFactory.OPTION_LOGFILE, getLogFile().getPath());
        indexService.synchronize(getLogResource(), null);
        // additional entry is indexed, but the cached reader cannot see it
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.