Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: add OpenSearch distance operations and selectors#1335

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
mmiguerodriguez wants to merge22 commits intomaster
base:master
Choose a base branch
Loading
fromfeature/os-distance-operations

Conversation

@mmiguerodriguez
Copy link
Collaborator

No description provided.

@mmiguerodriguezmmiguerodriguez marked this pull request as ready for reviewOctober 28, 2025 21:52
Copy link
Collaborator

@jgaleottijgaleotti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

please add test cases for the classes OpenSearchHeuristicsCalculator, ParameterExtractor and OpenSearchQueryHelper

importorg.evomaster.client.java.controller.opensearch.selectors.MatchSelector;
importorg.evomaster.client.java.controller.opensearch.selectors.QuerySelector;

publicclassOpenSearchQueryParser {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

We need tests for OpenSearchQueryParser to check that the JSON is correctly parsed into its corresponding OpenSearch operation.

/**
* Utility class to extract common parameters and reduce code duplication in selectors.
*/
publicclassParameterExtractor {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

add test cases for this class

/**
* Extracts the case_insensitive parameter from a term query object.
*/
publicstaticBooleanextractCaseInsensitive(Objectquery,Stringstructure) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

add test cases for this class

@mmiguerodriguezmmiguerodriguez marked this pull request as draftOctober 29, 2025 18:36
@mmiguerodriguezmmiguerodriguez marked this pull request as ready for reviewOctober 29, 2025 18:36
Copy link
Collaborator

@arcuri82arcuri82 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

sorry for late check, but was on vacation most of last week


if (operationinstanceofMatchOperation) {
returncalculateDistanceForMatch((MatchOperation)operation,doc);
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

shouldn't these be a chain of if/else, with a final having a warn log if no match was present? (eg to see if we miss any case).

mmiguerodriguez reacted with thumbs up emoji
// Not enough matches - distance based on how many more matches needed
intshortfall =minimumRequired -matchCount;
// Return a distance that reflects both the shortfall and the quality of non-matching terms
returnshortfall *10.0 + (totalDistance /expectedTerms.size());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

what ifexpectedTerms.size() is 0?

mmiguerodriguez reacted with thumbs up emoji

try {
// Create pattern with case insensitive flag if needed
java.util.regex.Patternpattern;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

are the regex in OpenSearch having the same syntax of Java regex? clarify here in some comments, with possible some links

Copy link
CollaboratorAuthor

@mmiguerodriguezmmiguerodriguezNov 18, 2025
edited
Loading

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

OpenSearch uses Lucene regular expression syntax, which is similar but NOT identical to Java regex.

https://opensearch.org/docs/latest/query-dsl/term/regexp/
https://lucene.apache.org/core/8_0_0/core/org/apache/lucene/util/automaton/RegExp.html

@jgaleotti Do you consider adding Java Regexp for this heuristic calculation as acceptable?


// Helper methods for advanced operations

privateintcalculateEditDistance(Strings1,Strings2,booleanallowTranspositions) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

geneneric helper functions on strings should not be here, but rather inclient-java/distance-heuristics/src/main/java/org/evomaster/client/java/distance/heuristics/DistanceHelper.java

mmiguerodriguez reacted with thumbs up emoji
// }
@GetMapping("gte/{gte}")
publicList<Age>findGteAge(@PathVariable("gte")Integergte)throwsIOException {
returnageRepo.findGteAge(gte);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

all these endpoints should return 404 if no data is found

mmiguerodriguez reacted with thumbs up emoji
Solution<RestIndividual>solution =initAndRun(args);

// assertHasAtLeastOne(solution, HttpVerb.GET, 404, "/students/{q}", null);
assertHasAtLeastOne(solution,HttpVerb.GET,200,"/students/{lastName}",null);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

add assertions for both 404 and 200 cases

mmiguerodriguez reacted with thumbs up emoji
// Term selector tests
@GetMapping("category/{category}")
publicList<Product>findByCategory(@PathVariableStringcategory)throwsIOException {
returnproductRepository.findByCategory(category);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

do return 404 if nothing is found in these endpoints, as it will simplify writing assertions/checks in the tests


Solution<RestIndividual> solution = initAndRun(args);

assertHasAtLeastOne(solution, HttpVerb.GET, 200, "/queries/category/{category}", null);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

add assertions on 404

}

@Test
public void testRangeQueries() throws Throwable {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

why are these E2E repeated with same configurations? can have single tests with all the assertions.
otherwise, if you only want to test specific endpoints, you have to passargs parameters to specify them, eg, with--endpointPrefix

@@ -0,0 +1,21 @@
package com.opensearch.queries;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

foldere2e-tests does not exist any more (we did a major refactoring of folder structures recently)

Copy link
CollaboratorAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Changing that.

@mmiguerodriguez
Copy link
CollaboratorAuthor

mmiguerodriguez commentedNov 18, 2025
edited
Loading

@arcuri82 is there any known issue with theevomaster-e2e-tests-spring-rest-rsa module? Most of the times I try building the project I'm having issues with that...

[INFO] evomaster-e2e-tests-spring-rest-rsa ................ FAILURE [  0.150 s][INFO] evomaster-e2e-tests-spring-rpc-grpc ................ SKIPPED[INFO] evomaster-e2e-tests-spring-rpc-thrift .............. SKIPPED[INFO] evomaster-core-integration-tests ................... SKIPPED[INFO] evomaster-core-driver-it ........................... SKIPPED[INFO] evomaster-core-graphql-it .......................... SKIPPED[INFO] evomaster-core-it .................................. SKIPPED[INFO] evomaster-test-old-libraries ....................... SKIPPED[INFO] ------------------------------------------------------------------------[INFO] BUILD FAILURE[INFO] ------------------------------------------------------------------------

Is there any way to prevent those errors?

@arcuri82
Copy link
Collaborator

@mmiguerodriguez hi. there is no known current issue aboutevomaster-e2e-tests-spring-rest-rsa. what is the error you are getting?

@mmiguerodriguez
Copy link
CollaboratorAuthor

mmiguerodriguez commentedNov 20, 2025
edited
Loading

I'm not completely sure what was the issue, perhaps different Java version used by Maven and IntelliJ builds...
I've modified my IntelliJ to use Java 17 and maven too. Now it's fixed.

I'll be reviewing why there's some errors on the build/tests. I've already made some of the adjustements.

@arcuri82
Copy link
Collaborator

@mmiguerodriguez ah, yes. we moved to JDK 17 recently... and might move to 21 in the near future

mmiguerodriguez reacted with thumbs up emoji

@mmiguerodriguez
Copy link
CollaboratorAuthor

We'll need to adjustfor_developers.md since it may be outdated.

arcuri82 reacted with thumbs up emoji

@arcuri82
Copy link
Collaborator

@mmiguerodriguez good point! i ll do now

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@arcuri82arcuri82arcuri82 requested changes

@jgaleottijgaleottijgaleotti requested changes

Requested changes must be addressed to merge this pull request.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

3 participants

@mmiguerodriguez@arcuri82@jgaleotti

[8]ページ先頭

©2009-2025 Movatter.jp