@@ -10,36 +10,42 @@ located [here](https://github.com/HP4k1h5/hp4k1h5.github.io/tree/main/demos/src/
10
10
![ search bar demonstration with schematic query
11
11
interface] ( ./img/searchbar_demo.png )
12
12
13
- * [ Patch Notes] ( #patch-notes )
14
- * [ overview] ( #overview )
15
- * [ setup] ( #setup )
16
- * [ installation] ( #installation )
17
- * [ usage] ( #usage )
18
- * [ ` buildAQL() ` ] ( #buildaql() )
19
- * [ boolean search logic] ( #boolean-search-logic )
20
- * [ default query syntax] ( #default-query-syntax )
21
- * [ Example] ( #example )
22
- * [ bugs] ( #bugs )
23
- * [ contributing] ( #contributing )
13
+ - [ Patch Notes] ( #patch-notes )
14
+ - [ overview] ( #overview )
15
+ - [ setup] ( #setup )
16
+ - [ installation] ( #installation )
17
+ - [ usage] ( #usage )
18
+ - [ ` buildAQL() ` ] ( #buildaql() )
19
+ - [ boolean search logic] ( #boolean-search-logic )
20
+ - [ default query syntax] ( #default-query-syntax )
21
+ - [ Example] ( #example )
22
+ - [ bugs] ( #bugs )
23
+ - [ contributing] ( #contributing )
24
24
25
25
## Patch Notes
26
+
26
27
- v0.1.1
27
- - ❌ Breaking change! ` buildAQL() ` 's ` limit ` parameter no longer accepts key
28
- ` end ` , which has been renamed, per Arango spec, to ` count ` . The functionality
29
- remains the same, which is why the patch bump. Please accept my apologies
30
- for the un-semver approach. I have a personal philosophy that v0.X.X is
31
- not really subject to the standard rules of semver, but I will do my best
32
- to not present further breaking changes without upping at least the minor
33
- version.
34
- - multi-key search 🔑🗝
35
- ` query.key ` now accepts in addition to a string value, an array of
36
- strings over which the query is to be run. this can be useful if you
28
+ - ❌ Breaking change!
29
+ ` buildAQL() ` 's ` limit ` parameter no longer accepts key
30
+ ` end ` , which has been renamed, per Arango spec, to ` count ` . The functionality
31
+ remains the same, which is why the patch bump. Please accept my apologies.
32
+ - 🔑🗝 multi-key search
33
+ this can be useful if you
37
34
have multiple fields with textual information. Theoretically, each
38
35
chapter of a book could be stored on its own key. Or a document could
39
36
have be translated into several languages, each stored on its own key.
40
- ArangoSearch will handle the indexed fields by itself, provided the
41
- collection and analyzer pair that indexes the key are provided to
42
- ` query.collections `
37
+ - ** There are two ways to provide multiple keys to relevant functions.**
38
+ 1 ) ` query.key ` now accepts in addition to a string value, an array of
39
+ strings over which the query is to be run. All keys listed here will be
40
+ run combined with all collections provided to ` query.collections `
41
+ ** unless** a collection has a ` keys ` property of its own, in which case
42
+ ** only** those keys are searched against.
43
+ 2 ) ` query.collections[].keys ` is an optional array of key names that are
44
+ indexed by ` query.collections[].analyzer ` . ** Note** It is important that
45
+ any key listed in ` query.collections[].keys ` be indexed by the analyzer
46
+ as it will impact results if such a key does not exist.
47
+
48
+
43
49
44
50
## overview
45
51
@@ -136,22 +142,15 @@ const {buildAQL} = require('@hp4k1h5/AQLqueryBuilder.js')
136
142
__ for up-to-date documentation, run ` yarn doc && serve docs/ ` from the project
137
143
directory root.__
138
144
139
- AQLqueryBuilder aims to provide cross-collection and cross-language boolean
140
- search capabilities to the library's user. Currently, this library makes a
141
- number of assumptions about the way your data is stored and indexed, but these
142
- are hopefully compatible with a wide range of setups.
143
-
144
- The primary assumption this library makes is that the data you are trying to
145
- query against is indexed by an ArangoSearch View, and that all documents index
146
- the same exact field. This field, passed to the builder as a key on the
147
- ` query ` object passed to e.g. ` buildAQL() ` , can be indexed by any number of
148
- analyzers, and the query will target all supplied collections simultaneously.
149
- This allows for true multi-language search, provided all analyzers and
150
- indexers index the same key as all other documents in the view. While there
151
- are plans to expand on this functionality to provide multi-key search, this
152
- library is primarily built for academic and textual searches, and is ideally
153
- suited for documents like books, articles, and other media where most of the
154
- data resides in a single place, i.e. document ` key ` , or ` field ` .
145
+ AQLqueryBuilder aims to provide cross-collection and cross-language, multi-key
146
+ boolean search capabilities to the library's user.
147
+
148
+ Please ensure that the data you are trying to query against is indexed by an
149
+ ArangoSearch View. The query will target all combinations of provided
150
+ collections, analyzers and keys an simultaneously. This allows for granular
151
+ multi-language search. This library is primarily built for academic and
152
+ textual searches, and is ideally suited for documents like books, articles,
153
+ and other text-heavy media.
155
154
156
155
AQLqueryBuilder works best as a document query tool. Leveraging ArangoSearch's
157
156
built-in language stemming analyzers allows for complex search phrases to be
@@ -166,7 +165,8 @@ const queryObject = {
166
165
" view" : " the_arango-search_view-name" ,
167
166
" collections" : [{
168
167
" name" : " collection_name" ,
169
- " analyzer" : " analyzer_name"
168
+ " analyzer" : " analyzer_name" ,
169
+ " keys" : [" text" ]
170
170
}],
171
171
" query" : " +'query string' -for +parseQuery ?to parse"
172
172
}
@@ -197,9 +197,16 @@ to query. Objects have the following shape:
197
197
``` json
198
198
{
199
199
"name" : " collection-name" ,
200
- "analyzer" : " analyzer_name"
200
+ "analyzer" : " analyzer_name" ,
201
+ "keys" : [" text" , " summary" , " notes" ]
201
202
}
202
203
```
204
+ ` keys ` are optional, though if key names are provided to ` query.key ` , and
205
+ not all those keys are indexed by the collection, it is advisable to
206
+ explicitly list only those keys on documents in that collection that are
207
+ indexed by the analyzer. If a collection is indexed by multiple analyzers
208
+ please list each collection-analyzer combination along with their relevant
209
+ keys, unless a unified set of keys is provided to ` query.key ` .
203
210
204
211
• ** query** (required): either an array of ` term ` interfaces or a query string
205
212
to be parsed by ` parseQuery ` .
@@ -231,8 +238,9 @@ the following shape:
231
238
#### limit
232
239
an object with the following keys:
233
240
- ` start ` (integer) 0-based result pagination lower bound.
234
- - ` count ` (integer) total number of results to return.
235
- i.e. to bring back up to the first 10 results
241
+ - ` count ` (integer) total number of results to return. ⚠ see CHANGELOG v0.1.1
242
+
243
+ to bring back up to the first 10 results
236
244
``` json
237
245
{"start" :0 , "count" :10 }
238
246
```
@@ -248,11 +256,16 @@ and the next page would be
248
256
"collections" : [
249
257
{
250
258
"name" :" collection_name" ,
251
- "analyzer" : " analyzer_name"
259
+ "analyzer" : " analyzer_name" ,
260
+ "keys" : [" text" , " summary" , " notes" ]
261
+ },
262
+ {
263
+ "name" :" collection_es" ,
264
+ "analyzer" : " analyzer_es" ,
265
+ "keys" : [" texto" , " resumen" , " notas" ]
252
266
}
253
267
],
254
- "key" : " text" ,
255
- "query" : " either a +query ?\" string for parseQuery to parse\" " ,
268
+ "query" : " either a +query ?\" string for parseQuery to parse\" texto en español" ,
256
269
"query" : [
257
270
{"type" : " phr" , "op" : " ?" , "val" : " \" !!! OR a list of query objects\" " },
258
271
{"type" : " phr" , "op" : " ?" , "val" : " optional phrases" },
@@ -269,18 +282,9 @@ and the next page would be
269
282
}
270
283
```
271
284
272
- ___
273
-
274
-
275
- ** end** (optional: default: 20): the 1-based inclusive ending index of the
276
- result set to result
277
-
278
-
279
285
___
280
286
### boolean search logic
281
-
282
287
Quoting [ mit's Database Search Tips] ( https://libguides.mit.edu/c.php?g=175963&p=1158594 ) :
283
-
284
288
> Boolean operators form the basis of mathematical sets and database logic.
285
289
They connect your search words together to either narrow or broaden your
286
290
set of results. The three basic boolean operators are: AND, OR, and NOT.
0 commit comments