Search in sources :

Example 1 with LuceneSearchResult

use of org.hibernate.search.backend.lucene.search.query.LuceneSearchResult in project hibernate-search by hibernate.

the class LuceneExtensionIT method query.

@Test
public void query() {
    StubMappingScope scope = mainIndex.createScope();
    SearchQuery<DocumentReference> genericQuery = scope.query().where(f -> f.matchAll()).toQuery();
    // Put the query and result into variables to check they have the right type
    LuceneSearchQuery<DocumentReference> query = genericQuery.extension(LuceneExtension.get());
    LuceneSearchResult<DocumentReference> result = query.fetchAll();
    assertThatResult(result).fromQuery(query).hasDocRefHitsAnyOrder(mainIndex.typeName(), FIRST_ID, SECOND_ID, THIRD_ID, FOURTH_ID, FIFTH_ID).hasTotalHitCount(5);
    // Unsupported extension
    assertThatThrownBy(() -> query.extension((SearchQuery<DocumentReference> original, SearchLoadingContext<?, ?> loadingContext) -> Optional.empty())).isInstanceOf(SearchException.class);
}
Also used : SearchException(org.hibernate.search.util.common.SearchException) Backend(org.hibernate.search.engine.backend.Backend) IndexObjectFieldReference(org.hibernate.search.engine.backend.document.IndexObjectFieldReference) LuceneIndexManager(org.hibernate.search.backend.lucene.index.LuceneIndexManager) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) IndexableField(org.apache.lucene.index.IndexableField) Term(org.apache.lucene.index.Term) SearchSetupHelper(org.hibernate.search.integrationtest.backend.tck.testsupport.util.rule.SearchSetupHelper) LuceneSearchQuery(org.hibernate.search.backend.lucene.search.query.LuceneSearchQuery) LuceneExtension(org.hibernate.search.backend.lucene.LuceneExtension) LuceneSearchSortFactory(org.hibernate.search.backend.lucene.search.sort.dsl.LuceneSearchSortFactory) DoublePoint(org.apache.lucene.document.DoublePoint) Document(org.apache.lucene.document.Document) Map(java.util.Map) IndexManager(org.hibernate.search.engine.backend.index.IndexManager) StubMappingScope(org.hibernate.search.util.impl.integrationtest.mapper.stub.StubMappingScope) SortField(org.apache.lucene.search.SortField) FailureReportUtils(org.hibernate.search.util.impl.integrationtest.common.reporting.FailureReportUtils) LuceneSearchQuerySelectStep(org.hibernate.search.backend.lucene.search.query.dsl.LuceneSearchQuerySelectStep) SearchProjection(org.hibernate.search.engine.search.projection.SearchProjection) NumericDocValuesField(org.apache.lucene.document.NumericDocValuesField) LatLonPoint(org.apache.lucene.document.LatLonPoint) Explanation(org.apache.lucene.search.Explanation) Sort(org.apache.lucene.search.Sort) SortedSetSortField(org.apache.lucene.search.SortedSetSortField) MatchAllDocsQuery(org.apache.lucene.search.MatchAllDocsQuery) IndexSchemaElement(org.hibernate.search.engine.backend.document.model.dsl.IndexSchemaElement) IndexSchemaObjectField(org.hibernate.search.engine.backend.document.model.dsl.IndexSchemaObjectField) Collectors(java.util.stream.Collectors) LuceneBackend(org.hibernate.search.backend.lucene.LuceneBackend) IndexFieldReference(org.hibernate.search.engine.backend.document.IndexFieldReference) List(java.util.List) TestForIssue(org.hibernate.search.util.impl.test.annotation.TestForIssue) Aggregable(org.hibernate.search.engine.backend.types.Aggregable) SearchHitsAssert.assertThatHits(org.hibernate.search.util.impl.integrationtest.common.assertion.SearchHitsAssert.assertThatHits) Optional(java.util.Optional) LuceneSearchResult(org.hibernate.search.backend.lucene.search.query.LuceneSearchResult) LuceneSearchPredicateFactory(org.hibernate.search.backend.lucene.search.predicate.dsl.LuceneSearchPredicateFactory) IndexReader(org.apache.lucene.index.IndexReader) Projectable(org.hibernate.search.engine.backend.types.Projectable) IndexSearcher(org.apache.lucene.search.IndexSearcher) SearchLoadingContext(org.hibernate.search.engine.search.loading.spi.SearchLoadingContext) GeoPoint(org.hibernate.search.engine.spatial.GeoPoint) DocumentAssert.containsDocument(org.hibernate.search.integrationtest.backend.lucene.testsupport.util.DocumentAssert.containsDocument) StringField(org.apache.lucene.document.StringField) SearchIntegration(org.hibernate.search.engine.common.spi.SearchIntegration) SearchPredicate(org.hibernate.search.engine.search.predicate.SearchPredicate) SearchSort(org.hibernate.search.engine.search.sort.SearchSort) SearchResultAssert.assertThatQuery(org.hibernate.search.util.impl.integrationtest.common.assertion.SearchResultAssert.assertThatQuery) ObjectStructure(org.hibernate.search.engine.backend.types.ObjectStructure) ArrayList(java.util.ArrayList) MetadataFields(org.hibernate.search.backend.lucene.lowlevel.common.impl.MetadataFields) Assertions.assertThatThrownBy(org.assertj.core.api.Assertions.assertThatThrownBy) Store(org.apache.lucene.document.Field.Store) SimpleMappedIndex(org.hibernate.search.util.impl.integrationtest.mapper.stub.SimpleMappedIndex) IntPoint(org.apache.lucene.document.IntPoint) ValueConvert(org.hibernate.search.engine.search.common.ValueConvert) DocumentElement(org.hibernate.search.engine.backend.document.DocumentElement) DocumentReference(org.hibernate.search.engine.backend.common.DocumentReference) ValueWrapper(org.hibernate.search.integrationtest.backend.tck.testsupport.util.ValueWrapper) Before(org.junit.Before) TopDocs(org.apache.lucene.search.TopDocs) LuceneSearchScroll(org.hibernate.search.backend.lucene.search.query.LuceneSearchScroll) LuceneSearchQueryWhereStep(org.hibernate.search.backend.lucene.search.query.dsl.LuceneSearchQueryWhereStep) Sortable(org.hibernate.search.engine.backend.types.Sortable) EventContexts(org.hibernate.search.engine.reporting.spi.EventContexts) LuceneSearchScrollResult(org.hibernate.search.backend.lucene.search.query.LuceneSearchScrollResult) AggregationKey(org.hibernate.search.engine.search.aggregation.AggregationKey) Test(org.junit.Test) Assertions.entry(org.assertj.core.api.Assertions.entry) SearchResultAssert.assertThatResult(org.hibernate.search.util.impl.integrationtest.common.assertion.SearchResultAssert.assertThatResult) Consumer(java.util.function.Consumer) LuceneSearchQueryOptionsStep(org.hibernate.search.backend.lucene.search.query.dsl.LuceneSearchQueryOptionsStep) TermQuery(org.apache.lucene.search.TermQuery) Rule(org.junit.Rule) StubLoadingOptionsStep(org.hibernate.search.util.impl.integrationtest.mapper.stub.StubLoadingOptionsStep) SearchQuery(org.hibernate.search.engine.search.query.SearchQuery) Type(org.apache.lucene.search.SortField.Type) LuceneSearchQuery(org.hibernate.search.backend.lucene.search.query.LuceneSearchQuery) SearchQuery(org.hibernate.search.engine.search.query.SearchQuery) StubMappingScope(org.hibernate.search.util.impl.integrationtest.mapper.stub.StubMappingScope) DocumentReference(org.hibernate.search.engine.backend.common.DocumentReference) SearchLoadingContext(org.hibernate.search.engine.search.loading.spi.SearchLoadingContext) Test(org.junit.Test)

