Skip to content

v1.1.0

Compare
Choose a tag to compare
@cmgrote cmgrote released this 24 Aug 16:42

πŸŽ‰ New features

Fluent search

FluentSearch further simplifies searches. You can access the simplified searching using a new select() method in the same way you can use the all() method in v1.0.0. However, fluent search further simplifies and validates searches:

  • All attributes and search index fields are now defined as constants, so you no longer need to remember or deal with string values directly.
  • The predicates you can use to search a particular field are now accessible directly on these constants β€” and are restricted to those that apply to that kind of field. No more mistakenly using a gt to search on a boolean field, for example, or a startsWith on a numeric field. (These validations are also applied to custom metadata attributes, but only at runtime due to the runtime nature of custom metadata.)
  • You can now also directly get a count of results to a query using count() at the end of a fluent search chain, or directly translate the criteria defined in the chain into a search request using toRequest(). (All existing AssetFilter mechanisms also still apply to fluent searches: streaming, parallel streaming, etc.)
  • You no longer need to use or statically import the QueryFactory class β€” this has been replaced by a new CompoundQuery class that has static query helpers defined within it.
  • Aggregations are available within fluent searches.
  • The field constants also contain methods for sorting results by those fields, and for creating aggregations based on those fields.

For example, with an AssetFilter you would previously have written:

Column.all()
    .filter(QueryFactory.where(KeywordFields.QUALIFIED_NAME).startsWith("default/snowflake"))
    .batch(100)
    .attribute("description")
    .sort(QueryFactory.Sort.by(KeywordFields.NAME, SortOrder.Asc))
    .stream()
    .forEach(c -> {
        log.info("Column: {}", c);
    });

With the new FluentSearch you can now write the same as:

Column.select()
    .where(Column.QUALIFIED_NAME.startsWith("default/snowflake"))
    .pageSize(100)
    .includeOnResults(Column.DESCRIPTION)
    .sort(Column.NAME.order(SortOrder.Asc))
    .stream()
    .forEach(c -> {
        log.info("Column: {}", c);
    });

🐞 Bug fixes

  • Changes internal AssetBatch structures to be thread-safe
  • Fixes criteria for listing users to avoid an infinite loop

πŸͺ« Deprecations

  • The existing AssetFilter search simplification, its all() method, and the QueryFactory class all still exist, but they have all been marked as deprecated (and will be removed in the next major release).