-
Notifications
You must be signed in to change notification settings - Fork 81
/
Copy pathapp.js
90 lines (79 loc) · 2.56 KB
/
app.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
angular.module('inquisitor.service', [])
.value('Data', {
host: "http://localhost:9200",
query:'{"query" : {"match_all": {}}}',
highlight: '"highlight":{"order" : "score", "pre_tags" : ["<span class=\'highlight\'>"],"post_tags" : ["</span>"],"fields":{',
elasticResponse: "",
elasticError: [],
currentIndex: "",
currentType: "",
mapping: {} ,
tabs:['Queries', 'Analyzers', 'Tokenizers'],
autodetectfield: false
})
.value('Analyzer', {
query: 'the quick brown fox',
analyzers: ['standard', 'simple', 'whitespace', 'stop', 'keyword', 'pattern', 'snowball'],
customAnalyzers: {},
fields: {},
currentField: {},
atext: {}
})
.value('Tokenizer', {
query: 'the quick brown fox',
tokenizers: ['standard', 'keyword', 'edgeNGram', 'nGram', 'letter', 'lowercase', 'whitespace', 'uax_url_email', 'path_hierarchy'],
ttext: {}
})
.value('Filter', {
query: 'the quick brown fox',
filters: ['standard', 'asciifolding', 'length', 'lowercase', 'nGram', 'edgeNGram',
'porterStem', 'shingle', 'stop', 'word_delimiter', 'stemmer','keyword_marker',
'kstem', 'snowball', 'phonetic', 'synonym', 'dictionary_decompounder', 'hyphenation_decompounder',
'reverse', 'elision', 'truncate', 'unique', 'trim'],
ftext: {}
});
var app = angular.module('Inquisitor', ['inquisitor.service', 'ui.bootstrap', 'ui', 'ngSanitize']);
app.factory('pubsub', function(){
var cache = {};
return {
publish: function(topic, args) {
cache[topic] && $.each(cache[topic], function() {
this.call(null, args || []);
});
},
subscribe: function(topic, callback) {
if(!cache[topic]) {
cache[topic] = [];
}
cache[topic].push(callback);
return [topic, callback];
},
unsubscribe: function(handle) {
var t = handle[0];
cache[t] && d.each(cache[t], function(idx){
if(this == handle[1]){
cache[t].splice(idx, 1);
}
});
}
}
});
app.config(function ($routeProvider) {
$routeProvider
.when('/',
{
templateUrl: "views/queries.html"
})
.when('/queries',
{
templateUrl: "views/queries.html"
})
.when('/analyzers',
{
templateUrl: "views/analyzers.html"
})
.when('/tokenizers',
{
templateUrl: "views/tokenizers.html"
});
});