Example 2 with LuceneSearchResult

use of org.hibernate.search.backend.lucene.search.query.LuceneSearchResult in project hibernate-search by hibernate.

the class LuceneExtensionIT method queryContext.

@Test
@SuppressWarnings("unused")
public void queryContext() {
    StubMappingScope scope = mainIndex.createScope();
    // Put intermediary contexts into variables to check they have the right type
    LuceneSearchQuerySelectStep<DocumentReference, DocumentReference, StubLoadingOptionsStep> context1 = scope.query().extension(LuceneExtension.get());
    LuceneSearchQueryWhereStep<DocumentReference, StubLoadingOptionsStep> context2 = context1.select(f -> f.composite().from(f.documentReference(), f.document()).as((docRef, document) -> docRef));
    // Note we can use Lucene-specific predicates immediately
    LuceneSearchQueryOptionsStep<DocumentReference, StubLoadingOptionsStep> context3 = context2.where(f -> f.fromLuceneQuery(new MatchAllDocsQuery()));
    // Note we can use Lucene-specific sorts immediately
    LuceneSearchQueryOptionsStep<DocumentReference, StubLoadingOptionsStep> context4 = context3.sort(f -> f.fromLuceneSortField(new SortedSetSortField("sort1", false)));
    // Put the query and result into variables to check they have the right type
    LuceneSearchQuery<DocumentReference> query = context4.toQuery();
    LuceneSearchResult<DocumentReference> result = query.fetchAll();
    assertThatResult(result).fromQuery(query).hasDocRefHitsAnyOrder(mainIndex.typeName(), FIRST_ID, SECOND_ID, THIRD_ID, FOURTH_ID, FIFTH_ID).hasTotalHitCount(5);
    // Also check (at compile time) the context type for other asXXX() methods, since we need to override each method explicitly
    LuceneSearchQueryWhereStep<DocumentReference, StubLoadingOptionsStep> selectEntityReferenceContext = scope.query().extension(LuceneExtension.get()).selectEntityReference();
    LuceneSearchQueryWhereStep<DocumentReference, StubLoadingOptionsStep> selectEntityContext = scope.query().extension(LuceneExtension.get()).selectEntity();
    SearchProjection<DocumentReference> projection = scope.projection().documentReference().toProjection();
    LuceneSearchQueryWhereStep<DocumentReference, StubLoadingOptionsStep> selectProjectionContext = scope.query().extension(LuceneExtension.get()).select(projection);
    LuceneSearchQueryWhereStep<List<?>, ?> selectProjectionsContext = scope.query().extension(LuceneExtension.get()).select(projection, projection);
    LuceneSearchQueryOptionsStep<DocumentReference, StubLoadingOptionsStep> defaultResultContext = scope.query().extension(LuceneExtension.get()).where(f -> f.fromLuceneQuery(new MatchAllDocsQuery()));
}
Also used : SearchException(org.hibernate.search.util.common.SearchException) Backend(org.hibernate.search.engine.backend.Backend) IndexObjectFieldReference(org.hibernate.search.engine.backend.document.IndexObjectFieldReference) LuceneIndexManager(org.hibernate.search.backend.lucene.index.LuceneIndexManager) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) IndexableField(org.apache.lucene.index.IndexableField) Term(org.apache.lucene.index.Term) SearchSetupHelper(org.hibernate.search.integrationtest.backend.tck.testsupport.util.rule.SearchSetupHelper) LuceneSearchQuery(org.hibernate.search.backend.lucene.search.query.LuceneSearchQuery) LuceneExtension(org.hibernate.search.backend.lucene.LuceneExtension) LuceneSearchSortFactory(org.hibernate.search.backend.lucene.search.sort.dsl.LuceneSearchSortFactory) DoublePoint(org.apache.lucene.document.DoublePoint) Document(org.apache.lucene.document.Document) Map(java.util.Map) IndexManager(org.hibernate.search.engine.backend.index.IndexManager) StubMappingScope(org.hibernate.search.util.impl.integrationtest.mapper.stub.StubMappingScope) SortField(org.apache.lucene.search.SortField) FailureReportUtils(org.hibernate.search.util.impl.integrationtest.common.reporting.FailureReportUtils) LuceneSearchQuerySelectStep(org.hibernate.search.backend.lucene.search.query.dsl.LuceneSearchQuerySelectStep) SearchProjection(org.hibernate.search.engine.search.projection.SearchProjection) NumericDocValuesField(org.apache.lucene.document.NumericDocValuesField) LatLonPoint(org.apache.lucene.document.LatLonPoint) Explanation(org.apache.lucene.search.Explanation) Sort(org.apache.lucene.search.Sort) SortedSetSortField(org.apache.lucene.search.SortedSetSortField) MatchAllDocsQuery(org.apache.lucene.search.MatchAllDocsQuery) IndexSchemaElement(org.hibernate.search.engine.backend.document.model.dsl.IndexSchemaElement) IndexSchemaObjectField(org.hibernate.search.engine.backend.document.model.dsl.IndexSchemaObjectField) Collectors(java.util.stream.Collectors) LuceneBackend(org.hibernate.search.backend.lucene.LuceneBackend) IndexFieldReference(org.hibernate.search.engine.backend.document.IndexFieldReference) List(java.util.List) TestForIssue(org.hibernate.search.util.impl.test.annotation.TestForIssue) Aggregable(org.hibernate.search.engine.backend.types.Aggregable) SearchHitsAssert.assertThatHits(org.hibernate.search.util.impl.integrationtest.common.assertion.SearchHitsAssert.assertThatHits) Optional(java.util.Optional) LuceneSearchResult(org.hibernate.search.backend.lucene.search.query.LuceneSearchResult) LuceneSearchPredicateFactory(org.hibernate.search.backend.lucene.search.predicate.dsl.LuceneSearchPredicateFactory) IndexReader(org.apache.lucene.index.IndexReader) Projectable(org.hibernate.search.engine.backend.types.Projectable) IndexSearcher(org.apache.lucene.search.IndexSearcher) SearchLoadingContext(org.hibernate.search.engine.search.loading.spi.SearchLoadingContext) GeoPoint(org.hibernate.search.engine.spatial.GeoPoint) DocumentAssert.containsDocument(org.hibernate.search.integrationtest.backend.lucene.testsupport.util.DocumentAssert.containsDocument) StringField(org.apache.lucene.document.StringField) SearchIntegration(org.hibernate.search.engine.common.spi.SearchIntegration) SearchPredicate(org.hibernate.search.engine.search.predicate.SearchPredicate) SearchSort(org.hibernate.search.engine.search.sort.SearchSort) SearchResultAssert.assertThatQuery(org.hibernate.search.util.impl.integrationtest.common.assertion.SearchResultAssert.assertThatQuery) ObjectStructure(org.hibernate.search.engine.backend.types.ObjectStructure) ArrayList(java.util.ArrayList) MetadataFields(org.hibernate.search.backend.lucene.lowlevel.common.impl.MetadataFields) Assertions.assertThatThrownBy(org.assertj.core.api.Assertions.assertThatThrownBy) Store(org.apache.lucene.document.Field.Store) SimpleMappedIndex(org.hibernate.search.util.impl.integrationtest.mapper.stub.SimpleMappedIndex) IntPoint(org.apache.lucene.document.IntPoint) ValueConvert(org.hibernate.search.engine.search.common.ValueConvert) DocumentElement(org.hibernate.search.engine.backend.document.DocumentElement) DocumentReference(org.hibernate.search.engine.backend.common.DocumentReference) ValueWrapper(org.hibernate.search.integrationtest.backend.tck.testsupport.util.ValueWrapper) Before(org.junit.Before) TopDocs(org.apache.lucene.search.TopDocs) LuceneSearchScroll(org.hibernate.search.backend.lucene.search.query.LuceneSearchScroll) LuceneSearchQueryWhereStep(org.hibernate.search.backend.lucene.search.query.dsl.LuceneSearchQueryWhereStep) Sortable(org.hibernate.search.engine.backend.types.Sortable) EventContexts(org.hibernate.search.engine.reporting.spi.EventContexts) LuceneSearchScrollResult(org.hibernate.search.backend.lucene.search.query.LuceneSearchScrollResult) AggregationKey(org.hibernate.search.engine.search.aggregation.AggregationKey) Test(org.junit.Test) Assertions.entry(org.assertj.core.api.Assertions.entry) SearchResultAssert.assertThatResult(org.hibernate.search.util.impl.integrationtest.common.assertion.SearchResultAssert.assertThatResult) Consumer(java.util.function.Consumer) LuceneSearchQueryOptionsStep(org.hibernate.search.backend.lucene.search.query.dsl.LuceneSearchQueryOptionsStep) TermQuery(org.apache.lucene.search.TermQuery) Rule(org.junit.Rule) StubLoadingOptionsStep(org.hibernate.search.util.impl.integrationtest.mapper.stub.StubLoadingOptionsStep) SearchQuery(org.hibernate.search.engine.search.query.SearchQuery) Type(org.apache.lucene.search.SortField.Type) SortedSetSortField(org.apache.lucene.search.SortedSetSortField) StubMappingScope(org.hibernate.search.util.impl.integrationtest.mapper.stub.StubMappingScope) MatchAllDocsQuery(org.apache.lucene.search.MatchAllDocsQuery) List(java.util.List) ArrayList(java.util.ArrayList) StubLoadingOptionsStep(org.hibernate.search.util.impl.integrationtest.mapper.stub.StubLoadingOptionsStep) DocumentReference(org.hibernate.search.engine.backend.common.DocumentReference) Test(org.junit.Test)

