Giter Club home page Giter Club logo

elastic_app_search's People

Contributors

julienlebren avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

elastic_app_search's Issues

Add engine field in ElasticResultMeta

I try to use meta engine on my project. But ElasticResultMeta does not have engine field.
According to https://www.elastic.co/guide/en/app-search/current/meta-engines-guide.html

I suggest to add this line.

@freezed
class ElasticResultMeta with _$ElasticResultMeta {
  factory ElasticResultMeta({
    /// The relevance of the result
    double? score,
    String? engine, // <-- add this to model
  }) = _ElasticResultMeta;

  factory ElasticResultMeta.fromJson(Map<String, dynamic> json) =>
      _$ElasticResultMetaFromJson(json);
}

ElasticQuery systematically raises an assert error due to queryPrecision parameter.

ElasticQuery systematically raises an assert error due to queryPrecision parameter.

flutter: 'package:elastic_app_search[/elastic_app_search.freezed.dart]()': Failed assertion: line 296 pos 13: 'queryPrecision != null &&
package:elastic_app_search/elastic_app_search.freezed.dart:296
                (queryPrecision < 1 || queryPrecision > 11)': The value of the precision parameter must be an integer between 1 and 11, inclusive.

Number Range Filter type casting in Elastic Request

Whenever I attempt to add a range filter to a "number" result field, the resultant query takes my input (a double) and converts to a string.

Example:

Flutter end

ElasticAppSearch(...)
  .engine('example')
  .query('')
  .filter('price',
    isGreaterThanOrEqualTo: 80.0, isLessTan: 100.0);
  .get();

Request as displayed in Kibana

{
  "query": "",
  "page": {
    "size": 20,
    "current": 1
  },
  "filters": {
    "all": [
      {
        "price": {
          "from": "80.0",
          "to": "100.0"
        }
      }
    ],
    "none": [],
    "any": []
  }
}

Response

{
  "errors": [
    "Filters 'from' must be a number for field: price",
    "Filters 'to' must be a number for field: price"
  ]
}

I would also like to note that if the input is changed to an int value, then null is produced for the price filter section of the query.

Example:

Flutter end

ElasticAppSearch(...)
  .engine('example')
  .query('')
  .filter('price',
    isGreaterThanOrEqualTo: 80, isLessTan: 100);
  .get();

Request as displayed in Kibana

{
  "query": "",
  "page": {
    "size": 20,
    "current": 1
  },
  "filters": {
    "all": [
      {
        {
          "price": null
        }
      }
    ],
    "none": [],
    "any": []
  }
}

Response

{
  "errors": [
    "Filters contains invalid value for field: price; must be a number, an array of numbers, or a range object with `to` and/or `from` keys"
  ]
}

I tried to debug this in your src code, but it does seem you are casting "from" and "to" as double. I'm not sure what the issue is. Is there something I'm missing on my end? Otherwise great package, very useful in my case :)

Print statements in package

This package is great for using elastic app search.

Noticed that there are print statements in the package (v 0.3.0) code which are not controlled from app using this package.

Two ways to solve it -

  1. Remove print statements
  2. Make it configurable from app while defining elastic service or while querying.

Files with print statements -

lib/src/service.dart
lib/src/result.dart

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.