Skip to content

Commit 58d486c

Browse files
committed
edit: docs and changelog
1 parent 5ae1890 commit 58d486c

File tree

2 files changed

+81
-69
lines changed

2 files changed

+81
-69
lines changed

CHANGELOG.md

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,29 @@
11
# CHANGELOG
22

33
- v0.1.1
4-
- ❌ Breaking change! `buildAQL()`'s `limit` parameter no longer accepts key
5-
`end`, which has been renamed, per Arango spec, to `count`. The functionality
6-
remains the same, which is why the patch bump. Please accept my apologies
7-
for the un-semver approach. I have a personal philosophy that v0.X.X is
8-
not really subject to the standard rules of semver, but I will do my best
9-
to not present further breaking changes without upping at least the minor
10-
version.
11-
- multi-key search 🔑🗝
12-
`query.key` now accepts in addition to a string value, an array of
13-
strings over which the query is to be run. this can be useful if you
4+
- ❌ Breaking change!
5+
`buildAQL()`'s `limit` parameter no longer accepts key
6+
`end`, which has been renamed, per Arango spec, to `count`. The functionality
7+
remains the same, which is why the patch bump. Please accept my apologies
8+
for the un-semver approach. I have a personal philosophy that v0.X.X is
9+
not really subject to the standard rules of semver, but I will do my best
10+
to not present further breaking changes without upping at least the minor
11+
version. It's important for any user of the library to have a version that
12+
will be more compatible with all future versions going forward.
13+
- 🔑🗝 multi-key search
14+
this can be useful if you
1415
have multiple fields with textual information. Theoretically, each
1516
chapter of a book could be stored on its own key. Or a document could
1617
have be translated into several languages, each stored on its own key.
17-
ArangoSearch will handle the indexed fields by itself, provided the
18-
collection and analyzer pair that indexes the key are provided to
19-
`query.collections`
18+
- **There are two ways to provide multiple keys to relevant functions.**
19+
1) `query.key` now accepts in addition to a string value, an array of
20+
strings over which the query is to be run. All keys listed here will be
21+
run combined with all collections provided to `query.collections`
22+
**unless** a collection has a `keys` property of its own, in which case
23+
**only** those keys are searched against.
24+
2) `query.collections[].keys` is an optional array of key names that are
25+
indexed by `query.collections[].analyzer`. **Note** It is important that
26+
any key listed in `query.collections[].keys` be indexed by the analyzer
27+
as it will impact results if such a key does not exist.
2028

2129

README.md

Lines changed: 60 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -10,36 +10,42 @@ located [here](https://github.com/HP4k1h5/hp4k1h5.github.io/tree/main/demos/src/
1010
![search bar demonstration with schematic query
1111
interface](./img/searchbar_demo.png)
1212

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)
2424

2525
## Patch Notes
26+
2627
- 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
3734
have multiple fields with textual information. Theoretically, each
3835
chapter of a book could be stored on its own key. Or a document could
3936
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+
4349

4450
## overview
4551

@@ -136,22 +142,15 @@ const {buildAQL} = require('@hp4k1h5/AQLqueryBuilder.js')
136142
__for up-to-date documentation, run `yarn doc && serve docs/` from the project
137143
directory root.__
138144

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.
155154

156155
AQLqueryBuilder works best as a document query tool. Leveraging ArangoSearch's
157156
built-in language stemming analyzers allows for complex search phrases to be
@@ -166,7 +165,8 @@ const queryObject = {
166165
"view": "the_arango-search_view-name",
167166
"collections": [{
168167
"name": "collection_name",
169-
"analyzer": "analyzer_name"
168+
"analyzer": "analyzer_name",
169+
"keys": ["text"]
170170
}],
171171
"query": "+'query string' -for +parseQuery ?to parse"
172172
}
@@ -197,9 +197,16 @@ to query. Objects have the following shape:
197197
```json
198198
{
199199
"name": "collection-name",
200-
"analyzer": "analyzer_name"
200+
"analyzer": "analyzer_name",
201+
"keys": ["text", "summary", "notes"]
201202
}
202203
```
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`.
203210

204211
**query** (required): either an array of `term` interfaces or a query string
205212
to be parsed by `parseQuery`.
@@ -231,8 +238,9 @@ the following shape:
231238
#### limit
232239
an object with the following keys:
233240
- `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
236244
```json
237245
{"start":0, "count":10}
238246
```
@@ -248,11 +256,16 @@ and the next page would be
248256
"collections": [
249257
{
250258
"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"]
252266
}
253267
],
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",
256269
"query": [
257270
{"type": "phr", "op": "?", "val": "\"!!! OR a list of query objects\""},
258271
{"type": "phr", "op": "?", "val": "optional phrases"},
@@ -269,18 +282,9 @@ and the next page would be
269282
}
270283
```
271284

272-
___
273-
274-
275-
**end** (optional: default: 20): the 1-based inclusive ending index of the
276-
result set to result
277-
278-
279285
___
280286
### boolean search logic
281-
282287
Quoting [mit's Database Search Tips](https://libguides.mit.edu/c.php?g=175963&p=1158594):
283-
284288
> Boolean operators form the basis of mathematical sets and database logic.
285289
They connect your search words together to either narrow or broaden your
286290
set of results. The three basic boolean operators are: AND, OR, and NOT.

0 commit comments

Comments
 (0)