-
Notifications
You must be signed in to change notification settings - Fork 103
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
jgaleotti
left a comment
There was a problem hiding this 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
| import org.evomaster.client.java.controller.opensearch.selectors.MatchSelector; | ||
| import org.evomaster.client.java.controller.opensearch.selectors.QuerySelector; | ||
|
|
||
| public class OpenSearchQueryParser { |
There was a problem hiding this comment.
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.
.../src/main/java/org/evomaster/client/java/controller/opensearch/utils/ParameterExtractor.java
Show resolved
Hide resolved
...c/main/java/org/evomaster/client/java/controller/opensearch/utils/OpenSearchQueryHelper.java
Show resolved
Hide resolved
arcuri82
left a comment
There was a problem hiding this 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
...ain/java/org/evomaster/client/java/controller/opensearch/OpenSearchHeuristicsCalculator.java
Show resolved
Hide resolved
...ain/java/org/evomaster/client/java/controller/opensearch/OpenSearchHeuristicsCalculator.java
Show resolved
Hide resolved
|
|
||
| try { | ||
| // Create pattern with case insensitive flag if needed | ||
| java.util.regex.Pattern pattern; |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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?
...ain/java/org/evomaster/client/java/controller/opensearch/OpenSearchHeuristicsCalculator.java
Outdated
Show resolved
Hide resolved
...-tests/spring/spring-rest-opensearch/src/main/java/com/opensearch/age/OpenSearchAgeRest.java
Outdated
Show resolved
Hide resolved
| Solution<RestIndividual> solution = initAndRun(args); | ||
|
|
||
| // assertHasAtLeastOne(solution, HttpVerb.GET, 404, "/students/{q}", null); | ||
| assertHasAtLeastOne(solution, HttpVerb.GET, 200, "/students/{lastName}", null); |
There was a problem hiding this comment.
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
| // Term selector tests | ||
| @GetMapping("category/{category}") | ||
| public List<Product> findByCategory(@PathVariable String category) throws IOException { | ||
| return productRepository.findByCategory(category); |
There was a problem hiding this comment.
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
...test/java/org/evomaster/e2etests/spring/rest/opensearch/queries/OpenSearchQueriesEMTest.java
Outdated
Show resolved
Hide resolved
| } | ||
|
|
||
| @Test | ||
| public void testRangeQueries() throws Throwable { |
There was a problem hiding this comment.
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 pass args parameters to specify them, eg, with --endpointPrefix
...spring/spring-rest-opensearch/src/main/java/com/opensearch/queries/OpenSearchQueriesApp.java
Show resolved
Hide resolved
|
@arcuri82 is there any known issue with the Is there any way to prevent those errors? |
|
@mmiguerodriguez hi. there is no known current issue about |
|
I'm not completely sure what was the issue, perhaps different Java version used by Maven and IntelliJ builds... I'll be reviewing why there's some errors on the build/tests. I've already made some of the adjustements. |
|
@mmiguerodriguez ah, yes. we moved to JDK 17 recently... and might move to 21 in the near future |
|
We'll need to adjust |
|
@mmiguerodriguez good point! i ll do now |
|
Hi @mmiguerodriguez is a copy paste error from SutController.initMongoHanlder(). In this method, the call is made to MongoHandler.handle(MongoCollectionSchema), not to MongoHanlder.handle(MongoFindCommand). In other words, this code is used to infer the expected classes of each Mongo collection, not to handle specific queries that were issued during initialization. |
|
Is this causing issues on the release? I’ll be reviewing it. |
|
No, it is not causing issues in the release, but it would be nice to get this fixed in this PR |
|
@jgaleotti I think we can review this once more, I've already modified the issue you've mentioned, along with the original motivation of this PR. There's tests which are commented since we still don't have OpenSearch queries generation yet. |
| <configuration> | ||
| <reuseForks>false</reuseForks> | ||
| <environmentVariables> | ||
| <DOCKER_HOST>unix:///Users/miguerodrigu/.colima/default/docker.sock</DOCKER_HOST> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to be wrong
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will remove this default config, forgot to change it, was trying different IDEs...
No description provided.