org.appng.search.searcher

## Class StandardSearcher

- java.lang.Object
- - org.appng.search.searcher.StandardSearcher

- All Implemented Interfaces:
    SearchProvider

      public class StandardSearcher
      extends Object
      implements SearchProvider

- - ### Field Summary

    - ### Fields inherited from interface org.appng.search.SearchProvider

      `MAX_HITS`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `StandardSearcher()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Iterable<Document>` | `doSearch(Environment env, Site site, Application application, org.apache.lucene.store.Directory directory, String term, String language, String[] parseFields, org.apache.lucene.analysis.Analyzer analyzer, String highlightWith, Map<String,String> parameters)` Performs the actual search
    `protected org.apache.lucene.search.Query` | `getQuery(String[] parseFields, String searchTerm, org.apache.lucene.analysis.Analyzer analyzer, String language, String[] excludeTypes)`
    `String` | `getSearchTerm(String searchTerm, String searchTermTransform)`

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

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

- - ### Constructor Detail

    - #### StandardSearcher

          public StandardSearcher()

  - ### Method Detail

    - #### doSearch

          public Iterable<Document> doSearch(Environment env,
                                             Site site,
                                             Application application,
                                             org.apache.lucene.store.Directory directory,
                                             String term,
                                             String language,
                                             String[] parseFields,
                                             org.apache.lucene.analysis.Analyzer analyzer,
                                             String highlightWith,
                                             Map<String,String> parameters)
                                      throws IOException

      Description copied from interface: `SearchProvider`
      Performs the actual search
      Specified by:
        `doSearch` in interface `SearchProvider`
      Parameters:
        `env` - the current `Environment`
        `site` - the current `Site`
        `application` - the current `Application`
        `directory` - the `Directory` representing the current `Site`'s Lucene index.
        Note that it only makes sense to use this directory for searching if the `Application` also contributes some `Document`s to the `Site`'s global index by using `FeatureProvider.getIndexer()` or implementing `DocumentProvider`. Otherwise, the `Application` might have it's own Lucene index or even get the `Document`s from somewhere else (for example from the database or filesystem).
        `term` - the search term
        `language` - the language for the search
        `parseFields` - the fields to search
        `analyzer` - the `Analyzer` to use
        `highlightWith` - a tagname to highlight fragments with, e.g `span` or `div`
        `parameters` - some custom parameters for this search
      Returns:
        an `Iterable`<`Document`> containing the found `Document`s
      Throws:
        `IOException` - if an error occurs while searching

    - #### getQuery

          protected org.apache.lucene.search.Query getQuery(String[] parseFields,
                                                            String searchTerm,
                                                            org.apache.lucene.analysis.Analyzer analyzer,
                                                            String language,
                                                            String[] excludeTypes)
                                                     throws org.apache.lucene.queryparser.classic.ParseException

      Throws:
        `org.apache.lucene.queryparser.classic.ParseException`

    - #### getSearchTerm

          public String getSearchTerm(String searchTerm,
                                      String searchTermTransform)

Copyright © 2011–2023 aiticon GmbH. All rights reserved.