Example 3 with LuceneSearchResult

use of org.hibernate.search.backend.lucene.search.query.LuceneSearchResult in project hibernate-search by hibernate.

the class LuceneSearchTopDocsTotalHitCountOnMatchAllDocsIT method matchAllDocs_sortByScoreDesc.

@Test
// The regression was spotted early, while introducing it in HSEARCH-4068
@TestForIssue(jiraKey = "HSEARCH-4068")
public void matchAllDocs_sortByScoreDesc() {
    LuceneSearchResult<DocumentReference> result = index.query().extension(LuceneExtension.get()).where(f -> f.matchAll()).fetch(10);
    assertThatResult(result).hasTotalHitCount(DOCUMENT_COUNT);
    TopDocs topDocs = result.topDocs();
    assertThat(topDocs.totalHits.relation).isEqualTo(TotalHits.Relation.EQUAL_TO);
    assertThat(topDocs.totalHits.value).isEqualTo(DOCUMENT_COUNT);
}
Also used : TopDocs(org.apache.lucene.search.TopDocs) BeforeClass(org.junit.BeforeClass) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) SearchSetupHelper(org.hibernate.search.integrationtest.backend.tck.testsupport.util.rule.SearchSetupHelper) Test(org.junit.Test) IndexSchemaElement(org.hibernate.search.engine.backend.document.model.dsl.IndexSchemaElement) SearchResultAssert.assertThatResult(org.hibernate.search.util.impl.integrationtest.common.assertion.SearchResultAssert.assertThatResult) LuceneExtension(org.hibernate.search.backend.lucene.LuceneExtension) StubMapperUtils(org.hibernate.search.util.impl.integrationtest.mapper.stub.StubMapperUtils) TotalHits(org.apache.lucene.search.TotalHits) IndexFieldReference(org.hibernate.search.engine.backend.document.IndexFieldReference) TestForIssue(org.hibernate.search.util.impl.test.annotation.TestForIssue) SimpleMappedIndex(org.hibernate.search.util.impl.integrationtest.mapper.stub.SimpleMappedIndex) LuceneSearchResult(org.hibernate.search.backend.lucene.search.query.LuceneSearchResult) ClassRule(org.junit.ClassRule) DocumentReference(org.hibernate.search.engine.backend.common.DocumentReference) DefaultAnalysisDefinitions(org.hibernate.search.integrationtest.backend.tck.testsupport.configuration.DefaultAnalysisDefinitions) TopDocs(org.apache.lucene.search.TopDocs) DocumentReference(org.hibernate.search.engine.backend.common.DocumentReference) Test(org.junit.Test) TestForIssue(org.hibernate.search.util.impl.test.annotation.TestForIssue)

