I have a Coveo facet
By City is configured based on a computed field citystate, I have some doctors that are virtual care only, to make sure the facet will show their allowed states I added "virtual care, state" into the citystate computed field
, the results are shown as follows:
!!! There is some requirement changes !!!
Business does not like the "virtual care, state" into the citystate computed field
, but I do have 2 other computed field
for virtual care only doctors: isvirtualonly (bool) and state (array of string) which contains all states this doctor is allowed to provide virtual care service.
I need to capture the event that when user click on the city in the facet, for example, Luverne, Minnesota, I need to modify the query to include all virtual care doctors that meet other search criteria not limited to city matches citystate computed field
, but also include those virtual only doctors that their states contains Minnesota.
Thanks Sumit Bhatia
suggestion I was able to capture the unique states selected by the By City facet
as shown in the following code snippet:
if (document.getElementById('doctors-facet-by-city') !== null) {
citystateFacet = Coveo.get(document.getElementById('doctors-facet-by-city')).getSelectedValues();
if (citystateFacet.length > 0) {
let states = getDistinctStates(citystateFacet);
for (var i = 0; i < states.length; i++) {
console.log('state: ' + states[i]);
}
}
}
When I selected 2 cities, I do see the aq has this value:
(@fcitystate16243==("Fargo, North Dakota","Luverne, Minnesota")) ((((@fz95xpath16243=5410849302FA49E39DD6C42DBE11367C @fz95xid16243<>5410849302FA49E39DD6C42DBE11367C) @fz95xtemplate16243==48A5EFB48E8B44E7B2579921FB3F79E2) NOT @fz95xtemplate16243==(ADB6CA4F03EF4F47B9AC9CE2BA53FF97,FE5DD82648C6436DB87A7C4210C7413B))) ($qre(expression:@fprimaryspeciality16243 == "aaron ", modifier:'100'))
How do I modify the query in a way to make sure all other conditions are met, not just those doctors with (@fcitystate16243==("Fargo, North Dakota","Luverne, Minnesota"))
but include state
matches selected states and isvirtualcare
is true?