<commit_before>var _ = require('lodash'),
    semver = require('semver');


exports.create = function (Arrow) {
    var min = '1.7.0';
    if (semver.lt(Arrow.Version || '0.0.1', min)) {
        throw new Error('This connector requires at least version ' + min + ' of Arrow; please run `appc use latest`.');
    }
    var Connector = Arrow.Connector,
        Capabilities = Connector.Capabilities;
    var server = Arrow.getGlobal();

    /**
     * Register a custom api endpoint with the application
     * This should be done after the app registers all Models (inlucing customsearch Model)
     */
    server.on('starting', function () {
        require('./api/searchQuery.js');
    });

    return Connector.extend({
        filename: module.filename,
        capabilities: [
            Capabilities.ConnectsToADataSource,
            Capabilities.ValidatesConfiguration,
            Capabilities.ContainsModels,
            // Capabilities.CanRetrieve
        ]
    });
};<commit_msg>check if server is defined<commit_after>var _ = require('lodash'),
    semver = require('semver');


exports.create = function(Arrow) {
    var min = '1.7.0';
    if (semver.lt(Arrow.Version || '0.0.1', min)) {
        throw new Error('This connector requires at least version ' + min + ' of Arrow; please run `appc use latest`.');
    }
    var Connector = Arrow.Connector,
        Capabilities = Connector.Capabilities;
    var server = Arrow.getGlobal();

    /**
     * Register a custom api endpoint with the application
     * This should be done after the app registers all Models (inlucing customsearch Model)
     */
    if (server) {
        server.on('starting', function() {
            require('./api/searchQuery.js');
        });
    }

    return Connector.extend({
        filename: module.filename,
        capabilities: [
            Capabilities.ConnectsToADataSource,
            Capabilities.ValidatesConfiguration,
            Capabilities.ContainsModels,
            // Capabilities.CanRetrieve
        ]
    });
};
{'fraction_non_alphanumeric': 0.1172991621488418, 'fraction_numerical': 0.005914243469689502, 'mean_word_length': 2.4232715008431702, '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': '1296034', 'n_tokens_mistral': 565, 'n_tokens_neox': 554, 'n_words': 147}