import { matchByKeywordSearch } from "./matchByKeywordSearch";
import { matchByTitleSearch } from "./matchByTitleSearch";
/**
 * Match by slug
 * Handles these two cases via delegation:
 * - org-short::custom-slug, via search: typekeyword: "slug|{identifier}" and type: {type}
 * - indexer-slug-via-title, via search: title: "%identifier.replace('-', ' ')%" and type: {type}
 * @param type
 * @param identifier
 * @param context
 * @returns
 */
export async function matchBySlug(type, identifier, context) {
    let result;
    // start by assuming this is a "hub-slug", which means we search by typekeyword
    result = await matchByKeywordSearch(type, identifier, context);
    if (result.num === 0) {
        // try searching by title - this is the deprecated "hub-indexer-slug" approach
        result = await matchByTitleSearch(type, identifier, context);
    }
    return result;
}
//# sourceMappingURL=matchBySlug.js.map