@@ -299,16 +299,16 @@ public void testSimpleMoreLikeInclude() throws Exception {
299
299
300
300
logger .info ("Running More Like This with include true" );
301
301
SearchResponse response = client ().prepareSearch ().setQuery (
302
- new MoreLikeThisQueryBuilder ().addItem (new Item ("test" , "type1" , "1" )).minTermFreq (1 ).minDocFreq (1 ).include (true ).percentTermsToMatch ( 0 )).get ();
302
+ new MoreLikeThisQueryBuilder ().addItem (new Item ("test" , "type1" , "1" )).minTermFreq (1 ).minDocFreq (1 ).include (true ).minimumShouldMatch ( "0%" )).get ();
303
303
assertOrderedSearchHits (response , "1" , "2" );
304
304
305
305
response = client ().prepareSearch ().setQuery (
306
- new MoreLikeThisQueryBuilder ().addItem (new Item ("test" , "type1" , "2" )).minTermFreq (1 ).minDocFreq (1 ).include (true ).percentTermsToMatch ( 0 )).get ();
306
+ new MoreLikeThisQueryBuilder ().addItem (new Item ("test" , "type1" , "2" )).minTermFreq (1 ).minDocFreq (1 ).include (true ).minimumShouldMatch ( "0%" )).get ();
307
307
assertOrderedSearchHits (response , "2" , "1" );
308
308
309
309
logger .info ("Running More Like This with include false" );
310
310
response = client ().prepareSearch ().setQuery (
311
- new MoreLikeThisQueryBuilder ().addItem (new Item ("test" , "type1" , "1" )).minTermFreq (1 ).minDocFreq (1 ).percentTermsToMatch ( 0 )).get ();
311
+ new MoreLikeThisQueryBuilder ().addItem (new Item ("test" , "type1" , "1" )).minTermFreq (1 ).minDocFreq (1 ).minimumShouldMatch ( "0%" )).get ();
312
312
assertSearchHits (response , "2" );
313
313
}
314
314
@@ -394,7 +394,7 @@ public void testMoreLikeThisMultiValueFields() throws Exception {
394
394
int max_query_terms = randomIntBetween (1 , values .length );
395
395
logger .info ("Running More Like This with max_query_terms = %s" , max_query_terms );
396
396
MoreLikeThisQueryBuilder mltQuery = moreLikeThisQuery ("text" ).ids ("0" ).minTermFreq (1 ).minDocFreq (1 )
397
- .maxQueryTerms (max_query_terms ).percentTermsToMatch ( 0 );
397
+ .maxQueryTerms (max_query_terms ).minimumShouldMatch ( "0%" );
398
398
SearchResponse response = client ().prepareSearch ("test" ).setTypes ("type1" )
399
399
.setQuery (mltQuery ).execute ().actionGet ();
400
400
assertSearchResponse (response );
@@ -493,7 +493,7 @@ public void testMoreLikeThisMalformedArtificialDocs() throws Exception {
493
493
.docs ((Item ) new Item ().doc (malformedFieldDoc ).index ("test" ).type ("type1" ))
494
494
.minTermFreq (0 )
495
495
.minDocFreq (0 )
496
- .percentTermsToMatch ( 0 );
496
+ .minimumShouldMatch ( "0%" );
497
497
SearchResponse response = client ().prepareSearch ("test" ).setTypes ("type1" )
498
498
.setQuery (mltQuery ).get ();
499
499
assertSearchResponse (response );
@@ -505,7 +505,7 @@ public void testMoreLikeThisMalformedArtificialDocs() throws Exception {
505
505
.docs ((Item ) new Item ().doc (emptyDoc ).index ("test" ).type ("type1" ))
506
506
.minTermFreq (0 )
507
507
.minDocFreq (0 )
508
- .percentTermsToMatch ( 0 );
508
+ .minimumShouldMatch ( "0%" );
509
509
response = client ().prepareSearch ("test" ).setTypes ("type1" )
510
510
.setQuery (mltQuery ).get ();
511
511
assertSearchResponse (response );
@@ -517,7 +517,7 @@ public void testMoreLikeThisMalformedArtificialDocs() throws Exception {
517
517
.docs ((Item ) new Item ().doc (malformedDoc ).index ("test" ).type ("type1" ))
518
518
.minTermFreq (0 )
519
519
.minDocFreq (0 )
520
- .percentTermsToMatch ( 0 );
520
+ .minimumShouldMatch ( "0%" );
521
521
response = client ().prepareSearch ("test" ).setTypes ("type1" )
522
522
.setQuery (mltQuery ).get ();
523
523
assertSearchResponse (response );
@@ -533,7 +533,7 @@ public void testMoreLikeThisMalformedArtificialDocs() throws Exception {
533
533
.docs ((Item ) new Item ().doc (normalDoc ).index ("test" ).type ("type1" ))
534
534
.minTermFreq (0 )
535
535
.minDocFreq (0 )
536
- .percentTermsToMatch ( 1 ); // strict all terms must match but date is ignored
536
+ .minimumShouldMatch ( "100%" ); // strict all terms must match but date is ignored
537
537
response = client ().prepareSearch ("test" ).setTypes ("type1" )
538
538
.setQuery (mltQuery ).get ();
539
539
assertSearchResponse (response );
0 commit comments