org.apache.solr.core

## Class AbstractSolrEventListener

- java.lang.Object
- - org.apache.solr.core.AbstractSolrEventListener

- All Implemented Interfaces:
    SolrEventListener, NamedListInitializedPlugin
  Direct Known Subclasses:
    ExternalFileFieldReloader, QuerySenderListener

      public class AbstractSolrEventListener
      extends Object
      implements SolrEventListener

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbstractSolrEventListener(SolrCore core)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected NamedList` | `addEventParms(SolrIndexSearcher currentSearcher, NamedList nlst)` Add the `EventParams.EVENT` with either the `EventParams.NEW_SEARCHER` or `EventParams.FIRST_SEARCHER` values depending on the value of currentSearcher.
    `NamedList` | `getArgs()`
    `SolrCore` | `getCore()`
    `void` | `init(NamedList args)`
    `void` | `newSearcher(SolrIndexSearcher newSearcher, SolrIndexSearcher currentSearcher)` The searchers passed here are only guaranteed to be valid for the duration of this method call, so care should be taken not to spawn threads or asynchronous tasks with references to these searchers.
    `void` | `postCommit()`
    `void` | `postSoftCommit()`
    `String` | `toString()`

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

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

- - ### Constructor Detail

    - #### AbstractSolrEventListener

          public AbstractSolrEventListener(SolrCore core)

  - ### Method Detail

    - #### getCore

          public SolrCore getCore()

    - #### getArgs

          public NamedList getArgs()

    - #### init

          public void init(NamedList args)

      Specified by:
        `init` in interface `NamedListInitializedPlugin`

    - #### postCommit

          public void postCommit()

      Specified by:
        `postCommit` in interface `SolrEventListener`

    - #### postSoftCommit

          public void postSoftCommit()

      Specified by:
        `postSoftCommit` in interface `SolrEventListener`

    - #### newSearcher

          public void newSearcher(SolrIndexSearcher newSearcher,
                                  SolrIndexSearcher currentSearcher)

      Description copied from interface: `SolrEventListener`
      The searchers passed here are only guaranteed to be valid for the duration of this method call, so care should be taken not to spawn threads or asynchronous tasks with references to these searchers.

      Implementations should add the `EventParams.EVENT` parameter and set it to a value of either:

      - `EventParams.FIRST_SEARCHER` - First Searcher event
      - `EventParams.NEW_SEARCHER` - New Searcher event
      Sample:

              if (currentSearcher != null) {
                nlst.add(CommonParams.EVENT, CommonParams.NEW_SEARCHER);
              } else {
                nlst.add(CommonParams.EVENT, CommonParams.FIRST_SEARCHER);
              }

      Specified by:
        `newSearcher` in interface `SolrEventListener`
      Parameters:
        `newSearcher` - The new `SolrIndexSearcher` to use
        `currentSearcher` - The existing `SolrIndexSearcher`. null if this is a firstSearcher event.
      See Also:
        `addEventParms(org.apache.solr.search.SolrIndexSearcher, org.apache.solr.common.util.NamedList)`

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `Object`

    - #### addEventParms

          protected NamedList addEventParms(SolrIndexSearcher currentSearcher,
                                            NamedList nlst)

      Add the `EventParams.EVENT` with either the `EventParams.NEW_SEARCHER` or `EventParams.FIRST_SEARCHER` values depending on the value of currentSearcher.

      Makes a copy of NamedList and then adds the parameters.

      Parameters:
        `currentSearcher` - If null, add FIRST_SEARCHER, otherwise NEW_SEARCHER
        `nlst` - The named list to add the EVENT value to

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