This repository has been archived by the owner on Dec 22, 2022. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
issue [pds-api-54]: wildcard searching (#15)
* rework of grammar to QueryBuilder(s) Updated the pom to use the correct version of ANTLR. Updated ElasticSearchRegistrySearchRequestBuilder to make log output clearer for isolating current problems. Reworked Antlr4SearchListener to get the wildcard request right. Gave it state and a stack which it processes more or less uniformly. Groups are the same as the parent such that if there are no () there are no sub boolean query groups. Then added the groups which add the current stack level onto the group and then shift up one when the groups ends. The and/or expressions similarly handle the conjunction in use the same way. However their stack levels need be the same. This allows (x) to be processed the same as (x and y and (w or u or v)) without and special checking or branching. Antlr4SearchListenerTest was added to verify that the stack works correctly with respect to tranforming the grammar to a set of QueryBuilder(s). The only one being tested currently is the wildcard but many more should be added. * tiny cleanup * step forward on testing Fix erroneous stack handling in Antlr4SearchListener. Fix up the second test to show that the group does work. * test updates Tested the bulk of the grammar but need to do nested groups and find a way to verify the and/or statements are correctly stacked. * update unit testing Completed the testing with nested conditionals and a not group. Also added negative checks that should result in bad parsing. They are handled by forcing ANTLR to bail when there is a problem rather than doing the best it can. * removed clutter * update error handling and testing Added catch block to change any parsing error into an HTTP 422 (unprocessable entity). Searching on the web indicated that this error is the most appropriate in that that the syntax is sufficient to pass all URL tests and get routed to the proper processing unit (the lexer) but it cannot understand it semantically (from the standpoint of the URL). Changed the testing to JUnit test. * updated POM to latest lexer * make errors uniform and add logging * fix not group * verification tool for acceptance criteria * make URL more readable because requests helps * fix details Fixing "a eq b" required updating the api-search-query-lexer that had some fallout here. Maining that ctx.FIELD() now requires a parameter for which of them is being requested. The quoting option of a eq "b" should not carry quotes into search request. * change http error code * FIELD conversion as required by elasticsearch backend * add requested comment Co-authored-by: Al Niessner <[email protected]>
- Loading branch information