Hi there!
I am not a programmer of any sort, just a self thought enthus seeking some guidance ๐
I have been trying to use Facets in Algolia to filter in my App, but I am having a hard time.
Does any one know how to filter results in FF Listview using Algolia Facets?
FYI:
FF>Firebase>Algolia already connected and syncยดd
I already get the desired results in my listview search using a textbox linked to the searchable terms in Algolia
But I want to further filter the results by the following filters:
hasParking
hasPool
bedrooms
bathooms
price
... etc.
My Facets are already set up as "filter only"
My page States already has these variables
My toggle buttons are already bound to the Page states
My actions in each toggle button are already programed to do a page state update to true or false
Through AI I got this custom code below but I dont know how to plug it into my search.
I dont know if I also need to import Algolia Search from pub.dev
I just need to know how bind/program this code to further filter the results
Any help is welcomed
import 'dart:convert';
import 'dart:math' as math;
import 'package:flutter/material.dart';
import 'package:google_fonts/google_fonts.dart';
import 'package:intl/intl.dart';
import 'package:timeago/timeago.dart' as timeago;
import '/flutter_flow/custom_functions.dart';
import '/flutter_flow/lat_lng.dart';
import '/flutter_flow/place.dart';
import '/flutter_flow/uploaded_file.dart';
import '/backend/backend.dart';
import 'package:cloud_firestore/cloud_firestore.dart';
import '/backend/schema/enums/enums.dart';
import '/auth/firebase_auth/auth_util.dart';
String buildAlgoliaFilters(
bool hasAirConditioner,
bool isFurnished,
bool hasElevator,
bool hasBalcony,
bool hasHeater,
bool closeToMetro,
bool isExterior,
bool hasParking,
bool hasPool,
bool hasTerrace,
) {
/// MODIFY CODE ONLY BELOW THIS LINE
List<String> filters = [];
if (hasAirConditioner) filters.add("hasAirConditioner:true");
if (isFurnished) filters.add("isFurnished:true");
if (hasElevator) filters.add("hasElevator:true");
if (hasBalcony) filters.add("hasBalcony:true");
if (hasHeater) filters.add("hasHeater:true");
if (closeToMetro) filters.add("closeToMetro:true");
if (isExterior) filters.add("isExterior:true");
if (hasParking) filters.add("hasParking:true");
if (hasPool) filters.add("hasPool:true");
if (hasTerrace) filters.add("hasTerrace:true");
return filters.join(" AND ");
/// MODIFY CODE ONLY ABOVE THIS LINE
}