import {Map} from 'tsfun';
import { Category } from '../model/category';


const defaultFieldsToIndex = ['identifier', 'shortDescription'];


export function getFieldsToIndex(categoriesMap: Map<Category>, categoryName: string): string[] {

    return !categoriesMap[categoryName]
        ? []
        : Category.getFields(categoriesMap[categoryName])
            .filter(field => field.fulltextIndexed)
            .map(field => field.name)
            .concat(defaultFieldsToIndex);
}

import { Map } from 'tsfun';
import { Category } from '../model/category';


const defaultFieldsToIndex = ['identifier', 'shortDescription'];


export function getFieldsToIndex(categoriesMap: Map<Category>, categoryName: string): string[] {

    const fields = !categoriesMap[categoryName]
        ? []
        : Category.getFields(categoriesMap[categoryName])
            .filter(field => field.fulltextIndexed)
            .map(field => field.name);
    return fields.concat(defaultFieldsToIndex);
}

Make sure default fields are always indexed
Make sure default fields are always indexed
