Skip to content

Commit a174306

Browse files
authored
Feature/3.6/analyzers (#325)
* enhancedNgramAnalyzer and enhancedTextAnalyzer * tests fix * ArangoSearch tests bugfix * changelog upd
1 parent bff9d0e commit a174306

File tree

3 files changed

+67
-0
lines changed

3 files changed

+67
-0
lines changed

ChangeLog.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,10 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) a
66

77
## [Unreleased]
88

9+
## [6.5.0] - 2019-xx-xx
10+
11+
- enhancedNgramAnalyzer and enhancedTextAnalyzer (ArangoDB v3.6)
12+
913
## [6.4.1] - 2019-10-23
1014

1115
- jackson v2.9.10

src/test/java/com/arangodb/ArangoSearchTest.java

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -397,6 +397,34 @@ public void ngramAnalyzer() {
397397
createGetAndDeleteAnalyzer(options);
398398
}
399399

400+
@Test
401+
public void enhancedNgramAnalyzer() {
402+
assumeTrue(isAtLeastVersion(3, 6));
403+
404+
String name = "test-" + UUID.randomUUID().toString();
405+
406+
Set<AnalyzerFeature> features = new HashSet<>();
407+
features.add(AnalyzerFeature.frequency);
408+
features.add(AnalyzerFeature.norm);
409+
features.add(AnalyzerFeature.position);
410+
411+
Map<String, Object> properties = new HashMap<>();
412+
properties.put("max", 6L);
413+
properties.put("min", 3L);
414+
properties.put("preserveOriginal", true);
415+
properties.put("startMarker", "^");
416+
properties.put("endMarker", "^");
417+
properties.put("streamType", "utf8");
418+
419+
AnalyzerEntity options = new AnalyzerEntity();
420+
options.setFeatures(features);
421+
options.setName(name);
422+
options.setType(AnalyzerType.ngram);
423+
options.setProperties(properties);
424+
425+
createGetAndDeleteAnalyzer(options);
426+
}
427+
400428
@Test
401429
public void textAnalyzer() {
402430
assumeTrue(isAtLeastVersion(3, 5));
@@ -424,6 +452,39 @@ public void textAnalyzer() {
424452
createGetAndDeleteAnalyzer(options);
425453
}
426454

455+
@Test
456+
public void enhancedTextAnalyzer() {
457+
assumeTrue(isAtLeastVersion(3, 6));
458+
459+
String name = "test-" + UUID.randomUUID().toString();
460+
461+
Set<AnalyzerFeature> features = new HashSet<>();
462+
features.add(AnalyzerFeature.frequency);
463+
features.add(AnalyzerFeature.norm);
464+
features.add(AnalyzerFeature.position);
465+
466+
Map<String, Object> edgeNgram = new HashMap<>();
467+
edgeNgram.put("min", 2L);
468+
edgeNgram.put("max", 100000L);
469+
edgeNgram.put("preserveOriginal", true);
470+
471+
Map<String, Object> properties = new HashMap<>();
472+
properties.put("locale", "ru.utf-8");
473+
properties.put("case", "lower");
474+
properties.put("stopwords", Collections.emptyList());
475+
properties.put("accent", true);
476+
properties.put("stemming", true);
477+
properties.put("edgeNgram", edgeNgram);
478+
479+
AnalyzerEntity options = new AnalyzerEntity();
480+
options.setFeatures(features);
481+
options.setName(name);
482+
options.setType(AnalyzerType.text);
483+
options.setProperties(properties);
484+
485+
createGetAndDeleteAnalyzer(options);
486+
}
487+
427488
@Test
428489
public void arangoSearchOptions() {
429490
assumeTrue(isAtLeastVersion(3, 4));

src/test/java/com/arangodb/async/ArangoSearchTest.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,7 @@ public void normAnalyzer() throws ExecutionException, InterruptedException {
366366
@Test
367367
public void ngramAnalyzer() throws ExecutionException, InterruptedException {
368368
assumeTrue(isAtLeastVersion(3, 5));
369+
369370
String name = "test-" + UUID.randomUUID().toString();
370371

371372
Set<AnalyzerFeature> features = new HashSet<>();
@@ -390,6 +391,7 @@ public void ngramAnalyzer() throws ExecutionException, InterruptedException {
390391
@Test
391392
public void textAnalyzer() throws ExecutionException, InterruptedException {
392393
assumeTrue(isAtLeastVersion(3, 5));
394+
393395
String name = "test-" + UUID.randomUUID().toString();
394396

395397
Set<AnalyzerFeature> features = new HashSet<>();

0 commit comments

Comments
 (0)