<commit_before>define([
    'jquery',
    'underscore',
    'knockout',
    'knockout-mapping',
    'views/components/search/base-filter',
    'arches',
    'datatype-config-components',
    'bindings/let'
], function($, _, ko, koMapping, BaseFilter, arches) {
    var componentName = 'advanced-search';
    return ko.components.register(componentName, {
        viewModel: BaseFilter.extend({
            initialize: function(options) {
                var self = this;
                options.name = 'Advanced Search Filter';
                BaseFilter.prototype.initialize.call(this, options);
                this.searchableGraphs = ko.observableArray();
                this.datatypelookup = {};
                this.facetFilterText = ko.observable('');
                this.filter = {
                    facets: ko.observableArray()
                };

                $.ajax({
                    type: "GET",
                    url: arches.urls.api_search_component_data + componentName,
                    context: this
                }).done(function(response) {
                    this.cards = response.cards;
                    _.each(response.datatypes, function(datatype) {
                        this.datatypelookup[datatype.datatype] = datatype;
                    }, this);
                    _.each(response.cards, function(card) {
                        card.nodes = _.filter(response.nodes, function(node) {
                            return node.nodegroup_id === card.nodegroup_id;
                        });
                        card.addFacet = function() {
                            self.newFacet(card);
                        };
                    }, this);
                    var graphs = response.graphs.sort(function(a,b) {
                        return a.name.toLowerCase() > b.name.toLowerCase() ? 1 : -1;});
                    _.each(graphs, function(graph) {
                        if (graph.isresource && graph.isactive) {
                            var graphCards = _.filter(response.cards, function(card) {
                                return card.graph_id === graph.graphid && card.nodes.length > 0;
                            });
                            graphCards.sort(function(a,b) {<commit_msg>includes simple dict lookup for cardnames via nodegroupid (for top cards), and widgetlookup obj, re #6331<commit_after>define([
    'jquery',
    'underscore',
    'knockout',
    'knockout-mapping',
    'views/components/search/base-filter',
    'arches',
    'datatype-config-components',
    'bindings/let'
], function($, _, ko, koMapping, BaseFilter, arches) {
    var componentName = 'advanced-search';
    return ko.components.register(componentName, {
        viewModel: BaseFilter.extend({
            initialize: function(options) {
                var self = this;
                options.name = 'Advanced Search Filter';
                BaseFilter.prototype.initialize.call(this, options);
                this.searchableGraphs = ko.observableArray();
                this.datatypelookup = {};
                this.facetFilterText = ko.observable('');
                this.filter = {
                    facets: ko.observableArray()
                };
                this.cardNameDict = {};
                self.widgetLookup = null;

                $.ajax({
                    type: "GET",
                    url: arches.urls.api_search_component_data + componentName,
                    context: this
                }).done(function(response) {
                    this.cards = response.cards;
                    _.each(response.datatypes, function(datatype) {
                        this.datatypelookup[datatype.datatype] = datatype;
                    }, this);
                    _.each(response.cards, function(card) {
                        self.cardNameDict[card.nodegroup_id] = card.name;
                        card.nodes = _.filter(response.nodes, function(node) {
                            return node.nodegroup_id === card.nodegroup_id;
                        });
                        card.addFacet = function() {
                            self.newFacet(card);
                        };
                    }, this);
                    var graphs = response.graphs.sort(function(a,b) {
                        return a.name.toLowerCase() > b.name.toLowerCase() ? 1 : -1;});
                    _.each(graphs, function(graph) {
                        if (graph.isresource && graph.isactive) {
                            var graphCards = _.filter(response.cards, function(card) {
                                return card.graph_id === graph.graphid && card.nodes.length > 0;
                            });
                            graphCards.sort(function(a,b) {
{'fraction_non_alphanumeric': 0.11050648807032232, 'fraction_numerical': 0.002092925910422771, 'mean_word_length': 1.3472495088408645, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3018553', 'n_tokens_mistral': 1232, 'n_tokens_neox': 1156, 'n_words': 202}