@@ -23,9 +23,13 @@ all available Arango Search View capabilities, including, `PHRASE` and
23
23
multi-lingual and language-specific, complex phrase, (proximity... TBD) and
24
24
tokenized search terms.
25
25
26
- For example, passing a search phrase like: `some +words -not +"phrase search"
27
- -"not these" ?"could have"` to ` buildAQL()`, will produce a query like the
28
- following (see [ this example] ( #query-example ) and those found in ` tests/ ` :
26
+ For example, passing a search phrase like:
27
+ ``` txt
28
+ some +words -not +"phrase search" -"not these" ?"could have"`
29
+ ```
30
+ to ` buildAQL() ` 's ` query ` parameter, will
31
+ produce a query like the following (see [ this example] ( #query-example ) and
32
+ those found in ` tests/ ` :
29
33
30
34
``` c
31
35
FOR doc IN view
@@ -56,10 +60,9 @@ SEARCH
56
60
OPTIONS {"collections": [ "col"] }
57
61
SORT TFIDF(doc) DESC
58
62
59
- LIMIT "phrase search" 0, "phrase search" 1
63
+ LIMIT 0, 1
60
64
RETURN doc`
61
65
```
62
- n.b. the above code block is styled with c but is .aql compatible.
63
66
64
67
This query will retrieve all documents that __include__ the term "mandatory"
65
68
AND __do not include__ the term "exclude", AND whose ranking will be boosted
@@ -70,24 +73,24 @@ retrieve all documents.
70
73
See [default query syntax](#default-query-syntax) and this schematic
71
74
[example](#example) for more details.
72
75
73
- If multiple collections are passed, the above query is essentially replicated
74
- across all collections, see examples in 'tests/cols.ts'. In the future this
75
- will also accommodate multiple key searches.
76
-
76
+ If multiple collections are passed, the above query is replicated across all
77
+ passed collections, see examples in 'tests/cols.ts'. In the future this will
78
+ also accommodate multiple key searches.
77
79
78
80
___
79
81
## setup
80
82
81
- 1) running generated AQL queries will require a working arangodb instance.
83
+ 1) running generated AQL queries will require a running arangodb instance.
82
84
83
85
## installation
84
86
currently there is only support for server-side use.
85
87
86
- 1) clone this repository in your node compatible project.
87
- __or__
88
- run `yarn add @hp4klh5/AQLqueryBuilder.js`
88
+ 1) run `yarn add @hp4klh5/AQLqueryBuilder.js`
89
89
or `npm install --save @hp4klh5/AQLqueryBuilder.js`
90
- in a directory containing a `package.json` file.
90
+ in a directory containing a `package.json` file.
91
+ __or__
92
+ clone this repository in your node compatible project.
93
+
91
94
2) import/require the exported functions
92
95
```js
93
96
// use either
@@ -124,9 +127,6 @@ AQLqueryBuilder works best as a document query tool. Leveraging ArangoSearch's
124
127
built-in language stemming analyzers allows for complex search phrases to be
125
128
run against any number of language-specific collections simultaneously.
126
129
127
- For an example of a multi-lingual document ingest/parser/indexer, please see
128
- [ ptolemy's
129
- curator] ( https://gitlab.com/HP4k1h5/nineveh/-/tree/master/ptolemy/dimitri/curator.js )
130
130
131
131
__ Example:__
132
132
``` javascript
@@ -144,7 +144,7 @@ const queryObject = {
144
144
const aqlQuery = buildAQL (queryObject)
145
145
146
146
// ... const cursor = await db.query(aqlQuery)
147
- // ... const cursor = await db.query(buildAQL(queryObject, {start:20 , end:40})
147
+ // ... const cursor = await db.query(buildAQL(queryObject, {start:21 , end:40})
148
148
```
149
149
150
150
Generate documenation with ` yarn doc && serve docs/ ` or see more examples in
@@ -159,8 +159,8 @@ will be run against
159
159
160
160
• ** collections** (required): the names of the collections indexed by @view to query
161
161
162
- • ** terms** (required): either an array of @ term interfaces or a string to be
163
- parsed by @ parseQuery
162
+ • ** terms** (required): either an array of ` term ` interfaces or a string to be
163
+ parsed by ` parseQuery `
164
164
165
165
• ** key** (optional | default: "text"): the name of the Arango document key to search
166
166
within.
183
183
"key" : " text" ,
184
184
"query" : " either a +query ?\" string for parseQuery to parse\" " ,
185
185
"query" : [
186
- {"type" : " phr" , "op" : " ?" , "val" : " \" or a list of query objects\" " },
186
+ {"type" : " phr" , "op" : " ?" , "val" : " \" !!! OR a list of query objects\" " },
187
187
{"type" : " tok" , "op" : " -" , "val" : " tokens" }
188
188
],
189
189
"filters" : [
@@ -276,10 +276,11 @@ only Document B is returned;
276
276
Document A is excluded by the phrase "buckle my shoe"
277
277
Document C does not contain the mandatory word "two"
278
278
279
-
280
279
___
280
+
281
281
## bugs
282
- plase see [ bugs] ( https://github.com/HP4k1h5/AQLqueryBuilder.js/issues/new?assignees=HP4k1h5&labels=bug&template=bug_report.md&title=basic )
282
+ please see [ bugs] ( https://github.com/HP4k1h5/AQLqueryBuilder.js/issues/new?assignees=HP4k1h5&labels=bug&template=bug_report.md&title=basic )
283
+
283
284
## contributing
284
- plase see [ ./.github/CONTRIBUTING.md]
285
+ please see [ ./.github/CONTRIBUTING.md]
285
286
0 commit comments