<commit_before>﻿var racer = require('racer');
var express = require('express');
var config = require('./config');
var utils = require('./utils');
var entryManagment = require('./server/entry-managment');

var store = racer.createStore({
	server: server,
	db: require('livedb-mongo')('mongodb://' + config.mongoUrl, { safe: true })
});

var serverModel = store.createModel();
serverModel.subscribe('entries', function (err) { });
serverModel.on('insert', '$queries.["entries",{},null].ids', function (idx, id) {
	entryManagment.refreshMetadata(serverModel, id);
});


var app = express();
var http = require('http');
var server = http.createServer(app);

app.use(express.static(__dirname + '/public'));
app.use(require('racer-browserchannel')(store));
app.use(express.bodyParser());

app.get('/', function (req, res) {
	res.sendfile(__dirname + '/public/index.htm');
});
<commit_msg>Simplify metadata refresh event listener path<commit_after>﻿var racer = require('racer');
var express = require('express');
var config = require('./config');
var utils = require('./utils');
var entryManagment = require('./server/entry-managment');

var store = racer.createStore({
	server: server,
	db: require('livedb-mongo')('mongodb://' + config.mongoUrl, { safe: true })
});

var serverModel = store.createModel();
serverModel.subscribe('entries', function (err) { });
serverModel.on('change', 'entries.*.metadataProvider', function (idx, id) {
	entryManagment.refreshMetadata(serverModel, id);
});
serverModel.on('change', 'entries.*.metadataId', function (idx, id) {
	entryManagment.refreshMetadata(serverModel, id);
});


var app = express();
var http = require('http');
var server = http.createServer(app);

app.use(express.static(__dirname + '/public'));
app.use(require('racer-browserchannel')(store));
app.use(express.bodyParser());

app.get('/', function (req, res) {
	res.sendfile(__dirname + '/public/index.htm');
});

{'fraction_non_alphanumeric': 0.2001044932079415, 'fraction_numerical': 0.0, 'mean_word_length': 6.253787878787879, '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': '1288922', 'n_tokens_mistral': 595, 'n_tokens_neox': 586, 'n_words': 126}