Skip to content

Reusing IndexSearcher - possible enhancement #1207

@tulinkry

Description

@tulinkry

Reusing searchers as introduced in #1186 has some drawbacks:

  1. The map of SearcherManagers grows indefinitely (however not really fast)
  2. Once project is deleted and restored again, it can't be searched without webapp restart

These problems are cause by the multithreaded application and that the configuration change can arrive at anytime.

I suggest considering following solution which should theoretically work:

  • subclass IndexSearcher and add get+set methods for an instance of SearcherManager
  • adapt the ThreadPoolSearcherFactory so it returns the new subclass
  • when acquiring new IndexSearcher from the manager, cast it to the subclass and inject the manager
  • when releasing do similarly and release the searcher

This technique should not have the problem with the unbounded map - the closed instance of SearcherManager can be removed from the map while every acquired IndexSearcher already holds the instance of SearcherManager where it should return itself. Also it should solve the problem with deleted+restored projects as SearcherManager for deleted project could be immediately removed from the map.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions