function initFacetCount() {
        _.each(settings.facets, function (facettitle, facet) {
            settings.facetStore[facet] = {};
        });
        _.each(settings.items, function (item) {
            // intialize the count to be zero
            _.each(settings.facets, function (facettitle, facet) {
                if ($.isArray(item[facet])) {
                    _.each(item[facet], function (facetitem) {
                        settings.facetStore[facet][facetitem] = settings.facetStore[facet][facetitem] || {
                            count: 0,
                            id: _.uniqueId("facet_")
                        }
                    });
                } else {
                    if (item[facet] !== undefined) {
                        settings.facetStore[facet][item[facet]] = settings.facetStore[facet][item[facet]] || {
                            count: 0,
                            id: _.uniqueId("facet_")
                        }
                    }
                }
            });
        });
        // sort it:
        _.each(settings.facetStore, function (facet, facettitle) {
            var sorted = _.keys(settings.facetStore[facettitle]).sort();
            if (settings.facetSortOption && settings.facetSortOption[facettitle]) {
                sorted = _.union(settings.facetSortOption[facettitle], sorted);
            }
            var sortedstore = {};
            _.each(sorted, function (el) {
                sortedstore[el] = settings.facetStore[facettitle][el];
            });
            settings.facetStore[facettitle] = sortedstore;
        });
    }
/**
     * initializes all facets and their individual filters
     */
initializes all facets and their individual filters
initializes all facets and their individual filters
function initFacetCount() {
        _.each(settings.facets, function (facettitle, facet) {
            settings.facetStore[facet] = {};
        });
        _.each(settings.items, function (item) {
            _.each(settings.facets, function (facettitle, facet) {
                if ($.isArray(item[facet])) {
                    _.each(item[facet], function (facetitem) {
                        settings.facetStore[facet][facetitem] = settings.facetStore[facet][facetitem] || {
                            count: 0,
                            id: _.uniqueId("facet_")
                        }
                    });
                } else {
                    if (item[facet] !== undefined) {
                        settings.facetStore[facet][item[facet]] = settings.facetStore[facet][item[facet]] || {
                            count: 0,
                            id: _.uniqueId("facet_")
                        }
                    }
                }
            });
        });
        _.each(settings.facetStore, function (facet, facettitle) {
            var sorted = _.keys(settings.facetStore[facettitle]).sort();
            if (settings.facetSortOption && settings.facetSortOption[facettitle]) {
                sorted = _.union(settings.facetSortOption[facettitle], sorted);
            }
            var sortedstore = {};
            _.each(sorted, function (el) {
                sortedstore[el] = settings.facetStore[facettitle][el];
            });
            settings.facetStore[facettitle] = sortedstore;
        });
    }
function initFacetCount ( ) { _ . each ( settings . facets , function ( facettitle , facet ) { settings . facetStore [ facet ] = { } ; } ) ; _ . each ( settings . items , function ( item ) { _ . each ( settings . facets , function ( facettitle , facet ) { if ( $ . isArray ( item [ facet ] ) ) { _ . each ( item [ facet ] , function ( facetitem ) { settings . facetStore [ facet ] [ facetitem ] = settings . facetStore [ facet ] [ facetitem ] || { count : 0 , id : _ . uniqueId ( "facet_" ) } } ) ; } else { if ( item [ facet ] !== undefined ) { settings . facetStore [ facet ] [ item [ facet ] ] = settings . facetStore [ facet ] [ item [ facet ] ] || { count : 0 , id : _ . uniqueId ( "facet_" ) } } } } ) ; } ) ; _ . each ( settings . facetStore , function ( facet , facettitle ) { var sorted = _ . keys ( settings . facetStore [ facettitle ] ) . sort ( ) ; if ( settings . facetSortOption && settings . facetSortOption [ facettitle ] ) { sorted = _ . union ( settings . facetSortOption [ facettitle ] , sorted ) ; } var sortedstore = { } ; _ . each ( sorted , function ( el ) { sortedstore [ el ] = settings . facetStore [ facettitle ] [ el ] ; } ) ; settings . facetStore [ facettitle ] = sortedstore ; } ) ; }
initializes all facets and their individual filters
initializes all facets and their individual filters
// intialize the count to be zero // sort it: