dint-dev/database

Any way to manually serialize the data coming from algolia?

Closed this issue · 2 comments

Is there a way to convert the default response List to a custom json object, so we can run it though a custom serialized class?

List<Hit> _tmpData = List<Hit>();
    Stream<QueryResult> tmp =
        _algoliaDb.collection('airportData').searchIncrementally(
              reach: Reach.server,
              query: Query.parse(query),
            );
    tmp.listen(
      (event) {
        for (var item in event.items) {
          final _tmp = json.encode(Hit.fromJson(item.data));
          _tmpData.add(
            Hit.fromJson(
              json.decode(_tmp),
            ),
          );
        }
      },
    )

Currently I am doing it this way but, would be nice if there was an option within the package itself.

Thanks for the feature request! I'll look at this.

I added vendorData field in Snapshot, QueryResult, and QueryResultItem classes. Algolia and ElasticSearch adapters use the field to expose the raw JSON data.

This is available in version 0.3.2.