import * as messages from '@cucumber/messages' ; import { Query as GherkinQuery } from '@cucumber/gherkin-utils' ; import TagSearch from '../../src/search/TagSearch' ; import TextSearch from '../../src/search/TextSearch' ; import isTagExpression from '../../src/isTagExpression' ; export default class Search { private readonly tagSearch : TagSearch ; private readonly textSearch = new TextSearch ( ) ; constructor ( private readonly gherkinQuery ) { this . tagSearch = new TagSearch ( gherkinQuery ) ; } public search ( query ) { if ( isTagExpression ( query ) ) { try { return this . tagSearch . search ( query ) ; } catch { } } return this . textSearch . search ( query ) ; } public add ( gherkinDocument ) { this . tagSearch . add ( gherkinDocument ) ; this . textSearch . add ( gherkinDocument ) ; } }