org.apache.lucene.luke.models.search

## Interface Search

- All Known Implementing Classes:
    SearchImpl

      public interface Search

  A dedicated interface for Luke's Search tab.

- - ### Method Summary

    All Methods Instance Methods Abstract 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>` | `getFieldNames()` Returns all field names in this index.
    `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.

- - ### Method Detail

    - #### getFieldNames

          Collection<String> getFieldNames()

      Returns all field names in this index.

    - #### getSortableFieldNames

          Collection<String> getSortableFieldNames()

      Returns field names those are sortable.

    - #### getSearchableFieldNames

          Collection<String> getSearchableFieldNames()

      Returns field names those are searchable.

    - #### getRangeSearchableFieldNames

          Collection<String> getRangeSearchableFieldNames()

      Returns field names those are searchable by range query.

    - #### getCurrentQuery

          Query getCurrentQuery()

      Returns the current query.

    - #### parseQuery

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

      Parses the specified query expression with given configurations.
      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
      Throws:
        `LukeException` - - if an internal error occurs when accessing index

    - #### mltQuery

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

      Creates the MoreLikeThis query for the specified document with given configurations.
      Parameters:
        `docid` - - document id
        `mltConfig` - - MoreLikeThis configuration
        `analyzer` - - analyzer for analyzing the document
      Returns:
        MoreLikeThis query
      Throws:
        `LukeException` - - if an internal error occurs when accessing index

    - #### search

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

      Searches this index by the query with given configurations.
      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
      Throws:
        `LukeException` - - if an internal error occurs when accessing index

    - #### search

          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.
      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
      Throws:
        `LukeException` - - if an internal error occurs when accessing index

    - #### nextPage

          Optional<SearchResults> nextPage()

      Returns the next page for the current query.
      Returns:
        search results, or empty if there are no more results
      Throws:
        `LukeException` - - if an internal error occurs when accessing index

    - #### prevPage

          Optional<SearchResults> prevPage()

      Returns the previous page for the current query.
      Returns:
        search results, or empty if there are no more results.
      Throws:
        `LukeException` - - if an internal error occurs when accessing index

    - #### explain

          Explanation explain(Query query,
                              int docid)

      Explains the document for the specified query.
      Parameters:
        `query` - - query
        `docid` - - document id to be explained
      Returns:
        explanations
      Throws:
        `LukeException` - - if an internal error occurs when accessing index

    - #### guessSortTypes

          List<SortField> guessSortTypes(String name)

      Returns possible `SortField`s for the specified field.
      Parameters:
        `name` - - field name
      Returns:
        list of possible sort types
      Throws:
        `LukeException` - - if an internal error occurs when accessing index

    - #### getSortType

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

      Returns the `SortField` for the specified field with the sort type and order.
      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
      Throws:
        `LukeException` - - if an internal error occurs when accessing index

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