<commit_before>'use strict';

/* Services */

var materialsCommonsServices =  angular.module('materialsCommonsServices', ['ngResource']);

materialsCommonsServices.
    factory('User', function() {
        console.log("User created");
        var self = this;
        self.authenticated = false;
        self.email_address = 'Login';
        self.apikey = undefined;
        return {
            isAuthenticated: function() {
                return self.authenticated;
            },

            setAuthenticated: function(value, apikey, email_address) {
                console.log('passed apikey as argument is '+ apikey);
                self.authenticated = value;
                self.email_address = email_address;
                self.apikey = apikey;
            },

            apikey: function() {
                return self.apikey;
            },

            u: function() { return self.email_address; },

            reset_apikey: function(new_key){
                self.apikey = new_key;
                console.log("after reset api key is :" + self.apikey);

            }
        };
    });

materialsCommonsServices.factory('Mcdb', function() {

});


materialsCommonsServices.
    factory('Search', function($resource) {
    var data;
    var host_name = document.location.hostname;
    var resource_obj=  $resource('http://'+host_name+'\\:9200/mcindex/materialscommons/_search',{});

    return {
        get_all_info: function(keyword, fun) {
            //return resource_obj.get(fun)
            return resource_obj.get({q:keyword}, fun);
            //return resource_obj.get({q:keyword, "from" : 0, "size" : 8} , fun);<commit_msg>commit<commit_after>'use strict';

/* Services */

var materialsCommonsServices =  angular.module('materialsCommonsServices', ['ngResource']);

materialsCommonsServices.
    factory('User', function() {
        console.log("User created");
        var self = this;
        self.authenticated = false;
        self.email_address = 'Login';
        self.apikey = undefined;
        return {
            isAuthenticated: function() {
                return self.authenticated;
            },

            setAuthenticated: function(value, apikey, email_address) {
               // console.log('passed apikey as argument is '+ apikey);
                self.authenticated = value;
                self.email_address = email_address;
                self.apikey = apikey;
            },

            apikey: function() {
                return self.apikey;
            },

            u: function() { return self.email_address; },

            reset_apikey: function(new_key){
                self.apikey = new_key;
                //console.log("after reset api key is :" + self.apikey);

            }
        };
    });

materialsCommonsServices.factory('Mcdb', function() {

});


materialsCommonsServices.
    factory('Search', function($resource) {
    var data;
    var host_name = document.location.hostname;
    var resource_obj=  $resource('http://'+host_name+'\\:9200/mcindex/materialscommons/_search',{});

    return {
        get_all_info: function(keyword, fun) {
            //return resource_obj.get(fun)
            return resource_obj.get({q:keyword}, fun);
            //return resource_obj.get({q:keyword, "from" : 0, "size" : 8} , fun);
{'fraction_non_alphanumeric': 0.12511332728921123, 'fraction_numerical': 0.003626473254759746, 'mean_word_length': 2.056325023084026, 'pattern_counts': {'":': 0, '<': 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': '3920882', 'n_tokens_mistral': 942, 'n_tokens_neox': 890, 'n_words': 177}