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());
}
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());
}
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;
}
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;
}
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;
}
Aggregations