|
40 | 40 | import io.qdrant.client.grpc.Collections.VectorsConfig;
|
41 | 41 | import io.qdrant.client.grpc.CollectionsGrpc;
|
42 | 42 | import io.qdrant.client.grpc.JsonWithInt.Value;
|
| 43 | +import io.qdrant.client.grpc.Points; |
43 | 44 | import io.qdrant.client.grpc.Points.BatchResult;
|
44 | 45 | import io.qdrant.client.grpc.Points.ClearPayloadPoints;
|
45 | 46 | import io.qdrant.client.grpc.Points.CountPoints;
|
@@ -2804,6 +2805,103 @@ public ListenableFuture<List<PointGroup>> queryGroupsAsync(
|
2804 | 2805 | future, response -> response.getResult().getGroupsList(), MoreExecutors.directExecutor());
|
2805 | 2806 | }
|
2806 | 2807 |
|
| 2808 | + /** |
| 2809 | + * Perform facet counts. For each value in the field, count the number of points that have this |
| 2810 | + * value and match the conditions. |
| 2811 | + * |
| 2812 | + * @param request the facet counts request |
| 2813 | + * @return a new instance of {@link ListenableFuture} |
| 2814 | + */ |
| 2815 | + public ListenableFuture<List<Points.FacetHit>> facetAsync(Points.FacetCounts request) { |
| 2816 | + return facetAsync(request, null); |
| 2817 | + } |
| 2818 | + |
| 2819 | + /** |
| 2820 | + * Perform facet counts. For each value in the field, count the number of points that have this |
| 2821 | + * value and match the conditions. |
| 2822 | + * |
| 2823 | + * @param request the facet counts request |
| 2824 | + * @param timeout the timeout for the call. |
| 2825 | + * @return a new instance of {@link ListenableFuture} |
| 2826 | + */ |
| 2827 | + public ListenableFuture<List<Points.FacetHit>> facetAsync( |
| 2828 | + Points.FacetCounts request, @Nullable Duration timeout) { |
| 2829 | + Preconditions.checkArgument( |
| 2830 | + !request.getCollectionName().isEmpty(), "Collection name must not be empty"); |
| 2831 | + |
| 2832 | + logger.debug("Facet on '{}'", request.getCollectionName()); |
| 2833 | + ListenableFuture<Points.FacetResponse> future = getPoints(timeout).facet(request); |
| 2834 | + addLogFailureCallback(future, "Facet"); |
| 2835 | + return Futures.transform( |
| 2836 | + future, Points.FacetResponse::getHitsList, MoreExecutors.directExecutor()); |
| 2837 | + } |
| 2838 | + |
| 2839 | + // region distance matrix |
| 2840 | + |
| 2841 | + /** |
| 2842 | + * Compute distance matrix for sampled points with a pair based output format. |
| 2843 | + * |
| 2844 | + * @param request the search matrix pairs request |
| 2845 | + * @return a new instance of {@link ListenableFuture} |
| 2846 | + */ |
| 2847 | + public ListenableFuture<Points.SearchMatrixPairs> searchMatrixPairsAsync( |
| 2848 | + Points.SearchMatrixPoints request) { |
| 2849 | + return searchMatrixPairsAsync(request, null); |
| 2850 | + } |
| 2851 | + |
| 2852 | + /** |
| 2853 | + * Compute distance matrix for sampled points with a pair based output format. |
| 2854 | + * |
| 2855 | + * @param request the search matrix pairs request |
| 2856 | + * @param timeout the timeout for the call. |
| 2857 | + * @return a new instance of {@link ListenableFuture} |
| 2858 | + */ |
| 2859 | + public ListenableFuture<Points.SearchMatrixPairs> searchMatrixPairsAsync( |
| 2860 | + Points.SearchMatrixPoints request, @Nullable Duration timeout) { |
| 2861 | + Preconditions.checkArgument( |
| 2862 | + !request.getCollectionName().isEmpty(), "Collection name must not be empty"); |
| 2863 | + |
| 2864 | + logger.debug("Search matrix pairs on '{}'", request.getCollectionName()); |
| 2865 | + ListenableFuture<Points.SearchMatrixPairsResponse> future = |
| 2866 | + getPoints(timeout).searchMatrixPairs(request); |
| 2867 | + addLogFailureCallback(future, "Search matrix pairs"); |
| 2868 | + return Futures.transform( |
| 2869 | + future, Points.SearchMatrixPairsResponse::getResult, MoreExecutors.directExecutor()); |
| 2870 | + } |
| 2871 | + |
| 2872 | + /** |
| 2873 | + * Compute distance matrix for sampled points with an offset based output format |
| 2874 | + * |
| 2875 | + * @param request the search matrix pairs request |
| 2876 | + * @return a new instance of {@link ListenableFuture} |
| 2877 | + */ |
| 2878 | + public ListenableFuture<Points.SearchMatrixOffsets> searchMatrixOffsetsAsync( |
| 2879 | + Points.SearchMatrixPoints request) { |
| 2880 | + return searchMatrixOffsetsAsync(request, null); |
| 2881 | + } |
| 2882 | + |
| 2883 | + /** |
| 2884 | + * Compute distance matrix for sampled points with an offset based output format |
| 2885 | + * |
| 2886 | + * @param request the search matrix pairs request |
| 2887 | + * @param timeout the timeout for the call. |
| 2888 | + * @return a new instance of {@link ListenableFuture} |
| 2889 | + */ |
| 2890 | + public ListenableFuture<Points.SearchMatrixOffsets> searchMatrixOffsetsAsync( |
| 2891 | + Points.SearchMatrixPoints request, @Nullable Duration timeout) { |
| 2892 | + Preconditions.checkArgument( |
| 2893 | + !request.getCollectionName().isEmpty(), "Collection name must not be empty"); |
| 2894 | + |
| 2895 | + logger.debug("Search matrix offsets on '{}'", request.getCollectionName()); |
| 2896 | + ListenableFuture<Points.SearchMatrixOffsetsResponse> future = |
| 2897 | + getPoints(timeout).searchMatrixOffsets(request); |
| 2898 | + addLogFailureCallback(future, "Search matrix offsets"); |
| 2899 | + return Futures.transform( |
| 2900 | + future, Points.SearchMatrixOffsetsResponse::getResult, MoreExecutors.directExecutor()); |
| 2901 | + } |
| 2902 | + |
| 2903 | + // endregion |
| 2904 | + |
2807 | 2905 | // region Snapshot Management
|
2808 | 2906 |
|
2809 | 2907 | /**
|
|
0 commit comments