Ported changed made for version 4.1.1
This commit is contained in:
parent
a204a2ec6c
commit
c9e3f8c8c3
|
@ -6,6 +6,10 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
|
||||||
|
|
||||||
- Switched to gcube-smartgears-bom 3.0.0
|
- Switched to gcube-smartgears-bom 3.0.0
|
||||||
|
|
||||||
|
## [v4.1.1]
|
||||||
|
|
||||||
|
- Fixed bug on JSONQuery for Facets which does not have any properties to match [#24237]
|
||||||
|
|
||||||
|
|
||||||
## [v4.1.0-SNAPSHOT]
|
## [v4.1.0-SNAPSHOT]
|
||||||
|
|
||||||
|
|
|
@ -120,7 +120,10 @@ public class JsonQuery {
|
||||||
Map<String, Object> map = new HashMap<>();
|
Map<String, Object> map = new HashMap<>();
|
||||||
map.put("limit", JsonQuery.UNBOUNDED_LIMIT);
|
map.put("limit", JsonQuery.UNBOUNDED_LIMIT);
|
||||||
|
|
||||||
OResultSet resultSet = oDatabaseDocument.query(stringBuffer.toString(), map);
|
String query = stringBuffer.toString();
|
||||||
|
logger.trace("Going to execute the following query:\n{} \n from the JSONQuery\n{}", query, objectMapper.writeValueAsString(jsonQuery));
|
||||||
|
|
||||||
|
OResultSet resultSet = oDatabaseDocument.query(query, map);
|
||||||
|
|
||||||
ArrayNode arrayNode = objectMapper.createArrayNode();
|
ArrayNode arrayNode = objectMapper.createArrayNode();
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,8 @@ public class JsonQueryFacet extends JsonQueryEntity {
|
||||||
public StringBuffer analize(StringBuffer stringBuffer) throws SchemaException, ResourceRegistryException {
|
public StringBuffer analize(StringBuffer stringBuffer) throws SchemaException, ResourceRegistryException {
|
||||||
StringBuffer newBuffer = new StringBuffer();
|
StringBuffer newBuffer = new StringBuffer();
|
||||||
|
|
||||||
|
int size = jsonNode.size();
|
||||||
|
|
||||||
boolean entry = entryPoint;
|
boolean entry = entryPoint;
|
||||||
if(jsonNode.has(_IN)) {
|
if(jsonNode.has(_IN)) {
|
||||||
if(!entryPoint) {
|
if(!entryPoint) {
|
||||||
|
@ -35,9 +37,14 @@ public class JsonQueryFacet extends JsonQueryEntity {
|
||||||
jsonQueryConsistsOf.setDirection(Direction.OUT);
|
jsonQueryConsistsOf.setDirection(Direction.OUT);
|
||||||
stringBuffer = jsonQueryConsistsOf.analize(stringBuffer);
|
stringBuffer = jsonQueryConsistsOf.analize(stringBuffer);
|
||||||
entry = false;
|
entry = false;
|
||||||
|
|
||||||
|
/* Need to substract 1 from size otherwise
|
||||||
|
* it add WHERE at the end because _in
|
||||||
|
* is not a property to be used for a WHERE compare
|
||||||
|
*/
|
||||||
|
--size;
|
||||||
}
|
}
|
||||||
|
|
||||||
int size = jsonNode.size();
|
|
||||||
newBuffer.append("SELECT FROM ");
|
newBuffer.append("SELECT FROM ");
|
||||||
|
|
||||||
if(!entry) {
|
if(!entry) {
|
||||||
|
|
|
@ -66,7 +66,7 @@ public class JsonQueryTest extends ContextTest {
|
||||||
@Test
|
@Test
|
||||||
public void testSingleCreateQuery() throws Exception {
|
public void testSingleCreateQuery() throws Exception {
|
||||||
File queriesDirectory = getQueriesDirectory();
|
File queriesDirectory = getQueriesDirectory();
|
||||||
File jsonQueryFile = new File(queriesDirectory, "query5.json");
|
File jsonQueryFile = new File(queriesDirectory, "query7.json");
|
||||||
ObjectMapper objectMapper = new ObjectMapper();
|
ObjectMapper objectMapper = new ObjectMapper();
|
||||||
JsonNode jsonNode = objectMapper.readTree(jsonQueryFile);
|
JsonNode jsonNode = objectMapper.readTree(jsonQueryFile);
|
||||||
logger.info("Going to test the following JSON query {}", jsonNode.toString());
|
logger.info("Going to test the following JSON query {}", jsonNode.toString());
|
||||||
|
|
Loading…
Reference in New Issue