2 let termString = document.querySelector('[name=searchTerm]').value;
3 let terms = termString.split(' ');
7 termString : termString,
24 if (this.termString.slice(-1) !== " ") this.termString += ' ';
25 this.termString += term;
28 typeParse(searchString) {
29 let typeFilter = /{\s?type:\s?(.*?)\s?}/;
30 let match = searchString.match(typeFilter);
31 let type = this.search.type;
33 type.page = type.book = type.chapter = true;
36 let splitTypes = match[1].replace(/ /g, '').split('|');
37 type.page = (splitTypes.indexOf('page') !== -1);
38 type.chapter = (splitTypes.indexOf('chapter') !== -1);
39 type.book = (splitTypes.indexOf('book') !== -1);
43 let typeFilter = /{\s?type:\s?(.*?)\s?}/;
44 let type = this.search.type;
45 if (type.page === type.chapter && type.page === type.book) {
46 this.termString = this.termString.replace(typeFilter, '');
49 let selectedTypes = Object.keys(type).filter(type => {return this.search.type[type];}).join('|');
50 let typeTerm = '{type:'+selectedTypes+'}';
51 if (this.termString.match(typeFilter)) {
52 this.termString = this.termString.replace(typeFilter, typeTerm);
55 this.appendTerm(typeTerm);
59 window.location = '/search?term=' + encodeURIComponent(this.termString);
65 this.typeParse(this.termString);
69 data, computed, methods, created