org.apache.lucene.luke.models.search

## Class SearchImpl

- java.lang.Object
- - org.apache.lucene.luke.models.LukeModel
  - - org.apache.lucene.luke.models.search.SearchImpl

- All Implemented Interfaces:
    Search

      public final class SearchImpl
      extends LukeModel
      implements Search

  Default implementation of `Search`

- - ### Field Summary

    - ### Fields inherited from class org.apache.lucene.luke.models.LukeModel

      `commit, dir, liveDocs, reader`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SearchImpl(IndexReader reader)` Constructs a SearchImpl that holds given `IndexReader`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Explanation` | `explain(Query query, int docid)` Explains the document for the specified query.
    `Query` | `getCurrentQuery()` Returns the current query.
    `Collection<String>` | `getRangeSearchableFieldNames()` Returns field names those are searchable by range query.
    `Collection<String>` | `getSearchableFieldNames()` Returns field names those are searchable.
    `Collection<String>` | `getSortableFieldNames()` Returns field names those are sortable.
    `Optional<SortField>` | `getSortType(String name, String type, boolean reverse)` Returns the `SortField` for the specified field with the sort type and order.
    `List<SortField>` | `guessSortTypes(String name)` Returns possible `SortField`s for the specified field.
    `Query` | `mltQuery(int docid, MLTConfig mltConfig, Analyzer analyzer)` Creates the MoreLikeThis query for the specified document with given configurations.
    `Optional<SearchResults>` | `nextPage()` Returns the next page for the current query.
    `Query` | `parseQuery(String expression, String defField, Analyzer analyzer, QueryParserConfig config, boolean rewrite)` Parses the specified query expression with given configurations.
    `Optional<SearchResults>` | `prevPage()` Returns the previous page for the current query.
    `SearchResults` | `search(Query query, SimilarityConfig simConfig, Set<String> fieldsToLoad, int pageSize, boolean exactHitsCount)` Searches this index by the query with given configurations.
    `SearchResults` | `search(Query query, SimilarityConfig simConfig, Sort sort, Set<String> fieldsToLoad, int pageSize, boolean exactHitsCount)` Searches this index by the query with given sort criteria and configurations.

    - ### Methods inherited from class org.apache.lucene.luke.models.LukeModel

      `getFieldNames`

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

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

    - ### Methods inherited from interface org.apache.lucene.luke.models.search.Search

      `getFieldNames`

- - ### Constructor Detail

    - #### SearchImpl

          public SearchImpl(IndexReader reader)

      Constructs a SearchImpl that holds given `IndexReader`
      Parameters:
        `reader` - - the index reader

  - ### Method Detail

    - #### getSortableFieldNames

          public Collection<String> getSortableFieldNames()

      Description copied from interface: `Search`
      Returns field names those are sortable.
      Specified by:
        `getSortableFieldNames` in interface `Search`

    - #### getSearchableFieldNames

          public Collection<String> getSearchableFieldNames()

      Description copied from interface: `Search`
      Returns field names those are searchable.
      Specified by:
        `getSearchableFieldNames` in interface `Search`

    - #### getRangeSearchableFieldNames

          public Collection<String> getRangeSearchableFieldNames()

      Description copied from interface: `Search`
      Returns field names those are searchable by range query.
      Specified by:
        `getRangeSearchableFieldNames` in interface `Search`

    - #### getCurrentQuery

          public Query getCurrentQuery()

      Description copied from interface: `Search`
      Returns the current query.
      Specified by:
        `getCurrentQuery` in interface `Search`

    - #### parseQuery

          public Query parseQuery(String expression,
                                  String defField,
                                  Analyzer analyzer,
                                  QueryParserConfig config,
                                  boolean rewrite)

      Description copied from interface: `Search`
      Parses the specified query expression with given configurations.
      Specified by:
        `parseQuery` in interface `Search`
      Parameters:
        `expression` - - query expression
        `defField` - - default field for the query
        `analyzer` - - analyzer for parsing query expression
        `config` - - query parser configuration
        `rewrite` - - if true, re-written query is returned
      Returns:
        parsed query

    - #### mltQuery

          public Query mltQuery(int docid,
                                MLTConfig mltConfig,
                                Analyzer analyzer)

      Description copied from interface: `Search`
      Creates the MoreLikeThis query for the specified document with given configurations.
      Specified by:
        `mltQuery` in interface `Search`
      Parameters:
        `docid` - - document id
        `mltConfig` - - MoreLikeThis configuration
        `analyzer` - - analyzer for analyzing the document
      Returns:
        MoreLikeThis query

    - #### search

          public SearchResults search(Query query,
                                      SimilarityConfig simConfig,
                                      Set<String> fieldsToLoad,
                                      int pageSize,
                                      boolean exactHitsCount)

      Description copied from interface: `Search`
      Searches this index by the query with given configurations.
      Specified by:
        `search` in interface `Search`
      Parameters:
        `query` - - search query
        `simConfig` - - similarity configuration
        `fieldsToLoad` - - field names to load
        `pageSize` - - page size
        `exactHitsCount` - - if set to true, the exact total hits count is returned.
      Returns:
        search results

    - #### search

          public SearchResults search(Query query,
                                      SimilarityConfig simConfig,
                                      Sort sort,
                                      Set<String> fieldsToLoad,
                                      int pageSize,
                                      boolean exactHitsCount)

      Description copied from interface: `Search`
      Searches this index by the query with given sort criteria and configurations.
      Specified by:
        `search` in interface `Search`
      Parameters:
        `query` - - search query
        `simConfig` - - similarity configuration
        `sort` - - sort criteria
        `fieldsToLoad` - - fields to load
        `pageSize` - - page size
        `exactHitsCount` - - if set to true, the exact total hits count is returned.
      Returns:
        search results

    - #### nextPage

          public Optional<SearchResults> nextPage()

      Description copied from interface: `Search`
      Returns the next page for the current query.
      Specified by:
        `nextPage` in interface `Search`
      Returns:
        search results, or empty if there are no more results

    - #### prevPage

          public Optional<SearchResults> prevPage()

      Description copied from interface: `Search`
      Returns the previous page for the current query.
      Specified by:
        `prevPage` in interface `Search`
      Returns:
        search results, or empty if there are no more results.

    - #### guessSortTypes

          public List<SortField> guessSortTypes(String name)

      Description copied from interface: `Search`
      Returns possible `SortField`s for the specified field.
      Specified by:
        `guessSortTypes` in interface `Search`
      Parameters:
        `name` - - field name
      Returns:
        list of possible sort types

    - #### getSortType

          public Optional<SortField> getSortType(String name,
                                                 String type,
                                                 boolean reverse)

      Description copied from interface: `Search`
      Returns the `SortField` for the specified field with the sort type and order.
      Specified by:
        `getSortType` in interface `Search`
      Parameters:
        `name` - - field name
        `type` - - string representation for a type
        `reverse` - - if true, descending order is used
      Returns:
        sort type, or empty if the type is incompatible with the field

    - #### explain

          public Explanation explain(Query query,
                                     int docid)

      Description copied from interface: `Search`
      Explains the document for the specified query.
      Specified by:
        `explain` in interface `Search`
      Parameters:
        `query` - - query
        `docid` - - document id to be explained
      Returns:
        explanations

Copyright © 2000-2024 Apache Software Foundation. All Rights Reserved.