<commit_before>index = require './index'
semantic = require './semantic'

module.exports =

    'progress': get: index.progress

    'images/:doctype/:id/:file': get: index.image

    'semantic/nlp': get: semantic.executeNLP
    'semantic/around': get: semantic.findAround
    'semantic/sparql': post: semantic.executeSparql


    'debug': get: (req, res, next) ->
        require('fs').createReadStream('./log/production.log').pipe res

    'reset': get: (req, res, next) ->
        RDFStorage = require '../models/rdf_storage'
        Progress = require '../models/progress_store'
        rimraf = require '../lib/rimraf'
        fs = require 'fs'
        
        cb = (err) ->
            console.log err
            next err

        rimraf './si', (err) ->
            return cb err if err
            rimraf './matcher', (err) ->
                return cb err if err
                fs.unlink 'search-index.json', (err) ->
                    return cb err if err
                    RDFStorage.requestDestroy 'all', (err) ->
                        return cb err if err
                        Progress.requestDestroy 'byDoctype', (err) ->
                            return cb err if err
                            res.send done: 'ok'
                            process.exit 1<commit_msg>bugfix reset<commit_after>index = require './index'
semantic = require './semantic'

module.exports =

    'progress': get: index.progress

    'images/:doctype/:id/:file': get: index.image

    'semantic/nlp': get: semantic.executeNLP
    'semantic/around': get: semantic.findAround
    'semantic/sparql': post: semantic.executeSparql


    'debug': get: (req, res, next) ->
        require('fs').createReadStream('./log/production.log').pipe res

    'reset': get: (req, res, next) ->
        RDFStorage = require '../models/rdf_storage'
        Progress = require '../models/progress_store'
        rimraf = require '../lib/rimraf'
        fs = require 'fs'
        
        cb = (err) ->
            console.log err
            next err

        rimraf './si', (err) ->
            return cb err if err
            rimraf './matcher', (err) ->
                return cb err if err
                fs.unlink 'search-index.json', (err) ->
                    #return cb err if err # might not exist
                    RDFStorage.requestDestroy 'all', (err) ->
                        return cb err if err
                        Progress.requestDestroy 'byDoctype', (err) ->
                            return cb err if err
                            res.send done: 'ok'
                            process.exit 1
{'fraction_non_alphanumeric': 0.1246177370030581, 'fraction_numerical': 0.0007645259938837921, 'mean_word_length': 1.5067049808429118, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 19, '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': '3724073', 'n_tokens_mistral': 734, 'n_tokens_neox': 701, 'n_words': 197}