public HashSet <string> Search(DocContainer input) { var query = _queryCreator.CreateBoolQuery(input); var response = _client.Search <Doc>(s => s. Index(_index). Query(q => query). Size(1000)); return(response.Documents.Select(doc => doc.Name).ToHashSet()); }
public void CreateBoolQuery_ShouldCreateAppropriateQuery_WhenEveryThingIsOk() { var expectedQuery = CreateExpectedQuery(); var docContainer = new DocContainer() { NoSignWords = "hello", PlusSignWords = "help mom", MinusSignWords = "dad street" }; var actualQuery = _sut.CreateBoolQuery(docContainer); var serializer = new ElasticClient().RequestResponseSerializer; Assert.Equal(serializer.SerializeToString(expectedQuery), serializer.SerializeToString(actualQuery)); }