Example 4 with LuceneSearchResult

use of org.hibernate.search.backend.lucene.search.query.LuceneSearchResult in project hibernate-search by hibernate.

the class LuceneQueryDslIT method lowLevel.

@Test
public void lowLevel() {
    with(entityManagerFactory).runInTransaction(entityManager -> {
        SearchSession searchSession = Search.session(entityManager);
        // tag::lucene-lowLevel[]
        LuceneSearchQuery<Book> query = searchSession.search(Book.class).extension(// <1>
        LuceneExtension.get()).where(f -> f.match().field("title").matching("robot")).sort(f -> f.field("title_sort")).toQuery();
        // <3>
        Sort sort = query.luceneSort();
        // <4>
        LuceneSearchResult<Book> result = query.fetch(20);
        // <5>
        TopDocs topDocs = result.topDocs();
        // end::lucene-lowLevel[]
        assertThat(result.hits()).extracting(Book::getId).containsExactly(BOOK1_ID, BOOK3_ID);
        assertThat(sort).isNotNull();
        assertThat(sort.getSort()).hasSize(1);
        assertThat(sort.getSort()[0].getType()).isEqualTo(SortField.Type.CUSTOM);
        assertThat(topDocs).isNotNull();
        assertThat(topDocs.totalHits.value).isEqualTo(2L);
        assertThat(topDocs.scoreDocs).hasSize(2);
    });
}
Also used : TopDocs(org.apache.lucene.search.TopDocs) Explanation(org.apache.lucene.search.Explanation) Search(org.hibernate.search.mapper.orm.Search) Sort(org.apache.lucene.search.Sort) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) BackendConfigurations(org.hibernate.search.documentation.testsupport.BackendConfigurations) Test(org.junit.Test) LuceneSearchQuery(org.hibernate.search.backend.lucene.search.query.LuceneSearchQuery) LuceneExtension(org.hibernate.search.backend.lucene.LuceneExtension) DocumentationSetupHelper(org.hibernate.search.documentation.testsupport.DocumentationSetupHelper) Rule(org.junit.Rule) SearchSession(org.hibernate.search.mapper.orm.session.SearchSession) EntityManagerFactory(javax.persistence.EntityManagerFactory) OrmUtils.with(org.hibernate.search.util.impl.integrationtest.mapper.orm.OrmUtils.with) LuceneSearchResult(org.hibernate.search.backend.lucene.search.query.LuceneSearchResult) SortField(org.apache.lucene.search.SortField) Before(org.junit.Before) TopDocs(org.apache.lucene.search.TopDocs) SearchSession(org.hibernate.search.mapper.orm.session.SearchSession) Sort(org.apache.lucene.search.Sort) Test(org.junit.Test)

