Gravatar for wvuong@captechconsulting.com

Question by wvuong, Jan 7, 2016 1:59 PM

Linking Search Page While Keeping Facet Selection Not Working

I am trying to link a search page,

e.g. http://localhost:3000/richmond/providers#t=tabGrid&sort=%40distance%20ascending&f:@fz95xspecialties2681_4ee8b18b93e742749856b8d9cc1e822f=[Primary%20Care]

but the facet selection is not maintained when the page loads, queries entered are maintained though. This has failed on IE, chrome, and firefox. I saw a thread here that states it should just work without any configuration.

Am I missing something? I am using JS Search 0.9

1 Reply
Gravatar for jflheureux@coveo.com

Answer by Jean-François L'Heureux, Jan 7, 2016 2:51 PM

Hi,

The facets in the state are stored with their id: f:Facet1ID=[Selected values].

It may be possible that the ID of your facets are different between page loads. If that happens, an URL from one "session" will contain the facet IDs of that session. The next page refresh would render different IDs and the state won't be able to match the selected values to the right facets anymore.

When the page loads, can you inspect the facet's main div element attributes? Is the data-id attribute value equals to "@fz95xspecialties2681_4ee8b18b93e742749856b8d9cc1e822f"?

If it's different, can you give me:

  • Your Coveo for Sitecore version (build number: 3.0.XXXX)
  • Your Sitecore version (7.X.YYMMDD or 8.X.YYMMDD)

As a workaround, you can specify a value in the "Unique Id" field of each of your facets in Sitecore. This is a field in the facet component properties.

I hope this helps,

Jeff

Gravatar for wvuong@captechconsulting.com

Comment by wvuong, Jan 7, 2016 3:06 PM

Current Coveo for Sitecore version: 3.0.1188.0

Current Sitecore version: 8.1.151003

You are right, the ID of the facet changes each time on page load. I specified a unique id and it works as expected.

Is this a bug?

Gravatar for jflheureux@coveo.com

Comment by Jean-François L'Heureux, Jan 7, 2016 4:24 PM

From my point of view, it is a bug. The generated data-id and id attributes values were introduced by an improvement we did months ago to improve the experience when 2 facets using the same field were present on a search page. It seems we didn't notice the generated IDs might change between page loads or when the facets are re-ordered which leads to an incapability to restore the facets state as you experienced.

We logged this issue and will investigate possible solutions on our side for the next release.

Thanks for your report.

Ask a question