File tree Expand file tree Collapse file tree 1 file changed +16
-8
lines changed Expand file tree Collapse file tree 1 file changed +16
-8
lines changed Original file line number Diff line number Diff line change @@ -49,14 +49,8 @@ function buildOPS(
49
49
if ( ! queryTerms . length ) return
50
50
51
51
/* phrases */
52
- let phrases = queryTerms
53
- . filter ( ( qT : term ) => qT . type == 'phr' )
54
- . map ( ( phrase : any ) => buildPhrase ( phrase , collections , key ) )
55
- if ( ! phrases . length ) {
56
- phrases = undefined
57
- } else {
58
- phrases = aql . join ( phrases , opWord )
59
- }
52
+ let phrases = queryTerms . filter ( ( qT : term ) => qT . type == 'phr' )
53
+ phrases = buildPhrases ( phrases , collections , key , opWord )
60
54
61
55
/* tokens */
62
56
let tokens = queryTerms . filter ( ( qT : { type : string } ) => qT . type === 'tok' )
@@ -68,6 +62,20 @@ function buildOPS(
68
62
return tokens || phrases
69
63
}
70
64
65
+ function buildPhrases (
66
+ phrases : term [ ] ,
67
+ collections : collection [ ] ,
68
+ key : string ,
69
+ opWord : string ,
70
+ ) : any {
71
+ if ( ! phrases . length ) return undefined
72
+
73
+ return aql . join (
74
+ phrases . map ( ( phrase : any ) => buildPhrase ( phrase , collections , key ) ) ,
75
+ opWord ,
76
+ )
77
+ }
78
+
71
79
function buildPhrase (
72
80
phrase : term ,
73
81
collections : collection [ ] ,
You can’t perform that action at this time.
0 commit comments