Open Patrick386 opened 1 year ago
Hi @Patrick386 ,
Sorry for late reaction.
The recommended way to do it is to use the filters value of the SearchState
.
Your code should look as follows:
HitsSearcher hitsSearcher = HitsSearcher.create(
applicationID: AlgoliaCredentials.applicationID,
apiKey: AlgoliaCredentials.apiKey,
state: const SearchState(
indexName: 'company',
filters: 'published:true AND status:processing',
//query: '',
));
Otherwise you can use the FilterState component connected to your HitsSearcher
instance, which simplified the filter management.
@VladislavFitz the filters param in not there in SearchState
Hi @Patrick386 , Sorry for late reaction. The recommended way to do it is to use the filters value of the
SearchState
. Your code should look as follows:HitsSearcher hitsSearcher = HitsSearcher.create( applicationID: AlgoliaCredentials.applicationID, apiKey: AlgoliaCredentials.apiKey, state: const SearchState( indexName: 'company', filters: 'published:true AND status:processing', //query: '', ));
Otherwise you can use the FilterState component connected to your
HitsSearcher
instance, which simplified the filter management.
Thank you for your answer. By the way, the following code is the one I am currently using.
final FilterState filterState = FilterState()
..add(mainCategoryGroupID, [Filter.facet('mainCategory', category.main)])
..add(subCategoryGroupID, [])
..add(typeGroupID, [])
..add(tagGroupID, []);
HitsSearcher hitsSearcher = HitsSearcher(
applicationID: AlgoliaCredentials.applicationID,
apiKey: AlgoliaCredentials.apiKey,
indexName: AlgoliaCredentials.discoveryIndex,
)..connectFilterState(filterState);
I will try applying the recommended code. Thank you for your helpful response.
Cloud functions
attributesForFaceting: [ ‘filterOnly(status)’, ‘filterOnly(published)’, ],
client:
I want to create a page that has status ‘processing’ and published ‘true’. How do I do that?