|
327 | 327 | (is (= exp res)))) |
328 | 328 |
|
329 | 329 | (testing "Search" |
330 | | - (let [exp {:facet_counts [], |
331 | | - :found 1, |
| 330 | + (let [exp {:facet_counts [] |
| 331 | + :found 1 |
332 | 332 | :hits |
333 | 333 | [{:document |
334 | | - {:company_name "Innovationsoft A/S", |
335 | | - :country "Finland", |
336 | | - :id "1", |
337 | | - :num_employees 10}, |
| 334 | + {:company_name "Innovationsoft A/S" |
| 335 | + :country "Finland" |
| 336 | + :id "1" |
| 337 | + :num_employees 10} |
338 | 338 | :highlight |
339 | 339 | {:company_name |
340 | | - {:matched_tokens ["Innovation"], |
341 | | - :snippet "<mark>Innovation</mark>soft A/S"}}, |
| 340 | + {:matched_tokens ["Innovation"] |
| 341 | + :snippet "<mark>Innovation</mark>soft A/S"}} |
342 | 342 | :highlights |
343 | | - [{:field "company_name", |
344 | | - :matched_tokens ["Innovation"], |
345 | | - :snippet "<mark>Innovation</mark>soft A/S"}], |
346 | | - :text_match 578730089005449337, |
| 343 | + [{:field "company_name" |
| 344 | + :matched_tokens ["Innovation"] |
| 345 | + :snippet "<mark>Innovation</mark>soft A/S"}] |
| 346 | + :text_match 578730089005449337 |
347 | 347 | :text_match_info |
348 | | - {:best_field_score "1108074561536", |
349 | | - :best_field_weight 15, |
350 | | - :fields_matched 1, |
351 | | - :score "578730089005449337", |
352 | | - :tokens_matched 1}}], |
353 | | - :out_of 1, |
354 | | - :page 1, |
| 348 | + {:best_field_score "1108074561536" |
| 349 | + :best_field_weight 15 |
| 350 | + :fields_matched 1 |
| 351 | + :score "578730089005449337" |
| 352 | + :tokens_matched 1}}] |
| 353 | + :out_of 1 |
| 354 | + :page 1 |
355 | 355 | :request_params |
356 | | - {:collection_name "companies_documents_test", |
357 | | - :per_page 10, |
358 | | - :q "Innovation"}, |
359 | | - :search_cutoff false, |
| 356 | + {:collection_name "companies_documents_test" |
| 357 | + :per_page 10 |
| 358 | + :q "Innovation"} |
| 359 | + :search_cutoff false |
360 | 360 | :search_time_ms 0} |
361 | 361 | res (sut/search settings |
362 | 362 | "companies_documents_test" |
|
385 | 385 |
|
386 | 386 | (testing "Multi search" |
387 | 387 | (let [exp {:results |
388 | | - [{:facet_counts [], |
389 | | - :found 1, |
| 388 | + [{:facet_counts [] |
| 389 | + :found 1 |
390 | 390 | :hits |
391 | | - [{:document {:id "1", :name "shoe", :price 75}, |
| 391 | + [{:document {:id "1" :name "shoe" :price 75} |
392 | 392 | :highlight |
393 | | - {:name {:matched_tokens ["shoe"], :snippet "<mark>shoe</mark>"}}, |
| 393 | + {:name {:matched_tokens ["shoe"] :snippet "<mark>shoe</mark>"}} |
394 | 394 | :highlights |
395 | | - [{:field "name", |
396 | | - :matched_tokens ["shoe"], |
397 | | - :snippet "<mark>shoe</mark>"}], |
398 | | - :text_match 578730123365711993, |
| 395 | + [{:field "name" |
| 396 | + :matched_tokens ["shoe"] |
| 397 | + :snippet "<mark>shoe</mark>"}] |
| 398 | + :text_match 578730123365711993 |
399 | 399 | :text_match_info |
400 | | - {:best_field_score "1108091339008", |
401 | | - :best_field_weight 15, |
402 | | - :fields_matched 1, |
403 | | - :score "578730123365711993", |
404 | | - :tokens_matched 1}}], |
405 | | - :out_of 1, |
406 | | - :page 1, |
| 400 | + {:best_field_score "1108091339008" |
| 401 | + :best_field_weight 15 |
| 402 | + :fields_matched 1 |
| 403 | + :score "578730123365711993" |
| 404 | + :tokens_matched 1}}] |
| 405 | + :out_of 1 |
| 406 | + :page 1 |
407 | 407 | :request_params |
408 | | - {:collection_name "products_multi_search_test", |
409 | | - :per_page 10, |
410 | | - :q "shoe"}, |
411 | | - :search_cutoff false, |
| 408 | + {:collection_name "products_multi_search_test" |
| 409 | + :per_page 10 |
| 410 | + :q "shoe"} |
| 411 | + :search_cutoff false |
412 | 412 | :search_time_ms 0} |
413 | | - {:facet_counts [], |
414 | | - :found 1, |
| 413 | + {:facet_counts [] |
| 414 | + :found 1 |
415 | 415 | :hits |
416 | | - [{:document {:id "1", :name "Nike"}, |
| 416 | + [{:document {:id "1" :name "Nike"} |
417 | 417 | :highlight |
418 | | - {:name {:matched_tokens ["Nike"], :snippet "<mark>Nike</mark>"}}, |
| 418 | + {:name {:matched_tokens ["Nike"] :snippet "<mark>Nike</mark>"}} |
419 | 419 | :highlights |
420 | | - [{:field "name", |
421 | | - :matched_tokens ["Nike"], |
422 | | - :snippet "<mark>Nike</mark>"}], |
423 | | - :text_match 578730123365711993, |
| 420 | + [{:field "name" |
| 421 | + :matched_tokens ["Nike"] |
| 422 | + :snippet "<mark>Nike</mark>"}] |
| 423 | + :text_match 578730123365711993 |
424 | 424 | :text_match_info |
425 | | - {:best_field_score "1108091339008", |
426 | | - :best_field_weight 15, |
427 | | - :fields_matched 1, |
428 | | - :score "578730123365711993", |
429 | | - :tokens_matched 1}}], |
430 | | - :out_of 1, |
431 | | - :page 1, |
| 425 | + {:best_field_score "1108091339008" |
| 426 | + :best_field_weight 15 |
| 427 | + :fields_matched 1 |
| 428 | + :score "578730123365711993" |
| 429 | + :tokens_matched 1}}] |
| 430 | + :out_of 1 |
| 431 | + :page 1 |
432 | 432 | :request_params |
433 | | - {:collection_name "brands_multi_search_test", |
434 | | - :per_page 10, |
435 | | - :q "Nike"}, |
436 | | - :search_cutoff false, |
| 433 | + {:collection_name "brands_multi_search_test" |
| 434 | + :per_page 10 |
| 435 | + :q "Nike"} |
| 436 | + :search_cutoff false |
437 | 437 | :search_time_ms 0}]} |
438 | 438 | res (sut/multi-search settings |
439 | 439 | {:searches [{:collection "products_multi_search_test" |
|
457 | 457 | (sut/create-document! settings "places" document)) |
458 | 458 |
|
459 | 459 | (testing "Geosearch" |
460 | | - (let [exp {:facet_counts [], |
461 | | - :found 1, |
| 460 | + (let [exp {:facet_counts [] |
| 461 | + :found 1 |
462 | 462 | :hits |
463 | 463 | [{:document |
464 | | - {:id "0", |
465 | | - :location [48.86093481609114 2.33698396872901], |
466 | | - :points 1, |
467 | | - :title "Louvre Museuem"}, |
468 | | - :geo_distance_meters {:location 1020}, |
469 | | - :highlight {}, |
470 | | - :highlights []}], |
471 | | - :out_of 1, |
472 | | - :page 1, |
473 | | - :request_params {:collection_name "places", :per_page 10, :q "*"}, |
| 464 | + {:id "0" |
| 465 | + :location [48.86093481609114 2.33698396872901] |
| 466 | + :points 1 |
| 467 | + :title "Louvre Museuem"} |
| 468 | + :geo_distance_meters {:location 1020} |
| 469 | + :highlight {} |
| 470 | + :highlights []}] |
| 471 | + :out_of 1 |
| 472 | + :page 1 |
| 473 | + :request_params {:collection_name "places" :per_page 10 :q "*"} |
474 | 474 | :search_cutoff false} |
475 | 475 | res (sut/search settings |
476 | 476 | "places" |
|
512 | 512 |
|
513 | 513 | (testing "List all overrides" |
514 | 514 | (let [exp {:overrides |
515 | | - [{:excludes [{:id "287"}], |
516 | | - :filter_curated_hits false, |
517 | | - :id "customize_apple", |
518 | | - :includes [{:id "422", :position 1} {:id "54", :position 2}], |
519 | | - :remove_matched_tokens false, |
520 | | - :rule {:match "exact", :query "apple"}, |
| 515 | + [{:excludes [{:id "287"}] |
| 516 | + :filter_curated_hits false |
| 517 | + :id "customize_apple" |
| 518 | + :includes [{:id "422" :position 1} {:id "54" :position 2}] |
| 519 | + :remove_matched_tokens false |
| 520 | + :rule {:match "exact" :query "apple"} |
521 | 521 | :stop_processing true}]} |
522 | 522 | res (sut/list-overrides settings "companies_curation_test")] |
523 | 523 | (is (= exp res)))) |
524 | 524 |
|
525 | 525 | (testing "Retrieve override" |
526 | | - (let [exp {:excludes [{:id "287"}], |
527 | | - :filter_curated_hits false, |
528 | | - :id "customize_apple", |
529 | | - :includes [{:id "422", :position 1} {:id "54", :position 2}], |
530 | | - :remove_matched_tokens false, |
531 | | - :rule {:match "exact", :query "apple"}, |
| 526 | + (let [exp {:excludes [{:id "287"}] |
| 527 | + :filter_curated_hits false |
| 528 | + :id "customize_apple" |
| 529 | + :includes [{:id "422" :position 1} {:id "54" :position 2}] |
| 530 | + :remove_matched_tokens false |
| 531 | + :rule {:match "exact" :query "apple"} |
532 | 532 | :stop_processing true} |
533 | 533 | res (sut/retrieve-override settings |
534 | 534 | "companies_curation_test" |
|
0 commit comments