Open
Conversation
Fixes #2085 Signed-off-by: Emilien Bevierre <emilien.bevierre@couchbase.com>
…tites and totalRows in a single round trip Signed-off-by: Emilien Bevierre <emilien.bevierre@couchbase.com>
Signed-off-by: Emilien Bevierre <emilien.bevierre@couchbase.com>
Signed-off-by: Emilien Bevierre <emilien.bevierre@couchbase.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Emilien Bevierre <44171454+emilienbev@users.noreply.github.com>
Signed-off-by: Emilien Bevierre <emilien.bevierre@couchbase.com>
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 29 out of 29 changed files in this pull request and generated 8 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| import java.util.Arrays; | ||
| import java.util.Collections; | ||
| import java.util.List; | ||
| import java.util.Map; |
Comment on lines
+76
to
+78
| void searchScanConsistencyAnnotationValueAttribute() { | ||
| // Verify the search attribute exists on the ScanConsistency annotation | ||
| ScanConsistency annotation = TestScanConsistencyRepository.class.getMethods()[0].getAnnotation(ScanConsistency.class); |
Comment on lines
+30
to
+34
| @Test | ||
| void searchAnnotationsAreRuntimeRetained() { | ||
| assertTrue(Search.class.isAnnotation()); | ||
| assertTrue(SearchIndex.class.isAnnotation()); | ||
| } |
Comment on lines
+20
to
+32
| import java.util.Collections; | ||
| import java.util.HashMap; | ||
| import java.util.Map; | ||
|
|
||
| import org.junit.jupiter.api.Test; | ||
|
|
||
| import com.couchbase.client.java.search.HighlightStyle; | ||
| import com.couchbase.client.java.search.SearchOptions; | ||
| import com.couchbase.client.java.search.SearchRequest; | ||
| import com.couchbase.client.java.search.SearchQuery; | ||
| import com.couchbase.client.java.search.SearchScanConsistency; | ||
| import com.couchbase.client.java.search.facet.SearchFacet; | ||
| import com.couchbase.client.java.search.sort.SearchSort; |
Comment on lines
+72
to
+86
| @Override | ||
| public Object execute(Object[] parameters) { | ||
| ReactiveCouchbaseParameterAccessor accessor = new ReactiveCouchbaseParameterAccessor(method, parameters); | ||
|
|
||
| return accessor.resolveParameters().flatMapMany(resolvedAccessor -> { | ||
| ResultProcessor processor = method.getResultProcessor().withDynamicProjection(resolvedAccessor); | ||
| SearchRepositoryQuerySupport.validateSort(resolvedAccessor); | ||
|
|
||
| String resolvedQuery = SearchBasedCouchbaseQuery.resolveParameters(searchQueryTemplate, resolvedAccessor); | ||
| SearchRequest request = SearchRequest.create(SearchQuery.queryString(resolvedQuery)); | ||
| Object result = executeDependingOnType(resolvedAccessor, request); | ||
|
|
||
| return ReactiveWrapperConverters.toWrapper(processor.processResult(result), reactor.core.publisher.Flux.class); | ||
| }); | ||
| } |
Comment on lines
+82
to
+89
| cluster.searchIndexes().dropIndex(INDEX_NAME); | ||
| } catch (Exception e) { | ||
| LOGGER.warn("Failed to drop FTS index: {}", e.getMessage()); | ||
| } finally { | ||
| logCluster(cluster, "tearDownFtsIndex"); | ||
| } | ||
| callSuperAfterAll(new Object() {}); | ||
| cluster.disconnect(); |
Comment on lines
+344
to
+353
| if (i < maxRetries - 1 && (ex.getMessage().contains("no planPIndexes") | ||
| || ex.getMessage().contains("pindex_consistency") | ||
| || ex.getMessage().contains("pindex not available") | ||
| || ex.getMessage().contains("index not found"))) { | ||
| sleepMs(2000); | ||
| continue; | ||
| } | ||
| if (i >= maxRetries - 1) { | ||
| throw new RuntimeException("FTS index " + indexName + " did not become ready in time", ex); | ||
| } |
Comment on lines
+96
to
+105
| private InsertedDoc insertRawDoc(String id, String firstname, String lastname) { | ||
| Collection col = couchbaseTemplate.getCouchbaseClientFactory().getDefaultCollection(); | ||
| JsonObject content = JsonObject.create() | ||
| .put("id", id) | ||
| .put("firstname", firstname) | ||
| .put("lastname", lastname) | ||
| .put("t", "abstractuser"); // typeKey used by Config | ||
| MutationResult result = col.insert(id, content); | ||
| MutationState ms = MutationState.from(result.mutationToken().get()); | ||
| return new InsertedDoc(id, ms); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2085
Adds:
findBySearchto both standard and reactive templates, with builder for configuring index names, limits, sorting, facets, etc.@Searchfor query strings and@SearchIndexto specify index names.SearchResult<T>wrapper to provide access to entities, metadata, and facets. Supports standard terminal operations like all(), first(), and count().@ScanConsistencyand enabled Page/Slice for the non-reactive repository.