org.hibernate.search.elasticsearch.query.impl

## Class ElasticsearchHSQueryImpl

- java.lang.Object
- - org.hibernate.search.query.engine.impl.AbstractHSQuery
  - - org.hibernate.search.elasticsearch.query.impl.ElasticsearchHSQueryImpl

- All Implemented Interfaces:
    Serializable, ProjectionConstants, HSQuery

      public class ElasticsearchHSQueryImpl
      extends AbstractHSQuery

  Query implementation based on Elasticsearch.
  Author:
    Gunnar Morling
  See Also:
    Serialized Form

- - ### Field Summary

    - ### Fields inherited from class org.hibernate.search.query.engine.impl.AbstractHSQuery

      `extendedIntegrator, filterDefinitions, firstResult, hasThisProjection, HSEARCH_PROJECTION_FIELD_PREFIX, indexedTargetedEntities, maxResults, projectedFields, sort, spatialFieldName, spatialSearchCenter, targetedEntities, tenantId, timeoutExceptionFactory, timeoutManager, userFilter`

    - ### Fields inherited from interface org.hibernate.search.engine.ProjectionConstants

      `DOCUMENT, DOCUMENT_ID, EXPLANATION, ID, OBJECT_CLASS, SCORE, SPATIAL_DISTANCE, THIS`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ElasticsearchHSQueryImpl(com.google.gson.JsonObject rawSearchPayload, ExtendedSearchIntegrator extendedIntegrator, IndexedTypeMap<CustomTypeMetadata> types)`
    `ElasticsearchHSQueryImpl(com.google.gson.JsonObject rawSearchPayload, ExtendedSearchIntegrator extendedIntegrator, IndexedTypeSet types)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected TimeoutManagerImpl` | `buildTimeoutManager()`
    `protected void` | `clearCachedResults()`
    `protected com.google.gson.JsonObject` | `createFullTextFilter(FilterDef def, Object filterOrFactory)`
    `Explanation` | `explain(int documentId)` Return the Lucene `Explanation` object describing the score computation for the matching object/document in the current query
    `protected void` | `extractFacetResults()`
    `FacetManagerImpl` | `getFacetManager()`
    `protected Set<IndexManager>` | `getIndexManagers(EntityIndexBinding binding)`
    `Query` | `getLuceneQuery()`
    `String` | `getQueryString()`
    `protected Set<String>` | `getSupportedProjectionConstants()`
    `HSQuery` | `luceneQuery(Query query)` Defines the underlying Lucene query
    `DocumentExtractor` | `queryDocumentExtractor()` Execute the Lucene query and return a traversable object over the results.
    `List<EntityInfo>` | `queryEntityInfos()` Execute the Lucene query and return the list of `EntityInfo`s populated with metadata and projection.
    `int` | `queryResultSize()`

    - ### Methods inherited from class org.hibernate.search.query.engine.impl.AbstractHSQuery

      `afterDeserialise, buildFacetingRequestsAndMetadata, buildTargetedEntityIndexBindingsByName, createFilterInstance, disableFullTextFilter, enableFullTextFilter, filter, firstResult, getCustomTypeMetadata, getExtendedSearchIntegrator, getIndexedTargetedEntities, getProjectedFields, getTargetedEntities, getTimeoutManager, hasThisProjection, isPreQueryFilterOnly, maxResults, projection, setSpatialParameters, sort, tenantIdentifier, timeoutExceptionFactory, validateSortFields`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### ElasticsearchHSQueryImpl

          public ElasticsearchHSQueryImpl(com.google.gson.JsonObject rawSearchPayload,
                                          ExtendedSearchIntegrator extendedIntegrator,
                                          IndexedTypeSet types)

    - #### ElasticsearchHSQueryImpl

          public ElasticsearchHSQueryImpl(com.google.gson.JsonObject rawSearchPayload,
                                          ExtendedSearchIntegrator extendedIntegrator,
                                          IndexedTypeMap<CustomTypeMetadata> types)

  - ### Method Detail

    - #### luceneQuery

          public HSQuery luceneQuery(Query query)

      Description copied from interface: `HSQuery`
      Defines the underlying Lucene query
      Parameters:
        `query` - the Lucene query
      Returns:
        `this` to allow method chaining

    - #### getFacetManager

          public FacetManagerImpl getFacetManager()

      Returns:
        return the manager for all faceting related operations

    - #### getLuceneQuery

          public Query getLuceneQuery()

      Returns:
        the underlying Lucene query (if any)

    - #### getQueryString

          public String getQueryString()

      Returns:
        a String representation of the underlying query

    - #### queryDocumentExtractor

          public DocumentExtractor queryDocumentExtractor()

      Description copied from interface: `HSQuery`
      Execute the Lucene query and return a traversable object over the results. Results are lazily fetched. `ProjectionConstants.THIS` if projected is not populated. It is the responsibility of the object source integration. The returned `DocumentExtractor` must be closed by the caller to release Lucene resources.
      Returns:
        the `DocumentExtractor` instance

    - #### queryResultSize

          public int queryResultSize()

      Returns:
        the number of hits for this search

        Caution: The number of results might be slightly different from what the object source returns if the index is not in sync with the store at the time of query.

    - #### explain

          public Explanation explain(int documentId)

      Description copied from interface: `HSQuery`
      Return the Lucene `Explanation` object describing the score computation for the matching object/document in the current query
      Parameters:
        `documentId` - Lucene Document id to be explain. This is NOT the object id
      Returns:
        Lucene Explanation

    - #### clearCachedResults

          protected void clearCachedResults()

      Specified by:
        `clearCachedResults` in class `AbstractHSQuery`

    - #### buildTimeoutManager

          protected TimeoutManagerImpl buildTimeoutManager()

      Specified by:
        `buildTimeoutManager` in class `AbstractHSQuery`

    - #### queryEntityInfos

          public List<EntityInfo> queryEntityInfos()

      Description copied from interface: `HSQuery`
      Execute the Lucene query and return the list of `EntityInfo`s populated with metadata and projection. `ProjectionConstants.THIS` if projected is not populated. It is the responsibility of the object source integration.
      Returns:
        list of `EntityInfo`s populated with metadata and projection

    - #### getSupportedProjectionConstants

          protected Set<String> getSupportedProjectionConstants()

      Specified by:
        `getSupportedProjectionConstants` in class `AbstractHSQuery`
      Returns:
        the names of the projection constants supported by a specific implementation in addition to projecting actual field values. If a given projection name begins with `AbstractHSQuery.HSEARCH_PROJECTION_FIELD_PREFIX` and is not part of the set of constants returned by an implementation, an exception will be raised.

    - #### getIndexManagers

          protected Set<IndexManager> getIndexManagers(EntityIndexBinding binding)

      Overrides:
        `getIndexManagers` in class `AbstractHSQuery`

    - #### extractFacetResults

          protected void extractFacetResults()

      Specified by:
        `extractFacetResults` in class `AbstractHSQuery`

    - #### createFullTextFilter

          protected com.google.gson.JsonObject createFullTextFilter(FilterDef def,
                                                                    Object filterOrFactory)

Copyright © 2006-2017 Red Hat, Inc. All Rights Reserved