<commit_before>'use strict';

var servicesModule = require('./_index.js');

/**
 * @ngInject
 */
function SearchService($q, $http, AppSettings) {

  var service = {};

  service.getData = function(term) {
    var deferred = $q.defer();

    $http.jsonp(AppSettings.apiUrl+'search.json?callback=JSON_CALLBACK', {
      params: {q: term}
    }).success(function(data) {
        deferred.resolve(data);
    }).error(function(err, status) {
        deferred.reject(err, status);
    });

    return deferred.promise;
  };

  service.getLocationSuggestions = function(term) {
    var deferred = $q.defer();
    $http.jsonp(AppSettings.apiUrl+'suggest.json?callback=JSON_CALLBACK', {
      params: {q: term}
    }).success(function(data) {
        deferred.resolve(data);
    }).error(function(err, status) {
        deferred.reject(err, status);
    });

    return deferred.promise;
  };

  service.initData = function(paramsObj) {
    var deferred = $q.defer();
    //paramsObj.q = decodeURIComponent(paramsObj.q);
    $http.jsonp(AppSettings.apiUrl+'search.json?callback=JSON_CALLBACK', {
      params: paramsObj
    }).success(function(data) {
        deferred.resolve(data);
    }).error(function(err, status) {
        deferred.reject(err, status);
    });

    return deferred.promise;
  };

  service.retrieveImg = function(statusID) {
    var deferred = $q.defer();
    $http.jsonp(AppSettings.apiUrl+'search.json?callback=JSON_CALLBACK', {
      params: {q : 'id:' + statusID}
    }).success(function(data) {
        deferred.resolve(data);<commit_msg>Add source=geo to location suggestion query<commit_after>'use strict';

var servicesModule = require('./_index.js');

/**
 * @ngInject
 */
function SearchService($q, $http, AppSettings) {

  var service = {};

  service.getData = function(term) {
    var deferred = $q.defer();

    $http.jsonp(AppSettings.apiUrl+'search.json?callback=JSON_CALLBACK', {
      params: {q: term}
    }).success(function(data) {
        deferred.resolve(data);
    }).error(function(err, status) {
        deferred.reject(err, status);
    });

    return deferred.promise;
  };

  service.getLocationSuggestions = function(term) {
    var deferred = $q.defer();
    $http.jsonp(AppSettings.apiUrl+'suggest.json?callback=JSON_CALLBACK', {
      params: {
        q: term,
        source: "geo"
      }
    }).success(function(data) {
        deferred.resolve(data);
    }).error(function(err, status) {
        deferred.reject(err, status);
    });

    return deferred.promise;
  };

  service.initData = function(paramsObj) {
    var deferred = $q.defer();
    //paramsObj.q = decodeURIComponent(paramsObj.q);
    $http.jsonp(AppSettings.apiUrl+'search.json?callback=JSON_CALLBACK', {
      params: paramsObj
    }).success(function(data) {
        deferred.resolve(data);
    }).error(function(err, status) {
        deferred.reject(err, status);
    });

    return deferred.promise;
  };

  service.retrieveImg = function(statusID) {
    var deferred = $q.defer();
    $http.jsonp(AppSettings.apiUrl+'search.json?callback=JSON_CALLBACK', {
      params: {q : 'id:' + statusID}
    }).success(function(data) {
        deferred.resolve(data);
{'fraction_non_alphanumeric': 0.16116870876531575, 'fraction_numerical': 0.0, 'mean_word_length': 3.2680965147453085, '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': '7116987', 'n_tokens_mistral': 1040, 'n_tokens_neox': 1019, 'n_words': 158}