Browse code

BM-13634 Fix: fix event/contact analyzers

David Phan authored on 10/10/2018 13:23:09
Showing 4 changed files
... ...
@@ -57,7 +57,6 @@ public class VCardIndexStoreTests {
57 57
 		ElasticsearchTestHelper.getInstance().beforeTest();
58 58
 		JdbcTestHelper.getInstance().beforeTest();
59 59
 
60
-		
61 60
 		SecurityContext securityContext = SecurityContext.ANONYMOUS;
62 61
 
63 62
 		ContainerStore containerHome = new ContainerStore(JdbcTestHelper.getInstance().getDataSource(),
... ...
@@ -327,6 +326,27 @@ public class VCardIndexStoreTests {
327 327
 		assertEquals(uid3, res.values.get(2));
328 328
 	}
329 329
 
330
+	@Test
331
+	public void testSearchFormatedName() {
332
+		VCardIndexStore indexStore = new VCardIndexStore(client, container);
333
+		indexStore.deleteAll();
334
+
335
+		VCard card = new VCard();
336
+		card.identification = new VCard.Identification();
337
+		card.identification.formatedName = VCard.Identification.FormatedName.create("Thomas",
338
+				Arrays.<VCard.Parameter>asList());
339
+		String uid = "test" + System.nanoTime();
340
+		Item item = Item.create(uid, UUID.randomUUID().toString());
341
+		indexStore.create(item.uid, card);
342
+
343
+		item = Item.create(uid, UUID.randomUUID().toString());
344
+		indexStore.create(item.uid, card);
345
+
346
+		refreshIndexes();
347
+		ListResult<String> res = indexStore.search(VCardQuery.create("value.identification.formatedName.value:tho"));
348
+		assertEquals(1, res.total);
349
+	}
350
+
330 351
 	private void refreshIndexes() {
331 352
 		ElasticsearchTestHelper.getInstance().getClient().admin().indices().prepareRefresh("contact").execute()
332 353
 				.actionGet();
... ...
@@ -43,7 +43,7 @@
43 43
 					}
44 44
 				},
45 45
 				"analyzer": {
46
-					"index": {
46
+					"default": {
47 47
 						"type": "custom",
48 48
 						"tokenizer": "standard",
49 49
 						"filter": [
... ...
@@ -51,7 +51,7 @@
51 51
 							"ngram_filter"
52 52
 						]
53 53
 					},
54
-					"search": {
54
+					"default_search": {
55 55
 						"type": "custom",
56 56
 						"tokenizer": "standard",
57 57
 						"filter": [
... ...
@@ -473,4 +473,17 @@ public class VEventIndexStoreTests {
473 473
 		return ItemValue.create(UUID.randomUUID().toString(), series);
474 474
 	}
475 475
 
476
+	@Test
477
+	public void testSearchSummary() {
478
+		ItemValue<VEventSeries> event = defaultVEvent();
479
+		event.value.main.summary = "kamoulox";
480
+
481
+		indexStore.create(event.uid, event.value);
482
+		indexStore.refresh();
483
+
484
+		ListResult<String> res = indexStore.search(VEventQuery.create("value.summary:kam"));
485
+
486
+		assertEquals(1, res.values.size());
487
+	}
488
+
476 489
 }
... ...
@@ -12,7 +12,7 @@
12 12
 					}
13 13
 				},
14 14
 				"analyzer": {
15
-					"index": {
15
+					"default": {
16 16
 						"type": "custom",
17 17
 						"tokenizer": "standard",
18 18
 						"filter": [
... ...
@@ -20,7 +20,7 @@
20 20
 							"ngram_filter"
21 21
 						]
22 22
 					},
23
-					"search": {
23
+					"default_search": {
24 24
 						"type": "custom",
25 25
 						"tokenizer": "standard",
26 26
 						"filter": [