@@ -36,7 +36,7 @@ left out.
36
36
PHRASE (doc .text , " avocado dish" , " text_en" ) AND PHRASE (doc .text , " lemon" , " text_en" )
37
37
38
38
// Analyzer specified using ANALYZER()
39
- ANALYZER (PHRASE (doc .text , " avocado dish" ) AND PHRASE (doc .text , " lemon" )
39
+ ANALYZER (PHRASE (doc .text , " avocado dish" ) AND PHRASE (doc .text , " lemon" ), " text_en " )
40
40
```
41
41
42
42
Certain expressions do not require any ArangoSearch functions, such as basic
@@ -67,12 +67,13 @@ Search Functions
67
67
----------------
68
68
69
69
Search functions can be used in a [ SEARCH operation] ( operations-search.html )
70
- to form an ArangoSearch expression to filter a View. The functions control the
71
- ArangoSearch functionality without having a returnable value in AQL.
70
+ to form an ArangoSearch expression to filter a View. Most functions can also be
71
+ used without a View and the ` SEARCH ` keyword, but will then not be accelerated
72
+ by a View index.
72
73
73
74
### ANALYZER()
74
75
75
- ` ANALYZER (expr, analyzer)`
76
+ ` ANALYZER(expr, analyzer) → retVal `
76
77
77
78
Sets the Analyzer for the given search expression. The default Analyzer is
78
79
` identity ` for any ArangoSearch expression. This utility function can be used
@@ -88,8 +89,7 @@ outside of `SEARCH` operations.
88
89
89
90
- ** expr** (expression): any valid search expression
90
91
- ** analyzer** (string): name of an [ Analyzer] ( ../arangosearch-analyzers.html ) .
91
- - returns nothing: the function can only be called in a
92
- [SEARCH operation](operations-search.html) and throws an error otherwise
92
+ - returns ** retVal** (any): the expression result that it wraps
93
93
94
94
Assuming a View definition with an Analyzer whose name and type is ` delimiter ` :
95
95
@@ -170,16 +170,15 @@ FOR doc IN viewName
170
170
171
171
### BOOST()
172
172
173
- ` BOOST (expr, boost)`
173
+ ` BOOST(expr, boost) → retVal `
174
174
175
175
Override boost in the context of a search expression with a specified value,
176
176
making it available for scorer functions. By default, the context has a boost
177
177
value equal to ` 1.0 ` .
178
178
179
179
- ** expr** (expression): any valid search expression
180
180
- ** boost** (number): numeric boost value
181
- - returns nothing: the function can only be called in a
182
- [SEARCH operation](operations-search.html) and throws an error otherwise
181
+ - returns ** retVal** (any): the expression result that it wraps
183
182
184
183
``` js
185
184
FOR doc IN viewName
@@ -236,8 +235,9 @@ View definition (the default is `"none"`).
236
235
Match documents where the attribute at ** path** is present.
237
236
238
237
- ** path** (attribute path expression): the attribute to test in the document
239
- - returns nothing: the function can only be called in a
240
- [SEARCH operation](operations-search.html) and throws an error otherwise
238
+ - returns nothing: the function evaluates to a boolean, but this value cannot be
239
+ returned. The function can only be called in a search expression. It throws
240
+ an error if used outside of a [ SEARCH operation] ( operations-search.html ) .
241
241
242
242
``` js
243
243
FOR doc IN viewName
@@ -257,8 +257,9 @@ specified data type.
257
257
- ` "numeric" `
258
258
- ` "string" `
259
259
- ` "analyzer" ` (see below)
260
- - returns nothing: the function can only be called in a
261
- [SEARCH operation](operations-search.html) and throws an error otherwise
260
+ - returns nothing: the function evaluates to a boolean, but this value cannot be
261
+ returned. The function can only be called in a search expression. It throws
262
+ an error if used outside of a [ SEARCH operation] ( operations-search.html ) .
262
263
263
264
``` js
264
265
FOR doc IN viewName
@@ -276,8 +277,9 @@ by the specified **analyzer**.
276
277
- ** analyzer** (string, _ optional_ ): name of an [ Analyzer] ( ../arangosearch-analyzers.html ) .
277
278
Uses the Analyzer of a wrapping ` ANALYZER() ` call if not specified or
278
279
defaults to ` "identity" `
279
- - returns nothing: the function can only be called in a
280
- [SEARCH operation](operations-search.html) and throws an error otherwise
280
+ - returns nothing: the function evaluates to a boolean, but this value cannot be
281
+ returned. The function can only be called in a search expression. It throws
282
+ an error if used outside of a [ SEARCH operation] ( operations-search.html ) .
281
283
282
284
``` js
283
285
FOR doc IN viewName
@@ -287,7 +289,7 @@ FOR doc IN viewName
287
289
288
290
### IN_RANGE()
289
291
290
- ` IN_RANGE (path, low, high, includeLow, includeHigh)`
292
+ ` IN_RANGE(path, low, high, includeLow, includeHigh) → included `
291
293
292
294
Match documents where the attribute at ** path** is greater than (or equal to)
293
295
** low** and less than (or equal to) ** high** .
@@ -311,8 +313,7 @@ Also see [Known Issues](../release-notes-known-issues35.html#arangosearch).
311
313
the range (left-closed interval) or not (left-open interval)
312
314
- ** includeHigh** (bool): whether the maximum value shall be included in
313
315
the range (right-closed interval) or not (right-open interval)
314
- - returns nothing: the function can only be called in a
315
- [SEARCH operation](operations-search.html) and throws an error otherwise
316
+ - returns ** included** (bool): whether * value* is in the range
316
317
317
318
If * low* and * high* are the same, but * includeLow* and/or * includeHigh* is set
318
319
to ` false ` , then nothing will match. If * low* is greater than * high* nothing will
@@ -345,16 +346,16 @@ because the _f_ of _foo_ is excluded (*high* is "f" but *includeHigh* is false).
345
346
346
347
### MIN_MATCH()
347
348
348
- ` MIN_MATCH (expr1, ... exprN, minMatchCount)`
349
+ ` MIN_MATCH(expr1, ... exprN, minMatchCount) → fulfilled `
349
350
350
351
Match documents where at least ** minMatchCount** of the specified
351
352
search expressions are satisfied.
352
353
353
354
- ** expr** (expression, _ repeatable_ ): any valid search expression
354
355
- ** minMatchCount** (number): minimum number of search expressions that should
355
356
be satisfied
356
- - returns nothing: the function can only be called in a
357
- [SEARCH operation](operations-search.html) and throws an error otherwise
357
+ - returns ** fulfilled ** (bool): whether at least ** minMatchCount ** of the
358
+ specified expressions are ` true `
358
359
359
360
Assuming a View with a text Analyzer, you may use it to match documents where
360
361
the attribute contains at least two out of three tokens:
@@ -372,7 +373,7 @@ but not `{ "text": "snow fox" }` which only fulfills one of the conditions.
372
373
373
374
<small >Introduced in: v3.7.0</small >
374
375
375
- ` NGRAM_MATCH (path, target, threshold, analyzer)`
376
+ ` NGRAM_MATCH(path, target, threshold, analyzer) → fulfilled `
376
377
377
378
Match documents whose attribute value has an
378
379
[ ngram similarity] ( https://webdocs.cs.ualberta.ca/~kondrak/papers/spire05.pdf ) {: target ="_ blank"}
@@ -399,8 +400,8 @@ enabled. The `NGRAM_MATCH()` function will otherwise not find anything.
399
400
- ** threshold** (number, _ optional_ ): value between ` 0.0 ` and ` 1.0 ` . Defaults
400
401
to ` 0.7 ` if none is specified.
401
402
- ** analyzer** (string): name of an [ Analyzer] ( ../arangosearch-analyzers.html ) .
402
- - returns nothing: the function can only be called in a
403
- [SEARCH operation](operations-search.html) and throws an error otherwise
403
+ - returns ** fulfilled ** (bool): ` true ` if the evaluated ngram similarity value
404
+ is greater or equal than the specified threshold, ` false ` otherwise
404
405
405
406
Given a View indexing an attribute ` text ` , a custom ngram Analyzer ` "bigram" `
406
407
(` min: 2, max: 2, preserveOriginal: false, streamType: "utf8" ` ) and a document
@@ -475,8 +476,9 @@ array as second argument.
475
476
- ** analyzer** (string, _ optional_ ): name of an [ Analyzer] ( ../arangosearch-analyzers.html ) .
476
477
Uses the Analyzer of a wrapping ` ANALYZER() ` call if not specified or
477
478
defaults to ` "identity" `
478
- - returns nothing: the function can only be called in a
479
- [SEARCH operation](operations-search.html) and throws an error otherwise
479
+ - returns nothing: the function evaluates to a boolean, but this value cannot be
480
+ returned. The function can only be called in a search expression. It throws
481
+ an error if used outside of a [ SEARCH operation] ( operations-search.html ) .
480
482
481
483
{% hint 'info' %}
482
484
The selected Analyzer must have the ` "position" ` and ` "frequency" ` features
@@ -618,7 +620,7 @@ FOR doc IN myView SEARCH PHRASE(doc.title,
618
620
619
621
### STARTS_WITH()
620
622
621
- ` STARTS_WITH (path, prefix)`
623
+ ` STARTS_WITH(path, prefix) → startsWith `
622
624
623
625
Match the value of the attribute that starts with * prefix* . If the attribute
624
626
is processed by a tokenizing Analyzer (type ` "text" ` or ` "delimiter" ` ) or if it
@@ -636,10 +638,10 @@ Also see [Known Issues](../release-notes-known-issues35.html#arangosearch).
636
638
- ** path** (attribute path expression): the path of the attribute to compare
637
639
against in the document
638
640
- ** prefix** (string): a string to search at the start of the text
639
- - returns nothing: the function can only be called in a
640
- [SEARCH operation](operations-search.html) and throws an error otherwise
641
+ - returns ** startsWith ** (bool): whether the specified attribute starts with
642
+ the given prefix
641
643
642
- ` STARTS_WITH (path, prefixes, minMatchCount)`
644
+ ` STARTS_WITH(path, prefixes, minMatchCount) → startsWith `
643
645
644
646
<small >Introduced in: v3.7.1</small >
645
647
@@ -651,8 +653,8 @@ optionally with at least *minMatchCount* of the prefixes.
651
653
- ** prefixes** (array): an array of strings to search at the start of the text
652
654
- ** minMatchCount** (number, _ optional_ ): minimum number of search prefixes
653
655
that should be satisfied. The default is ` 1 `
654
- - returns nothing: the function can only be called in a
655
- [SEARCH operation](operations-search.html) and throws an error otherwise
656
+ - returns ** startsWith ** (bool): whether the specified attribute starts with at
657
+ least * minMatchCount * of the given prefixes
656
658
657
659
To match a document ` { "text": "lorem ipsum..." } ` using a prefix and the
658
660
` "identity" ` Analyzer you can use it like this:
@@ -723,7 +725,7 @@ FOR doc IN viewName
723
725
724
726
<small >Introduced in: v3.7.0</small >
725
727
726
- ` LEVENSHTEIN_MATCH (path, target, distance, transpositions, maxTerms)`
728
+ ` LEVENSHTEIN_MATCH(path, target, distance, transpositions, maxTerms) → fulfilled `
727
729
728
730
Match documents with a [ Damerau-Levenshtein distance] ( https://en.wikipedia.org/wiki/Damerau%E2%80%93Levenshtein_distance ) {: target =_ "blank"}
729
731
lower than or equal to * distance* between the stored attribute value and
@@ -743,6 +745,8 @@ if you want to calculate the edit distance of two strings.
743
745
- ** maxTerms** (number, _ optional_ ): consider only a specified number of the
744
746
most relevant terms. One can pass ` 0 ` to consider all matched terms, but it may
745
747
impact performance negatively. The default value is ` 64 ` .
748
+ - returns ** fulfilled** (bool): ` true ` if the calculated distance is less than
749
+ or equal to * distance* , ` false ` otherwise
746
750
747
751
The Levenshtein distance between _ quick_ and _ quikc_ is ` 2 ` because it requires
748
752
two operations to go from one to the other (remove _ k_ , insert _ k_ at a
@@ -781,7 +785,7 @@ FOR doc IN viewName
781
785
782
786
<small >Introduced in: v3.7.2</small >
783
787
784
- ` LIKE (path, search)`
788
+ ` LIKE(path, search) → bool `
785
789
786
790
Check whether the pattern * search* is contained in the attribute denoted by * path* ,
787
791
using wildcard matching.
@@ -792,6 +796,8 @@ using wildcard matching.
792
796
` % ` (meaning any sequence of characters, including none) and ` _ ` (any single
793
797
character). Literal ` % ` and ` _ ` must be escaped with two backslashes (four
794
798
in arangosh).
799
+ - returns ** bool** (bool): ` true ` if the pattern is contained in * text* ,
800
+ and ` false ` otherwise
795
801
796
802
``` js
797
803
FOR doc IN viewName
@@ -811,6 +817,80 @@ FOR doc IN viewName
811
817
812
818
See [ String Functions] ( functions-string.html#tokens ) .
813
819
820
+ Geo functions
821
+ -------------
822
+
823
+ ### GEO_CONTAINS()
824
+
825
+ <small >Introduced in: v3.8.0</small >
826
+
827
+ ` GEO_CONTAINS(geoJsonA, geoJsonB) → bool `
828
+
829
+ Checks whether the [ GeoJSON object] ( ../indexing-geo.html#geojson ) * geoJsonA*
830
+ fully contains * geoJsonB* (every point in B is also in A).
831
+
832
+ - ** geoJsonA** (object\| array): first GeoJSON object or coordinate array
833
+ (in longitude, latitude order)
834
+ - ** geoJsonB** (object\| array): second GeoJSON object or coordinate array
835
+ (in longitude, latitude order)
836
+ - returns ** bool** (bool): ` true ` when every point in B is also contained in A,
837
+ ` false ` otherwise
838
+
839
+ ### GEO_DISTANCE()
840
+
841
+ <small >Introduced in: v3.8.0</small >
842
+
843
+ ` GEO_DISTANCE(geoJsonA, geoJsonB) → distance `
844
+
845
+ Return the distance between two [ GeoJSON objects] ( ../indexing-geo.html#geojson ) ,
846
+ measured from the ** centroid** of each shape.
847
+
848
+ - ** geoJsonA** (object\| array): first GeoJSON object or coordinate array
849
+ (in longitude, latitude order)
850
+ - ** geoJsonB** (object\| array): second GeoJSON object or coordinate array
851
+ (in longitude, latitude order)
852
+ - returns ** distance** (number): the distance between the centroid points of
853
+ the two objects on the reference ellipsoid
854
+
855
+ ### GEO_IN_RANGE()
856
+
857
+ <small >Introduced in: v3.8.0</small >
858
+
859
+ ` GEO_IN_RANGE(geoJsonA, geoJsonB, low, high, includeLow, includeHigh) → bool `
860
+
861
+ Checks whether the distance between two [ GeoJSON objects] ( ../indexing-geo.html#geojson )
862
+ lies within a given interval. The distance is measured from the ** centroid** of
863
+ each shape.
864
+
865
+ - ** geoJsonA** (object\| array): first GeoJSON object or coordinate array
866
+ (in longitude, latitude order)
867
+ - ** geoJsonB** (object\| array): second GeoJSON object or coordinate array
868
+ (in longitude, latitude order)
869
+ - ** low** (number): minimum value of the desired range
870
+ - ** high** (number): maximum value of the desired range
871
+ - ** includeLow** (bool, optional): whether the minimum value shall be included
872
+ in the range (left-closed interval) or not (left-open interval). The default
873
+ value is ` true `
874
+ - ** includeHigh** (bool): whether the maximum value shall be included in the
875
+ range (right-closed interval) or not (right-open interval). The default value
876
+ is ` true `
877
+ - returns ** bool** (bool): whether the evaluated distance lies within the range
878
+
879
+ ### GEO_INTERSECTS()
880
+
881
+ <small >Introduced in: v3.8.0</small >
882
+
883
+ ` GEO_INTERSECTS(geoJsonA, geoJsonB) → bool `
884
+
885
+ Checks whether the [ GeoJSON object] ( ../indexing-geo.html#geojson ) * geoJsonA*
886
+ intersects with * geoJsonB* (i.e. at least one point of B is in A or vice versa).
887
+
888
+ - ** geoJsonA** (object\| array): first GeoJSON object or coordinate array
889
+ (in longitude, latitude order)
890
+ - ** geoJsonB** (object\| array): second GeoJSON object or coordinate array
891
+ (in longitude, latitude order)
892
+ - returns ** bool** (bool): ` true ` if A and B intersect, ` false ` otherwise
893
+
814
894
Scoring Functions
815
895
-----------------
816
896
0 commit comments