Class ProjectingLuceneTemplate

All Implemented Interfaces:
Aware, BeanClassLoaderAware, BeanFactoryAware, InitializingBean, LuceneOperations, ProjectingLuceneOperations

public class ProjectingLuceneTemplate extends ProjectingLuceneAccessor
ProjectingLuceneTemplate is a Lucene data access operations class encapsulating functionality for performing Lucene queries and other Lucene data access operations and returning the query results as application-specific domain object views.
Since:
1.1.0
Author:
John Blum
See Also:
  • Constructor Details

    • ProjectingLuceneTemplate

      public ProjectingLuceneTemplate()
      Constructs a default, uninitialized instance of the ProjectingLuceneTemplate.
    • ProjectingLuceneTemplate

      public ProjectingLuceneTemplate(LuceneIndex luceneIndex)
      Constructs an instance of the ProjectingLuceneTemplate initialized with the given LuceneIndex used to perform Lucene queries (searches).
      Parameters:
      luceneIndex - LuceneIndex used in Lucene queries.
      See Also:
    • ProjectingLuceneTemplate

      public ProjectingLuceneTemplate(String indexName, Region<?,?> region)
      Constructs an instance of the ProjectingLuceneTemplate initialized with the given Lucene index name and Region reference upon which Lucene queries are executed.
      Parameters:
      indexName - String containing the name of the LuceneIndex used in Lucene queries.
      region - Region on which Lucene queries are executed.
      See Also:
    • ProjectingLuceneTemplate

      public ProjectingLuceneTemplate(String indexName, String regionPath)
      Constructs an instance of the ProjectingLuceneTemplate initialized with the given Lucene index name and Region reference upon which Lucene queries are executed.
      Parameters:
      indexName - String containing the name of the LuceneIndex used in Lucene queries.
      regionPath - String containing the name of the Region on which Lucene queries are executed.
  • Method Details

    • query

      public <T> List<T> query(String query, String defaultField, int resultLimit, Class<T> projectionType)
      Description copied from interface: ProjectingLuceneOperations
      Executes the given query with the limited results projected as instances of the projectionType.
      Type Parameters:
      T - Class type of the projection.
      Parameters:
      query - Lucene query to execute.
      defaultField - String specifying the default field used in Lucene queries when a field is not explicitly defined in the Lucene query clause.
      resultLimit - limit on the number of query results to return.
      projectionType - Class type of the individual elements in the query results.
      Returns:
      a List of Lucene query results projected as instances of projectionType.
      See Also:
    • query

      public <T> Page<T> query(String query, String defaultField, int resultLimit, int pageSize, Class<T> projectionType)
      Description copied from interface: ProjectingLuceneOperations
      Executes the given query with the limited results projected as instances of the projectionType.
      Type Parameters:
      T - Class type of the projection.
      Parameters:
      query - Lucene query to execute.
      defaultField - String specifying the default field used in Lucene queries when a field is not explicitly defined in the Lucene query clause.
      resultLimit - limit on the number of query results to return.
      pageSize - number of results on a Page.
      projectionType - Class type of the individual elements in the query results.
      Returns:
      the first Page of results returned from the Lucene query.
      See Also:
    • query

      public <T> List<T> query(LuceneQueryProvider queryProvider, int resultLimit, Class<T> projectionType)
      Description copied from interface: ProjectingLuceneOperations
      Executes the provided query with the limited results projected as instances of the projectionType.
      Type Parameters:
      T - Class type of the projection.
      Parameters:
      queryProvider - LuceneQueryProvider providing the Lucene query to execute.
      resultLimit - limit on the number of query results to return.
      projectionType - Class type of the individual elements in the query results.
      Returns:
      a List of Lucene query results projected as instances of projectionType.
      See Also:
    • query

      public <T> Page<T> query(LuceneQueryProvider queryProvider, int resultLimit, int pageSize, Class<T> projectionType)
      Description copied from interface: ProjectingLuceneOperations
      Executes the provided query with the limited results projected as instances of the projectionType.
      Type Parameters:
      T - Class type of the projection.
      Parameters:
      queryProvider - LuceneQueryProvider providing the Lucene query to execute.
      resultLimit - limit on the number of query results to return.
      pageSize - number of results on a Page.
      projectionType - Class type of the individual elements in the query results.
      Returns:
      the first Page of results returned from the Lucene query.
      See Also: