Search in sources :

Example 31 with SearchResult

use of com.rbmhtechnology.vind.api.result.SearchResult in project vind by RBMHTechnology.

the class ParentChildrenTest method testFilterOnlyWithParentValues.

@Test
public void testFilterOnlyWithParentValues() {
    FulltextSearch search = Search.fulltext().setStrict(false).filter(and(not(eq(parent_value, "orange")), or(eq(parent_value, "blue"), eq(parent_value, "red")))).orChildrenSearch(child);
    SearchResult result = server.execute(search, parent);
    assertEquals(3, result.getNumOfResults());
    assertEquals(Integer.valueOf(2), result.getResults().get(1).getChildCount());
}
Also used : SearchResult(com.rbmhtechnology.vind.api.result.SearchResult) FulltextSearch(com.rbmhtechnology.vind.api.query.FulltextSearch) Test(org.junit.Test)

Example 32 with SearchResult

use of com.rbmhtechnology.vind.api.result.SearchResult in project vind by RBMHTechnology.

the class ParentChildrenTest method testFilterRandomOrderFailure.

// MBDN-599
@Test
public void testFilterRandomOrderFailure() {
    FulltextSearch search = Search.fulltext().setStrict(false).filter(and(eq(child_value, "blue"), eq(shared_value, "red"))).orChildrenSearch(child);
    SearchResult result = server.execute(search, parent);
    assertEquals(2, result.getNumOfResults());
    // 0 because none of the assets have the shared_value:red
    assertEquals(Integer.valueOf(0), result.getResults().get(0).getChildCount());
}
Also used : SearchResult(com.rbmhtechnology.vind.api.result.SearchResult) FulltextSearch(com.rbmhtechnology.vind.api.query.FulltextSearch) Test(org.junit.Test)

Example 33 with SearchResult

use of com.rbmhtechnology.vind.api.result.SearchResult in project vind by RBMHTechnology.

the class ParentChildrenTest method testQuerySyntaxExceptionOnChildrenFacetSearch.

@Test
public void testQuerySyntaxExceptionOnChildrenFacetSearch() {
    FulltextSearch search = Search.fulltext("S003 \"M001\" M004").setStrict(false).orChildrenSearch(child);
    SearchResult result = server.execute(search, parent);
    assertEquals(3, result.getNumOfResults());
    search = Search.fulltext("S003 AND").setStrict(false).orChildrenSearch(child);
    result = server.execute(search, parent);
    assertEquals(1, result.getNumOfResults());
    search = Search.fulltext("S003 \"").setStrict(false).orChildrenSearch(child);
    result = server.execute(search, parent);
    assertEquals(1, result.getNumOfResults());
    search = Search.fulltext("S003 (").setStrict(false).orChildrenSearch(child);
    result = server.execute(search, parent);
    assertEquals(1, result.getNumOfResults());
}
Also used : SearchResult(com.rbmhtechnology.vind.api.result.SearchResult) FulltextSearch(com.rbmhtechnology.vind.api.query.FulltextSearch) Test(org.junit.Test)

Example 34 with SearchResult

use of com.rbmhtechnology.vind.api.result.SearchResult in project vind by RBMHTechnology.

the class ParentChildrenTest method testSubdocumentFacetCountsFailure.

// MBDN-599
@Test
public void testSubdocumentFacetCountsFailure() {
    FulltextSearch search = Search.fulltext().setStrict(false).filter(eq(shared_value, "red")).orChildrenSearch(child);
    SearchResult result = server.execute(search, parent);
    assertEquals(1, result.getFacetResults().getSubdocumentFacets().stream().findFirst().get().getChildrenCount());
    assertEquals(1, (long) result.getFacetResults().getSubdocumentFacets().stream().findFirst().get().getParentCount());
    search = Search.fulltext().setStrict(false).filter(or(eq(shared_value, "yellow"), eq(child_value, "red"))).orChildrenSearch(child);
    result = server.execute(search, parent);
    assertEquals(2, result.getFacetResults().getSubdocumentFacets().stream().findFirst().get().getChildrenCount());
    assertEquals(1, (long) result.getFacetResults().getSubdocumentFacets().stream().findFirst().get().getParentCount());
}
Also used : SearchResult(com.rbmhtechnology.vind.api.result.SearchResult) FulltextSearch(com.rbmhtechnology.vind.api.query.FulltextSearch) Test(org.junit.Test)

Example 35 with SearchResult

use of com.rbmhtechnology.vind.api.result.SearchResult in project vind by RBMHTechnology.

the class ParentChildrenTest method testFilterOnlyWithParentValue.

@Test
public void testFilterOnlyWithParentValue() {
    FulltextSearch search = Search.fulltext().setStrict(false).filter(eq(parent_value, "blue")).orChildrenSearch(child);
    SearchResult result = server.execute(search, parent);
    assertEquals(1, result.getNumOfResults());
    assertEquals(Integer.valueOf(2), result.getResults().get(0).getChildCount());
}
Also used : SearchResult(com.rbmhtechnology.vind.api.result.SearchResult) FulltextSearch(com.rbmhtechnology.vind.api.query.FulltextSearch) Test(org.junit.Test)

Aggregations

SearchResult (com.rbmhtechnology.vind.api.result.SearchResult)38 Test (org.junit.Test)35 FulltextSearch (com.rbmhtechnology.vind.api.query.FulltextSearch)28 SearchServer (com.rbmhtechnology.vind.api.SearchServer)27 Document (com.rbmhtechnology.vind.api.Document)26 SolrInputDocument (org.apache.solr.common.SolrInputDocument)26 ZonedDateTime (java.time.ZonedDateTime)14 MultiValueFieldDescriptor (com.rbmhtechnology.vind.model.MultiValueFieldDescriptor)10 Interval (com.rbmhtechnology.vind.api.query.facet.Interval)9 DateMathExpression (com.rbmhtechnology.vind.api.query.datemath.DateMathExpression)8 Delete (com.rbmhtechnology.vind.api.query.delete.Delete)8 PageResult (com.rbmhtechnology.vind.api.result.PageResult)8 SuggestionResult (com.rbmhtechnology.vind.api.result.SuggestionResult)8 GetResult (com.rbmhtechnology.vind.api.result.GetResult)7 LatLng (com.rbmhtechnology.vind.model.value.LatLng)7 ByteBuffer (java.nio.ByteBuffer)7 Language (com.rbmhtechnology.vind.annotations.language.Language)6 Search (com.rbmhtechnology.vind.api.query.Search)6 TimeUnit (com.rbmhtechnology.vind.api.query.datemath.DateMathExpression.TimeUnit)6 Facets (com.rbmhtechnology.vind.api.query.facet.Facets)6