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);
}

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);
}

--- 
+++ 
@@ -1,4 +1,4 @@
-import {Map} from 'tsfun';
+import { Map } from 'tsfun';
 import { Category } from '../model/category';
 
 
@@ -7,10 +7,10 @@
 
 export function getFieldsToIndex(categoriesMap: Map<Category>, categoryName: string): string[] {
 
-    return !categoriesMap[categoryName]
+    const fields = !categoriesMap[categoryName]
         ? []
         : Category.getFields(categoriesMap[categoryName])
             .filter(field => field.fulltextIndexed)
-            .map(field => field.name)
-            .concat(defaultFieldsToIndex);
+            .map(field => field.name);
+    return fields.concat(defaultFieldsToIndex);
 }
Make sure default fields are always indexed
