@@ -446,7 +446,7 @@ private Map<String, Object> getParametrizedChangeFeedOptions(Object since, Integ
446
446
447
447
public ChangesResult changes (Object since , Integer limit ) {
448
448
Map <String , Object > options = getParametrizedChangeFeedOptions (since , limit );
449
- return this .changes (options );
449
+ return this .changesRequestWithGet (options );
450
450
}
451
451
452
452
public ChangesResult changes (PullFilter filter , Object since , Integer limit ) {
@@ -461,22 +461,41 @@ public ChangesResult changes(PullFilter filter, Object since, Integer limit) {
461
461
}
462
462
}
463
463
}
464
- return this .changes (options );
464
+ return this .changesRequestWithGet (options );
465
465
}
466
466
467
467
public ChangesResult changes (String selector , Object since , Integer limit ) {
468
- Misc .checkNotNullOrEmpty (selector ,null );
468
+ Misc .checkNotNullOrEmpty (selector , null );
469
+
469
470
Map <String , Object > options = getParametrizedChangeFeedOptions (since , limit );
470
471
options .put ("filter" , "_selector" );
472
+
473
+ return changesRequestWithPost (selector , options );
474
+ }
475
+
476
+ public ChangesResult changes (List <String > docIds , Object since , Integer limit ) {
477
+ Misc .checkState ((docIds != null && !docIds .isEmpty ()), null );
478
+
479
+ Map <String , Object > options = getParametrizedChangeFeedOptions (since , limit );
480
+ options .put ("filter" , "_doc_ids" );
481
+
482
+ Map <String , Object > docIdsMap = new HashMap <String , Object >();
483
+ docIdsMap .put ("doc_ids" , docIds );
484
+ String docsIdsDoc = JSONUtils .serializeAsString (docIdsMap );
485
+
486
+ return changesRequestWithPost (docsIdsDoc , options );
487
+ }
488
+
489
+ private ChangesResult changesRequestWithGet (final Map <String , Object > options ) {
471
490
URI changesFeedUri = uriHelper .changesUri (options );
472
- HttpConnection connection = Http .POST (changesFeedUri , "application/json" );
473
- connection .setRequestBody (selector );
491
+ HttpConnection connection = Http .GET (changesFeedUri );
474
492
return executeToJsonObjectWithRetry (connection , ChangesResult .class );
475
493
}
476
494
477
- public ChangesResult changes ( final Map <String , Object > options ) {
495
+ private ChangesResult changesRequestWithPost ( String body , final Map <String , Object > options ) {
478
496
URI changesFeedUri = uriHelper .changesUri (options );
479
- HttpConnection connection = Http .GET (changesFeedUri );
497
+ HttpConnection connection = Http .POST (changesFeedUri , "application/json" );
498
+ connection .setRequestBody (body );
480
499
return executeToJsonObjectWithRetry (connection , ChangesResult .class );
481
500
}
482
501
0 commit comments