use of org.graylog.plugins.views.search.searchtypes.MessageList in project graylog2-server by Graylog2.
the class ESMessageListTest method usesHighlightingIfActivatedInConfig.
@Test
public void usesHighlightingIfActivatedInConfig() {
MessageList messageList = someMessageList();
ESGeneratedQueryContext context = generateQueryPartWithHighlighting(messageList);
assertThat(context.searchSourceBuilder(messageList).highlighter()).isNotNull();
}
use of org.graylog.plugins.views.search.searchtypes.MessageList in project graylog2-server by Graylog2.
the class ESMessageListTest method includesCustomNameInResultIfPresent.
@Test
public void includesCustomNameInResultIfPresent() {
final ESMessageList esMessageList = new ESMessageList(new QueryStringDecorators(Collections.emptySet()));
final MessageList messageList = someMessageList().toBuilder().name("customResult").build();
final SearchResult result = new MockSearchResult(Collections.emptyList(), (long) 0);
final SearchType.Result searchTypeResult = esMessageList.doExtractResult(null, someQuery(), messageList, result, null, null);
assertThat(searchTypeResult.name()).contains("customResult");
}
use of org.graylog.plugins.views.search.searchtypes.MessageList in project graylog2-server by Graylog2.
the class ESMessageListTest method passesNullForUnmappedTypeIfTypeIsNotFound.
@Test
public void passesNullForUnmappedTypeIfTypeIsNotFound() {
final MessageList messageList = someMessageListWithSorting("stream1", "somefield");
final ESGeneratedQueryContext context = mockQueryContext(messageList);
when(context.fieldType(Collections.singleton("stream1"), "somefield")).thenReturn(Optional.empty());
final ESGeneratedQueryContext queryContext = generateQueryPartWithContextFor(messageList, true, Collections.emptySet(), context);
final DocumentContext doc = JsonPath.parse(queryContext.searchSourceBuilder(messageList).toString());
assertThat(doc.read("$.sort[0].somefield", Map.class)).doesNotContainKey("unmapped_type");
}
use of org.graylog.plugins.views.search.searchtypes.MessageList in project graylog2-server by Graylog2.
the class ESMessageListTest method doesNotUseHighlightingIfDeactivatedInConfig.
@Test
public void doesNotUseHighlightingIfDeactivatedInConfig() {
MessageList messageList = someMessageList();
ESGeneratedQueryContext context = generateQueryPartWithoutHighlighting(messageList);
assertThat(context.searchSourceBuilder(messageList).highlighter()).as("there should be no highlighter configured").isNull();
}
use of org.graylog.plugins.views.search.searchtypes.MessageList in project graylog2-server by Graylog2.
the class CommandFactoryTest method takesStreamsFromQueryIfEmptyOnSearchType.
@Test
void takesStreamsFromQueryIfEmptyOnSearchType() {
MessageList ml = MessageList.builder().id("ml-id").build();
Query q = validQueryBuilderWith(ml).filter(streamFilter("stream-3")).build();
Search s = searchWithQueries(q);
ExportMessagesCommand command = buildFrom(s, ml.id());
assertThat(command.streams()).isEqualTo(q.usedStreamIds());
}
Aggregations