File tree 2 files changed +25
-2
lines changed
2 files changed +25
-2
lines changed Original file line number Diff line number Diff line change @@ -38,6 +38,29 @@ search("App");
38
38
39
39
Combined with libraries like [ Moon] ( http://moonjs.ga ) , you can create a simple real-time search.
40
40
41
+ ### Pipeline
42
+
43
+ Wade uses a pipeline to preprocess data and search queries. By default, this pipeline will:
44
+
45
+ * Make everything lowercase
46
+ * Remove stop words
47
+
48
+ A pipeline consists of different functions that process a string and modify it in some way, and return the string.
49
+
50
+ You can easily modify the pipeline as it is available in ` Wade.pipeline ` , for example:
51
+
52
+ ``` js
53
+ // Don't preprocess at all
54
+ Wade .pipeline = [];
55
+
56
+ // Add custom processor to remove periods
57
+ Wade .pipeline .push (function (str ) {
58
+ return str .replace (/ \. / g , " " );
59
+ });
60
+ ```
61
+
62
+ All functions will be executed in the order of the pipeline (0-n) and they will be used on each document in the data.
63
+
41
64
### License
42
65
43
66
Licensed under the [ MIT License] ( https://kingpixil.github.io/license ) by [ Kabir Shah] ( https://kabir.ml )
Original file line number Diff line number Diff line change @@ -68,14 +68,14 @@ var removeStopWords = function(str) {
68
68
var Wade = function ( data ) {
69
69
var search = function ( item ) {
70
70
var data = search . data ;
71
- var keywords = item . split ( " " ) ;
71
+ var keywords = Wade . process ( item ) . split ( " " ) ;
72
72
var keywordsLength = keywords . length ;
73
73
var lengths = new Array ( keywordsLength ) ;
74
74
var tables = new Array ( keywordsLength ) ;
75
75
var results = [ ] ;
76
76
77
77
for ( var i = 0 ; i < keywordsLength ; i ++ ) {
78
- var keyword = Wade . process ( keywords [ i ] ) ;
78
+ var keyword = keywords [ i ] ;
79
79
var length = keyword . length ;
80
80
lengths [ i ] = length ;
81
81
tables [ i ] = createTable ( keyword , length ) ;
You can’t perform that action at this time.
0 commit comments