Class ThreadLocalSearcherCacheExtension

java.lang.Object
com.atlassian.jira.junit.extensions.ThreadLocalSearcherCacheExtension
All Implemented Interfaces:
org.junit.jupiter.api.extension.AfterEachCallback, org.junit.jupiter.api.extension.BeforeEachCallback, org.junit.jupiter.api.extension.Extension

@Internal public class ThreadLocalSearcherCacheExtension extends Object implements org.junit.jupiter.api.extension.AfterEachCallback, org.junit.jupiter.api.extension.BeforeEachCallback
Starts and stops ThreadLocalSearcherCache's searcher context before/after each test. This is required for tests that rely on ManagedIndexSearcherFactory.
Since:
10.4 Platform-specific class intended for the Lucene search platform only.

Jira Search exposes a common API backed by multiple search engines. This class bypasses that abstraction and couples callers to Lucene internals.

Using this class in platform-agnostic code, or when the runtime search platform is not Lucene (e.g. OpenSearch), may produce incorrect results or failures.

Internal use only.

  • Constructor Details

    • ThreadLocalSearcherCacheExtension

      public ThreadLocalSearcherCacheExtension()
  • Method Details

    • beforeEach

      public void beforeEach(org.junit.jupiter.api.extension.ExtensionContext context) throws Exception
      Specified by:
      beforeEach in interface org.junit.jupiter.api.extension.BeforeEachCallback
      Throws:
      Exception
    • afterEach

      public void afterEach(org.junit.jupiter.api.extension.ExtensionContext context) throws Exception
      Specified by:
      afterEach in interface org.junit.jupiter.api.extension.AfterEachCallback
      Throws:
      Exception