~ubuntu-branches/debian/sid/golang-github-blevesearch-bleve/sid

« back to all changes in this revision

Viewing changes to test/tests/basic/searches.json

  • Committer: Package Import Robot
  • Author(s): Michael Lustfield
  • Date: 2017-03-30 16:06:03 UTC
  • Revision ID: package-import@ubuntu.com-20170330160603-0oogmb960l7918jx
Tags: upstream-0.5.0+git20170324.202.4702785f
ImportĀ upstreamĀ versionĀ 0.5.0+git20170324.202.4702785f

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
[
 
2
        {
 
3
                "search": {
 
4
                        "from": 0,
 
5
                        "size": 10,
 
6
                        "query": {
 
7
                                "field": "name",
 
8
                                "term": "marti"
 
9
                        }
 
10
                },
 
11
                "result": {
 
12
                        "total_hits": 1,
 
13
                        "hits": [
 
14
                                {
 
15
                                        "id": "a"
 
16
                                }
 
17
                        ]
 
18
                }
 
19
        },
 
20
        {
 
21
                "search": {
 
22
                        "from": 0,
 
23
                        "size": 10,
 
24
                        "query": {
 
25
                                "field": "name",
 
26
                                "term": "noone"
 
27
                        }
 
28
                },
 
29
                "result": {
 
30
                        "total_hits": 0,
 
31
                        "hits": []
 
32
                }
 
33
        },
 
34
        {
 
35
                "search": {
 
36
                        "from": 0,
 
37
                        "size": 10,
 
38
                        "query": {
 
39
                                "match_phrase": "long name"
 
40
                        }
 
41
                },
 
42
                "result": {
 
43
                        "total_hits": 1,
 
44
                        "hits": [
 
45
                                {
 
46
                                        "id": "b"
 
47
                                }
 
48
                        ]
 
49
                }
 
50
        },
 
51
        {
 
52
                "search": {
 
53
                        "from": 0,
 
54
                        "size": 10,
 
55
                        "query": {
 
56
                                "field": "name",
 
57
                                "term": "walking"
 
58
                        }
 
59
                },
 
60
                "result": {
 
61
                        "total_hits": 0,
 
62
                        "hits": []
 
63
                }
 
64
        },
 
65
        {
 
66
                "search": {
 
67
                        "from": 0,
 
68
                        "size": 10,
 
69
                        "query": {
 
70
                                "fuzziness": 0,
 
71
                                "prefix_length": 0,
 
72
                                "field": "name",
 
73
                                "match": "walking"
 
74
                        }
 
75
                },
 
76
                "result": {
 
77
                        "total_hits": 1,
 
78
                        "hits": [
 
79
                                {
 
80
                                        "id": "c"
 
81
                                }
 
82
                        ]
 
83
                }
 
84
        },
 
85
        {
 
86
                "search": {
 
87
                        "from": 0,
 
88
                        "size": 10,
 
89
                        "query": {
 
90
                                "field": "name",
 
91
                                "prefix": "bobble"
 
92
                        }
 
93
                },
 
94
                "result": {
 
95
                        "total_hits": 1,
 
96
                        "hits": [
 
97
                                {
 
98
                                        "id": "d"
 
99
                                }
 
100
                        ]
 
101
                }
 
102
        },
 
103
        {
 
104
                "search": {
 
105
                        "from": 0,
 
106
                        "size": 10,
 
107
                        "query": {
 
108
                                "query": "+name:phone"
 
109
                        }
 
110
                },
 
111
                "result": {
 
112
                        "total_hits": 1,
 
113
                        "hits": [
 
114
                                {
 
115
                                        "id": "d"
 
116
                                }
 
117
                        ]
 
118
                }
 
119
        },
 
120
        {
 
121
                "search": {
 
122
                        "from": 0,
 
123
                        "size": 10,
 
124
                        "query": {
 
125
                                "field": "age",
 
126
                                "max": 30
 
127
                        }
 
128
                },
 
129
                "result": {
 
130
                        "total_hits": 2,
 
131
                        "hits": [
 
132
                                {
 
133
                                        "id": "a"
 
134
                                },
 
135
                                {
 
136
                                        "id": "b"
 
137
                                }
 
138
                        ]
 
139
                }
 
140
        },
 
141
        {
 
142
                "search": {
 
143
                        "from": 0,
 
144
                        "size": 10,
 
145
                        "query": {
 
146
                                "field": "age",
 
147
                                "max": 30,
 
148
                                "min": 20
 
149
                        }
 
150
                },
 
151
                "result": {
 
152
                        "total_hits": 1,
 
153
                        "hits": [
 
154
                                {
 
155
                                        "id": "b"
 
156
                                }
 
157
                        ]
 
158
                }
 
159
        },
 
160
        {
 
161
                "search": {
 
162
                        "from": 0,
 
163
                        "size": 10,
 
164
                        "query": {
 
165
                                "conjuncts": [
 
166
                                        {
 
167
                                                "boost": 1,
 
168
                                                "field": "age",
 
169
                                                "min": 20
 
170
                                        },
 
171
                                        {
 
172
                                                "boost": 1,
 
173
                                                "field": "age",
 
174
                                                "max": 30
 
175
                                        }
 
176
                                ]
 
177
                        }
 
178
                },
 
179
                "result": {
 
180
                        "total_hits": 1,
 
181
                        "hits": [
 
182
                                {
 
183
                                        "id": "b"
 
184
                                }
 
185
                        ]
 
186
                }
 
187
        },
 
188
        {
 
189
                "search": {
 
190
                        "from": 0,
 
191
                        "size": 10,
 
192
                        "query": {
 
193
                                "field": "birthday",
 
194
                                "start": "2010-01-01"
 
195
                        }
 
196
                },
 
197
                "result": {
 
198
                        "total_hits": 2,
 
199
                        "hits": [
 
200
                                {
 
201
                                        "id": "c"
 
202
                                },
 
203
                                {
 
204
                                        "id": "d"
 
205
                                }
 
206
                        ]
 
207
                }
 
208
        },
 
209
        {
 
210
                "search": {
 
211
                        "from": 0,
 
212
                        "size": 10,
 
213
                        "query": {
 
214
                                "field": "birthday",
 
215
                                "end": "2010-01-01"
 
216
                        }
 
217
                },
 
218
                "result": {
 
219
                        "total_hits": 1,
 
220
                        "hits": [
 
221
                                {
 
222
                                        "id": "b"
 
223
                                }
 
224
                        ]
 
225
                }
 
226
        },
 
227
        {
 
228
                "search": {
 
229
                        "from": 0,
 
230
                        "size": 10,
 
231
                        "query": {
 
232
                                "field": "tags",
 
233
                                "term": "gopher"
 
234
                        }
 
235
                },
 
236
                "result": {
 
237
                        "total_hits": 1,
 
238
                        "hits": [
 
239
                                {
 
240
                                        "id": "a"
 
241
                                }
 
242
                        ]
 
243
                }
 
244
        },
 
245
        {
 
246
                "search": {
 
247
                        "from": 0,
 
248
                        "size": 10,
 
249
                        "query": {
 
250
                                "field": "tags",
 
251
                                "term": "belieber"
 
252
                        }
 
253
                },
 
254
                "result": {
 
255
                        "total_hits": 1,
 
256
                        "hits": [
 
257
                                {
 
258
                                        "id": "a"
 
259
                                }
 
260
                        ]
 
261
                }
 
262
        },
 
263
        {
 
264
                "search": {
 
265
                        "from": 0,
 
266
                        "size": 10,
 
267
                        "query": {
 
268
                                "field": "tags",
 
269
                                "term": "notintagsarray"
 
270
                        }
 
271
                },
 
272
                "result": {
 
273
                        "total_hits": 0,
 
274
                        "hits": []
 
275
                }
 
276
        },
 
277
        {
 
278
                "comment": "with size 0, total should be 1, but hits empty",
 
279
                "search": {
 
280
                        "from": 0,
 
281
                        "size": 0,
 
282
                        "query": {
 
283
                                "field": "name",
 
284
                                "term": "marti"
 
285
                        }
 
286
                },
 
287
                "result": {
 
288
                        "total_hits": 1,
 
289
                        "hits": []
 
290
                }
 
291
        },
 
292
        {
 
293
                "comment": "a search for doc a that includes tags field, verifies both values come back",
 
294
                "search": {
 
295
                        "from": 0,
 
296
                        "size": 10,
 
297
                        "fields": ["tags"],
 
298
                        "query": {
 
299
                                "field": "name",
 
300
                                "term": "marti"
 
301
                        }
 
302
                },
 
303
                "result": {
 
304
                        "total_hits": 1,
 
305
                        "hits": [
 
306
                                {
 
307
                                        "id": "a",
 
308
                                        "fields": {
 
309
                                                "tags": ["gopher", "belieber"]
 
310
                                        }
 
311
                                }
 
312
                        ]
 
313
                }
 
314
        },
 
315
        {
 
316
                "search": {
 
317
                        "from": 0,
 
318
                        "size": 10,
 
319
                        "query": {
 
320
                                "field": "name",
 
321
                                "term": "msrti",
 
322
                                "fuzziness": 1
 
323
                        }
 
324
                },
 
325
                "result": {
 
326
                        "total_hits": 1,
 
327
                        "hits": [
 
328
                                {
 
329
                                        "id": "a"
 
330
                                }
 
331
                        ]
 
332
                }
 
333
        },
 
334
        {
 
335
                "comment": "highlight results",
 
336
                "search": {
 
337
                        "from": 0,
 
338
                        "size": 10,
 
339
                        "query": {
 
340
                                "field": "name",
 
341
                                "match": "long"
 
342
                        },
 
343
                        "highlight": {
 
344
                                "fields": ["name"]
 
345
                        }
 
346
                },
 
347
                "result": {
 
348
                        "total_hits": 1,
 
349
                        "hits": [
 
350
                                {
 
351
                                        "id": "b",
 
352
                                        "fragments": {
 
353
                                                "name": ["steve has a <mark>long</mark> name"]
 
354
                                        }
 
355
                                }
 
356
                        ]
 
357
                }
 
358
        },
 
359
        {
 
360
                "comment": "highlight results without specifying fields",
 
361
                "search": {
 
362
                        "from": 0,
 
363
                        "size": 10,
 
364
                        "query": {
 
365
                                "field": "name",
 
366
                                "match": "long"
 
367
                        },
 
368
                        "highlight": {}
 
369
                },
 
370
                "result": {
 
371
                        "total_hits": 1,
 
372
                        "hits": [
 
373
                                {
 
374
                                        "id": "b",
 
375
                                        "fragments": {
 
376
                                                "name": ["steve has a <mark>long</mark> name"]
 
377
                                        }
 
378
                                }
 
379
                        ]
 
380
                }
 
381
        },
 
382
        {
 
383
                "comment": "request fields",
 
384
                "search": {
 
385
                        "from": 0,
 
386
                        "size": 10,
 
387
                        "fields": ["age","birthday"],
 
388
                        "query": {
 
389
                                "field": "name",
 
390
                                "match": "long"
 
391
                        }
 
392
                },
 
393
                "result": {
 
394
                        "total_hits": 1,
 
395
                        "hits": [
 
396
                                {
 
397
                                        "id": "b",
 
398
                                        "fields": {
 
399
                                                "age": 27,
 
400
                                                "birthday": "2001-09-09T01:46:40Z"
 
401
                                        }
 
402
                                }
 
403
                        ]
 
404
                }
 
405
        },
 
406
        {
 
407
                "comment": "tests query string only containing MUST NOT clause, bug #193",
 
408
                "search": {
 
409
                        "from": 0,
 
410
                        "size": 10,
 
411
                        "query": {
 
412
                                "query": "-title:mista"
 
413
                        }
 
414
                },
 
415
                "result": {
 
416
                        "total_hits": 3,
 
417
                        "hits": [
 
418
                                {
 
419
                                        "id": "b"
 
420
                                },
 
421
                                {
 
422
                                        "id": "c"
 
423
                                },
 
424
                                {
 
425
                                        "id": "d"
 
426
                                }
 
427
                        ]
 
428
                }
 
429
        },
 
430
        {
 
431
                "comment": "highlight results including non-matching field (which should be produced in its entirety, though unhighlighted)",
 
432
                "search": {
 
433
                        "from": 0,
 
434
                        "size": 10,
 
435
                        "query": {
 
436
                                "field": "name",
 
437
                                "match": "long"
 
438
                        },
 
439
                        "highlight": {
 
440
                                "fields": ["name", "title"]
 
441
                        }
 
442
                },
 
443
                "result": {
 
444
                        "total_hits": 1,
 
445
                        "hits": [
 
446
                                {
 
447
                                        "id": "b",
 
448
                                        "fragments": {
 
449
                                                "name": ["steve has a <mark>long</mark> name"],
 
450
                                                "title": ["missess"]
 
451
                                        }
 
452
                                }
 
453
                        ]
 
454
                }
 
455
        },
 
456
        {
 
457
                "comment": "search and highlight an array field",
 
458
                "search": {
 
459
                        "from": 0,
 
460
                        "size": 10,
 
461
                        "query": {
 
462
                                "field": "tags",
 
463
                                "match": "gopher"
 
464
                        },
 
465
                        "highlight": {
 
466
                                "fields": ["tags"]
 
467
                        }
 
468
                },
 
469
                "result": {
 
470
                        "total_hits": 1,
 
471
                        "hits": [
 
472
                                {
 
473
                                        "id": "a",
 
474
                                        "fragments": {
 
475
                                                "tags": ["<mark>gopher</mark>"]
 
476
                                        }
 
477
                                }
 
478
                        ]
 
479
                }
 
480
        },
 
481
        {
 
482
                "comment": "reproduce bug in prefix search",
 
483
                "search": {
 
484
                        "from": 0,
 
485
                        "size": 10,
 
486
                        "query": {
 
487
                                "field": "title",
 
488
                                "prefix": "miss"
 
489
                        }
 
490
                },
 
491
                "result": {
 
492
                        "total_hits": 1,
 
493
                        "hits": [
 
494
                                {
 
495
                                        "id": "b"
 
496
                                }
 
497
                        ]
 
498
                }
 
499
        },
 
500
        {
 
501
                "comment": "test match none",
 
502
                "search": {
 
503
                        "from": 0,
 
504
                        "size": 10,
 
505
                        "query": {
 
506
                                "match_none": {}
 
507
                        }
 
508
                },
 
509
                "result": {
 
510
                        "total_hits": 0,
 
511
                        "hits": []
 
512
                }
 
513
        },
 
514
        {
 
515
                "comment": "test match all",
 
516
                "search": {
 
517
                        "from": 0,
 
518
                        "size": 10,
 
519
                        "query": {
 
520
                                "match_all": {}
 
521
                        }
 
522
                },
 
523
                "result": {
 
524
                        "total_hits": 4,
 
525
                        "hits": [
 
526
                                {
 
527
                                        "id": "a"
 
528
                                },
 
529
                                {
 
530
                                        "id": "b"
 
531
                                },
 
532
                                {
 
533
                                        "id": "c"
 
534
                                },
 
535
                                {
 
536
                                        "id": "d"
 
537
                                }
 
538
                        ]
 
539
                }
 
540
        },
 
541
        {
 
542
                "comment": "test doc id query",
 
543
                "search": {
 
544
                        "from": 0,
 
545
                        "size": 10,
 
546
                        "query": {
 
547
                                "ids": ["b", "c"]
 
548
                        }
 
549
                },
 
550
                "result": {
 
551
                        "total_hits": 2,
 
552
                        "hits": [
 
553
                                {
 
554
                                        "id": "b"
 
555
                                },
 
556
                                {
 
557
                                        "id": "c"
 
558
                                }
 
559
                        ]
 
560
                }
 
561
        },
 
562
        {
 
563
                "comment": "test query string MUST and SHOULD",
 
564
                "search": {
 
565
                        "from": 0,
 
566
                        "size": 10,
 
567
                        "query": {
 
568
                                "query": "+age:>20 missess"
 
569
                        }
 
570
                },
 
571
                "result": {
 
572
                        "total_hits": 3,
 
573
                        "hits": [
 
574
                                {
 
575
                                        "id": "b"
 
576
                                },
 
577
                                {
 
578
                                        "id": "c"
 
579
                                },
 
580
                                {
 
581
                                        "id": "d"
 
582
                                }
 
583
                        ]
 
584
                }
 
585
        },
 
586
        {
 
587
                "comment": "test regexp matching term",
 
588
                "search": {
 
589
                        "from": 0,
 
590
                        "size": 10,
 
591
                        "query": {
 
592
                                "field": "name",
 
593
                                "regexp": "mar.*"
 
594
                        }
 
595
                },
 
596
                "result": {
 
597
                        "total_hits": 1,
 
598
                        "hits": [
 
599
                                {
 
600
                                        "id": "a"
 
601
                                }
 
602
                        ]
 
603
                }
 
604
        },
 
605
        {
 
606
                "comment": "test regexp that should not match when properly anchored",
 
607
                "search": {
 
608
                        "from": 0,
 
609
                        "size": 10,
 
610
                        "query": {
 
611
                                "field": "name",
 
612
                                "regexp": "mar."
 
613
                        }
 
614
                },
 
615
                "result": {
 
616
                        "total_hits": 0,
 
617
                        "hits": []
 
618
                }
 
619
        },
 
620
        {
 
621
                "comment": "test wildcard matching term",
 
622
                "search": {
 
623
                        "from": 0,
 
624
                        "size": 10,
 
625
                        "query": {
 
626
                                "field": "name",
 
627
                                "wildcard": "mar*"
 
628
                        }
 
629
                },
 
630
                "result": {
 
631
                        "total_hits": 1,
 
632
                        "hits": [
 
633
                                {
 
634
                                        "id": "a"
 
635
                                }
 
636
                        ]
 
637
                }
 
638
        },
 
639
        {
 
640
                "comment": "test boost - term query",
 
641
                "search": {
 
642
                        "from": 0,
 
643
                        "size": 10,
 
644
                        "query": {
 
645
                                "disjuncts": [
 
646
                                        {
 
647
                                                "field": "name",
 
648
                                                "term": "marti",
 
649
                                                "boost": 1.0
 
650
                                        },
 
651
                                        {
 
652
                                                "field": "name",
 
653
                                                "term": "steve",
 
654
                                                "boost": 5.0
 
655
                                        }
 
656
                                ]
 
657
                        }
 
658
                },
 
659
                "result": {
 
660
                        "total_hits": 2,
 
661
                        "hits": [
 
662
                                {
 
663
                                        "id": "b"
 
664
                                },
 
665
                                {
 
666
                                        "id": "a"
 
667
                                }
 
668
                        ]
 
669
                }
 
670
        },
 
671
        {
 
672
                "comment": "test boost - term query",
 
673
                "search": {
 
674
                        "from": 0,
 
675
                        "size": 10,
 
676
                        "query": {
 
677
                                "disjuncts": [
 
678
                                        {
 
679
                                                "field": "name",
 
680
                                                "term": "marti",
 
681
                                                "boost": 1.0
 
682
                                        },
 
683
                                        {
 
684
                                                "fuzziness": 1,
 
685
                                                "field": "name",
 
686
                                                "term": "steve",
 
687
                                                "boost": 5.0
 
688
                                        }
 
689
                                ]
 
690
                        }
 
691
                },
 
692
                "result": {
 
693
                        "total_hits": 2,
 
694
                        "hits": [
 
695
                                {
 
696
                                        "id": "b"
 
697
                                },
 
698
                                {
 
699
                                        "id": "a"
 
700
                                }
 
701
                        ]
 
702
                }
 
703
        },
 
704
        {
 
705
                "comment": "test boost - numeric range query",
 
706
                "search": {
 
707
                        "from": 0,
 
708
                        "size": 10,
 
709
                        "query": {
 
710
                                "disjuncts": [
 
711
                                        {
 
712
                                                "field": "name",
 
713
                                                "term": "marti",
 
714
                                                "boost": 1.0
 
715
                                        },
 
716
                                        {
 
717
                                                "field": "age",
 
718
                                                "min": 25,
 
719
                                                "max": 29,
 
720
                                                "boost": 50.0
 
721
                                        }
 
722
                                ]
 
723
                        }
 
724
                },
 
725
                "result": {
 
726
                        "total_hits": 2,
 
727
                        "hits": [
 
728
                                {
 
729
                                        "id": "b"
 
730
                                },
 
731
                                {
 
732
                                        "id": "a"
 
733
                                }
 
734
                        ]
 
735
                }
 
736
        },
 
737
        {
 
738
                "comment": "test boost - regexp query",
 
739
                "search": {
 
740
                        "from": 0,
 
741
                        "size": 10,
 
742
                        "query": {
 
743
                                "disjuncts": [
 
744
                                        {
 
745
                                                "field": "name",
 
746
                                                "term": "marti",
 
747
                                                "boost": 1.0
 
748
                                        },
 
749
                                        {
 
750
                                                "field": "name",
 
751
                                                "regexp": "stev.*",
 
752
                                                "boost": 5.0
 
753
                                        }
 
754
                                ]
 
755
                        }
 
756
                },
 
757
                "result": {
 
758
                        "total_hits": 2,
 
759
                        "hits": [
 
760
                                {
 
761
                                        "id": "b"
 
762
                                },
 
763
                                {
 
764
                                        "id": "a"
 
765
                                }
 
766
                        ]
 
767
                }
 
768
        },
 
769
        {
 
770
                "comment": "test wildcard inside query string",
 
771
                "search": {
 
772
                        "from": 0,
 
773
                        "size": 10,
 
774
                        "query": {
 
775
                                "query": "name:mar*"
 
776
                        }
 
777
                },
 
778
                "result": {
 
779
                        "total_hits": 1,
 
780
                        "hits": [
 
781
                                {
 
782
                                        "id": "a"
 
783
                                }
 
784
                        ]
 
785
                }
 
786
        },
 
787
        {
 
788
                "comment": "test regexp inside query string",
 
789
                "search": {
 
790
                        "from": 0,
 
791
                        "size": 10,
 
792
                        "query": {
 
793
                                "query": "name:/mar.*/"
 
794
                        }
 
795
                },
 
796
                "result": {
 
797
                        "total_hits": 1,
 
798
                        "hits": [
 
799
                                {
 
800
                                        "id": "a"
 
801
                                }
 
802
                        ]
 
803
                }
 
804
        }
 
805
]