<commit_before>/**
 * This model is used to store the state of a search query, and implements the
 * search filtering logic.
 */
cinema.models.SearchModel = Backbone.Model.extend({
    constructor: function (settings) {
        Backbone.Model.apply(this, arguments);

        this.layerModel = settings.layerModel;
        this.visModel = settings.visModel;
        this.query = settings.query || {};
    },

    /**
     * Convert a query string into a query object that can be used to filter
     * results in this model.
     */
    parseQuery: function (str) {
        try {
            //str = '{' + str.trim() + '}';
            console.log(str);
            var parse_tree = jsep(str);
            console.log(parse_tree);
            return $.parseJSON(str.replace(/(['"])?([a-zA-Z0-9_]+)(['"])?:/g, '"$2":'));
        } catch (e) {
            return null;
        }
    },
<commit_msg>partial traverse of parse tree.<commit_after>/**
 * This model is used to store the state of a search query, and implements the
 * search filtering logic.
 */
cinema.models.SearchModel = Backbone.Model.extend({
    constructor: function (settings) {
        Backbone.Model.apply(this, arguments);

        this.layerModel = settings.layerModel;
        this.visModel = settings.visModel;
        this.query = settings.query || {};
    },

    /**
     * Convert a query string into a query object that can be used to filter
     * results in this model.
     */
    parseQuery: function (str) {
        try {
            var parse_tree = jsep(str);
            this.traverseParseTree(parse_tree);
        } catch (e) {
            return null;
        }
    },

    traverseParseTree: function (tree) {
        var str = "";
        console.log(tree.left, tree.right);
        if (tree.right.right) {
            this.traverseParseTree(tree.right);
        }
        else {
            if (tree.left.type === "Identifier" ) {
                str = str + tree.left.name;
            }
            console.log(tree.left.value,tree.operator,tree.right.value);
        }
    },

{'fraction_non_alphanumeric': 0.13001449975833737, 'fraction_numerical': 0.0014499758337361043, 'mean_word_length': 1.9403409090909092, 'pattern_counts': {'":': 1, '<': 3, '<?xml version=': 0, '>': 3, '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': '2748040', 'n_tokens_mistral': 596, 'n_tokens_neox': 586, 'n_words': 152}