HierarchySearchController<R>.forOccurrences constructor

HierarchySearchController<R>.forOccurrences(
  1. HierarchyService hierarchy
)

Create a controller for occurrence search on the given HierarchyService.

When the query contains glob/regex metacharacters, normalisation is skipped so that . keeps its regex meaning (use / as the hierarchy separator in regex patterns).

Implementation

factory HierarchySearchController.forOccurrences(
  HierarchyService hierarchy,
) =>
    HierarchySearchController<R>(
      searchFn: (q) => hierarchy.searchOccurrences(q) as List<R>,
      normalizeFn: (q) => HierarchyService.hasRegexChars(q)
          ? q
          : HierarchySearchResult.normalizeQuery(q),
    );