Example 5 with LuceneSearchResult

use of org.hibernate.search.backend.lucene.search.query.LuceneSearchResult in project hibernate-search by hibernate.

the class LuceneExtensionIT method query_topDocs.

@Test
public void query_topDocs() {
    StubMappingScope scope = mainIndex.createScope();
    LuceneSearchResult<DocumentReference> result = scope.query().extension(LuceneExtension.get()).where(f -> f.matchAll()).fetchAll();
    assertThat(result.topDocs()).isNotNull();
}
Also used : SearchException(org.hibernate.search.util.common.SearchException) Backend(org.hibernate.search.engine.backend.Backend) IndexObjectFieldReference(org.hibernate.search.engine.backend.document.IndexObjectFieldReference) LuceneIndexManager(org.hibernate.search.backend.lucene.index.LuceneIndexManager) Assertions.assertThat(org.assertj.core.api.Assertions.assertThat) IndexableField(org.apache.lucene.index.IndexableField) Term(org.apache.lucene.index.Term) SearchSetupHelper(org.hibernate.search.integrationtest.backend.tck.testsupport.util.rule.SearchSetupHelper) LuceneSearchQuery(org.hibernate.search.backend.lucene.search.query.LuceneSearchQuery) LuceneExtension(org.hibernate.search.backend.lucene.LuceneExtension) LuceneSearchSortFactory(org.hibernate.search.backend.lucene.search.sort.dsl.LuceneSearchSortFactory) DoublePoint(org.apache.lucene.document.DoublePoint) Document(org.apache.lucene.document.Document) Map(java.util.Map) IndexManager(org.hibernate.search.engine.backend.index.IndexManager) StubMappingScope(org.hibernate.search.util.impl.integrationtest.mapper.stub.StubMappingScope) SortField(org.apache.lucene.search.SortField) FailureReportUtils(org.hibernate.search.util.impl.integrationtest.common.reporting.FailureReportUtils) LuceneSearchQuerySelectStep(org.hibernate.search.backend.lucene.search.query.dsl.LuceneSearchQuerySelectStep) SearchProjection(org.hibernate.search.engine.search.projection.SearchProjection) NumericDocValuesField(org.apache.lucene.document.NumericDocValuesField) LatLonPoint(org.apache.lucene.document.LatLonPoint) Explanation(org.apache.lucene.search.Explanation) Sort(org.apache.lucene.search.Sort) SortedSetSortField(org.apache.lucene.search.SortedSetSortField) MatchAllDocsQuery(org.apache.lucene.search.MatchAllDocsQuery) IndexSchemaElement(org.hibernate.search.engine.backend.document.model.dsl.IndexSchemaElement) IndexSchemaObjectField(org.hibernate.search.engine.backend.document.model.dsl.IndexSchemaObjectField) Collectors(java.util.stream.Collectors) LuceneBackend(org.hibernate.search.backend.lucene.LuceneBackend) IndexFieldReference(org.hibernate.search.engine.backend.document.IndexFieldReference) List(java.util.List) TestForIssue(org.hibernate.search.util.impl.test.annotation.TestForIssue) Aggregable(org.hibernate.search.engine.backend.types.Aggregable) SearchHitsAssert.assertThatHits(org.hibernate.search.util.impl.integrationtest.common.assertion.SearchHitsAssert.assertThatHits) Optional(java.util.Optional) LuceneSearchResult(org.hibernate.search.backend.lucene.search.query.LuceneSearchResult) LuceneSearchPredicateFactory(org.hibernate.search.backend.lucene.search.predicate.dsl.LuceneSearchPredicateFactory) IndexReader(org.apache.lucene.index.IndexReader) Projectable(org.hibernate.search.engine.backend.types.Projectable) IndexSearcher(org.apache.lucene.search.IndexSearcher) SearchLoadingContext(org.hibernate.search.engine.search.loading.spi.SearchLoadingContext) GeoPoint(org.hibernate.search.engine.spatial.GeoPoint) DocumentAssert.containsDocument(org.hibernate.search.integrationtest.backend.lucene.testsupport.util.DocumentAssert.containsDocument) StringField(org.apache.lucene.document.StringField) SearchIntegration(org.hibernate.search.engine.common.spi.SearchIntegration) SearchPredicate(org.hibernate.search.engine.search.predicate.SearchPredicate) SearchSort(org.hibernate.search.engine.search.sort.SearchSort) SearchResultAssert.assertThatQuery(org.hibernate.search.util.impl.integrationtest.common.assertion.SearchResultAssert.assertThatQuery) ObjectStructure(org.hibernate.search.engine.backend.types.ObjectStructure) ArrayList(java.util.ArrayList) MetadataFields(org.hibernate.search.backend.lucene.lowlevel.common.impl.MetadataFields) Assertions.assertThatThrownBy(org.assertj.core.api.Assertions.assertThatThrownBy) Store(org.apache.lucene.document.Field.Store) SimpleMappedIndex(org.hibernate.search.util.impl.integrationtest.mapper.stub.SimpleMappedIndex) IntPoint(org.apache.lucene.document.IntPoint) ValueConvert(org.hibernate.search.engine.search.common.ValueConvert) DocumentElement(org.hibernate.search.engine.backend.document.DocumentElement) DocumentReference(org.hibernate.search.engine.backend.common.DocumentReference) ValueWrapper(org.hibernate.search.integrationtest.backend.tck.testsupport.util.ValueWrapper) Before(org.junit.Before) TopDocs(org.apache.lucene.search.TopDocs) LuceneSearchScroll(org.hibernate.search.backend.lucene.search.query.LuceneSearchScroll) LuceneSearchQueryWhereStep(org.hibernate.search.backend.lucene.search.query.dsl.LuceneSearchQueryWhereStep) Sortable(org.hibernate.search.engine.backend.types.Sortable) EventContexts(org.hibernate.search.engine.reporting.spi.EventContexts) LuceneSearchScrollResult(org.hibernate.search.backend.lucene.search.query.LuceneSearchScrollResult) AggregationKey(org.hibernate.search.engine.search.aggregation.AggregationKey) Test(org.junit.Test) Assertions.entry(org.assertj.core.api.Assertions.entry) SearchResultAssert.assertThatResult(org.hibernate.search.util.impl.integrationtest.common.assertion.SearchResultAssert.assertThatResult) Consumer(java.util.function.Consumer) LuceneSearchQueryOptionsStep(org.hibernate.search.backend.lucene.search.query.dsl.LuceneSearchQueryOptionsStep) TermQuery(org.apache.lucene.search.TermQuery) Rule(org.junit.Rule) StubLoadingOptionsStep(org.hibernate.search.util.impl.integrationtest.mapper.stub.StubLoadingOptionsStep) SearchQuery(org.hibernate.search.engine.search.query.SearchQuery) Type(org.apache.lucene.search.SortField.Type) StubMappingScope(org.hibernate.search.util.impl.integrationtest.mapper.stub.StubMappingScope) DocumentReference(org.hibernate.search.engine.backend.common.DocumentReference) Test(org.junit.Test)

Aggregations

TopDocs (org.apache.lucene.search.TopDocs)5 Assertions.assertThat (org.assertj.core.api.Assertions.assertThat)5 LuceneExtension (org.hibernate.search.backend.lucene.LuceneExtension)5 LuceneSearchResult (org.hibernate.search.backend.lucene.search.query.LuceneSearchResult)5 Test (org.junit.Test)5 Explanation (org.apache.lucene.search.Explanation)4 Sort (org.apache.lucene.search.Sort)4 SortField (org.apache.lucene.search.SortField)4 ArrayList (java.util.ArrayList)3 List (java.util.List)3 Map (java.util.Map)3 Optional (java.util.Optional)3 Consumer (java.util.function.Consumer)3 Collectors (java.util.stream.Collectors)3 Document (org.apache.lucene.document.Document)3 DoublePoint (org.apache.lucene.document.DoublePoint)3 Store (org.apache.lucene.document.Field.Store)3 IntPoint (org.apache.lucene.document.IntPoint)3 LatLonPoint (org.apache.lucene.document.LatLonPoint)3 NumericDocValuesField (org.apache.lucene.document.NumericDocValuesField)3