Search in sources :

Example 1 with FullTextEntry

use of com.rbmhtechnology.vind.monitoring.logger.entry.FullTextEntry in project vind by RBMHTechnology.

the class MonitoringSearchServerTest method testSuggestionQueryMonitoringWithSessionAndLogger.

@Test
public void testSuggestionQueryMonitoringWithSessionAndLogger() throws IOException {
    TestMonitoringWriter logger = new TestMonitoringWriter();
    MonitoringSearchServer server = new MonitoringSearchServer(testSearchServer.getSearchServer(), new SimpleApplication("app"), new SimpleSession("123"), logger);
    final SingleValueFieldDescriptor.TextFieldDescriptor<String> textField = new FieldDescriptorBuilder<String>().setFacet(true).buildTextField("textField");
    final DocumentFactory factory = new DocumentFactoryBuilder("asset").addField(textField).build();
    server.execute(Search.fulltext(), factory);
    server.setSession(new SimpleSession("456"));
    server.execute(Search.fulltext("Hello World").filter(or(eq(textField, "testFilter"), not(prefix("textField", "pref")))).facet(textField).sort(Sort.desc(textField)), factory);
    // logger.logs.get(1).toJson();
    assertEquals(2, logger.logs.size());
    assertEquals("app", ((SimpleApplication) logger.logs.get(0).getApplication()).getId());
    assertEquals("123", logger.logs.get(0).getSession().getSessionId());
    assertEquals("*", ((FullTextEntry) logger.logs.get(0)).getRequest().getQuery());
    assertEquals("456", logger.logs.get(1).getSession().getSessionId());
    assertEquals("*", ((FullTextEntry) logger.logs.get(0)).getRequest().getQuery());
}
Also used : FullTextEntry(com.rbmhtechnology.vind.monitoring.logger.entry.FullTextEntry) DocumentFactory(com.rbmhtechnology.vind.model.DocumentFactory) SingleValueFieldDescriptor(com.rbmhtechnology.vind.model.SingleValueFieldDescriptor) SimpleApplication(com.rbmhtechnology.vind.monitoring.model.application.SimpleApplication) SimpleSession(com.rbmhtechnology.vind.monitoring.model.session.SimpleSession) FieldDescriptorBuilder(com.rbmhtechnology.vind.model.FieldDescriptorBuilder) DocumentFactoryBuilder(com.rbmhtechnology.vind.model.DocumentFactoryBuilder) Test(org.junit.Test)

Example 2 with FullTextEntry

use of com.rbmhtechnology.vind.monitoring.logger.entry.FullTextEntry in project vind by RBMHTechnology.

the class ElasticWriterTest method logTest.

@Ignore
public void logTest() {
    final ElasticWriter elasticWriter = new ElasticWriter("localhost", "9201", "logindex");
    elasticWriter.log(new FullTextEntry());
}
Also used : FullTextEntry(com.rbmhtechnology.vind.monitoring.logger.entry.FullTextEntry) Ignore(org.junit.Ignore)

Example 3 with FullTextEntry

use of com.rbmhtechnology.vind.monitoring.logger.entry.FullTextEntry in project vind by RBMHTechnology.

the class MonitoringSearchServer method execute.

@Override
public <T> BeanSearchResult<T> execute(FulltextSearch search, Class<T> c) {
    final ZonedDateTime start = ZonedDateTime.now();
    final BeanSearchResult<T> result = server.execute(search, c);
    final ZonedDateTime end = ZonedDateTime.now();
    final FullTextEntry entry = new FullTextEntry(this.server, AnnotationUtil.createDocumentFactory(c), application, search, result, start, end, result.getQueryTime(), result.getElapsedTime(), session);
    entry.setMetadata(this.monitoringMetadata);
    logger.log(entry);
    return result;
}
Also used : FullTextEntry(com.rbmhtechnology.vind.monitoring.logger.entry.FullTextEntry) ZonedDateTime(java.time.ZonedDateTime)

Example 4 with FullTextEntry

use of com.rbmhtechnology.vind.monitoring.logger.entry.FullTextEntry in project vind by RBMHTechnology.

the class MonitoringSearchServer method execute.

public <T> BeanSearchResult<T> execute(FulltextSearch search, Class<T> c, HashMap<String, Object> metadata) {
    final ZonedDateTime start = ZonedDateTime.now();
    final BeanSearchResult<T> result = server.execute(search, c);
    final ZonedDateTime end = ZonedDateTime.now();
    final FullTextEntry entry = new FullTextEntry(this.server, AnnotationUtil.createDocumentFactory(c), application, search, result, start, end, result.getQueryTime(), result.getElapsedTime(), session);
    final HashMap<String, Object> mergedMetadata = new HashMap<>();
    mergedMetadata.putAll(this.monitoringMetadata);
    mergedMetadata.putAll(metadata);
    entry.setMetadata(mergedMetadata);
    logger.log(entry);
    return result;
}
Also used : FullTextEntry(com.rbmhtechnology.vind.monitoring.logger.entry.FullTextEntry) ZonedDateTime(java.time.ZonedDateTime) HashMap(java.util.HashMap)

Example 5 with FullTextEntry

use of com.rbmhtechnology.vind.monitoring.logger.entry.FullTextEntry in project vind by RBMHTechnology.

the class MonitoringSearchServer method execute.

@Override
public SearchResult execute(FulltextSearch search, DocumentFactory factory) {
    final ZonedDateTime start = ZonedDateTime.now();
    final SearchResult result = server.execute(search, factory);
    final ZonedDateTime end = ZonedDateTime.now();
    final FullTextEntry entry = new FullTextEntry(this.server, factory, application, search, result, start, end, result.getQueryTime(), result.getElapsedTime(), session);
    entry.setMetadata(this.monitoringMetadata);
    logger.log(entry);
    return result;
}
Also used : FullTextEntry(com.rbmhtechnology.vind.monitoring.logger.entry.FullTextEntry) ZonedDateTime(java.time.ZonedDateTime)

Aggregations

FullTextEntry (com.rbmhtechnology.vind.monitoring.logger.entry.FullTextEntry)6 ZonedDateTime (java.time.ZonedDateTime)4 HashMap (java.util.HashMap)2 DocumentFactory (com.rbmhtechnology.vind.model.DocumentFactory)1 DocumentFactoryBuilder (com.rbmhtechnology.vind.model.DocumentFactoryBuilder)1 FieldDescriptorBuilder (com.rbmhtechnology.vind.model.FieldDescriptorBuilder)1 SingleValueFieldDescriptor (com.rbmhtechnology.vind.model.SingleValueFieldDescriptor)1 SimpleApplication (com.rbmhtechnology.vind.monitoring.model.application.SimpleApplication)1 SimpleSession (com.rbmhtechnology.vind.monitoring.model.session.SimpleSession)1 Ignore (org.junit.Ignore)1 Test (org.junit.Test)1