diff --git a/CHANGELOG.md b/CHANGELOG.md index e65771c6b6931a8460dec3af893af522b43437d9..54d7e05dbf3fe57eb204d905c39b215d2eb0b196 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 server property. * The new `FIND_QUERY_DEFAULT_ROLE` server property defaults to `RECORD` which is why the behavior of the server api has a **breaking change**. + * The semantics of `FIND *` are affected as well. `FIND *` is equivalent to + `FIND <FIND_QUERY_DEFAULT_ROLE>`. * Of course, administrators can choose to retain the old behavior by setting `FIND_QUERY_DEFAULT_ROLE=ENTITY`. diff --git a/src/main/java/org/caosdb/server/query/Query.java b/src/main/java/org/caosdb/server/query/Query.java index a517cbaaaaa81208dd3bb2613d2f20d4de0ec1f1..1171aa053ceae8a46003a3401954c7c1c347161b 100644 --- a/src/main/java/org/caosdb/server/query/Query.java +++ b/src/main/java/org/caosdb/server/query/Query.java @@ -596,16 +596,6 @@ public class Query implements QueryInterface, ToElementable, TransactionInterfac * </ol> */ public void optimize() { - // basic optimization - if (this.entity != null - && this.entity.type == Pattern.TYPE_LIKE - && this.entity.str.equals("*")) { - this.entity = null; - if (this.role == null) { - this.role = Role.ENTITY; - } - } - // "FIND Person" is interpreted as "FIND RECORD Person" if (this.role == null) { try { @@ -621,6 +611,13 @@ public class Query implements QueryInterface, ToElementable, TransactionInterfac throw new UnsupportedOperationException(e); } } + + // "FIND *" is interpreted as "FIND RECORD", "FIND <ROLE> *" as "FIND <ROLE>" + if (this.entity != null + && this.entity.type == Pattern.TYPE_LIKE + && this.entity.str.equals("*")) { + this.entity = null; + } } private String executeStrategy(final boolean versioned) throws QueryException {