Get only filtered results back from API query.

Hi everyone,

I am filtering values with a custom algolia action that takes doubles and feedback results greater than or equal to the input.

I am then updating my appstate which is a json list with the results, to then generate dynamic children from the app state.

However, the result i get is a list of my entire index and not just the users which have values greater than or equal to the value that is input.

Does anyone see where I am going wrong? screenshots and code are below:

Future<dynamic> filterquery(
  LatLng? location,
  double? playeravg,
  double? awarenessavg,
  double? strengthavg,
  double? abilityavg,
  double? paceavg,
) async {
  final client = SearchClient(
    appId: '',
    apiKey: '',
  );

  final queryHits = SearchForHits(
    indexName: 'users', // Replace 'users' with your actual index name
    query: '',
    facetFilters: [
      'playeravg >= $playeravg',
      'awarenessavg >= $awarenessavg',
      'strengthavg >= $strengthavg',
      'abilityavg >= $abilityavg',
      'paceavg >= $paceavg',
    ],
  );

  final responseHits = await client.browse(indexName: 'users');

  return responseHits.toJson();
}

7 replies