<miso-hybrid-search>

The container of the Hybrid Search workflow. One query gets two things: the search results and an answer. Each arrives on its own, so the elements fall into two groups, and one container holds elements from one group only. Put the results in one <miso-hybrid-search> and the answer in another:

<miso-hybrid-search>
  <miso-query></miso-query>
</miso-hybrid-search>

<miso-hybrid-search>
  <miso-question></miso-question>
  <miso-answer></miso-answer>
  <miso-sources></miso-sources>
</miso-hybrid-search>

<miso-hybrid-search>
  <miso-total></miso-total>
  <miso-products></miso-products>
  <miso-more></miso-more>
</miso-hybrid-search>

All the containers connect to the same workflow, so the query box sends one query for both groups.

To build a Hybrid Search page, see Hybrid Search — Quick Start.

Elements

Search results

ElementShows
<miso-error>The error message shown when the workflow fails.
<miso-facets>The facet filters of the search results.
<miso-keywords>The query text the results are for.
<miso-more>The button that loads more search results.
<miso-products>The product results.
<miso-query>The query box.
<miso-sort>The sort order selector of the search results.
<miso-total>The total number of search results.

Answer

ElementShows
<miso-affiliation>The affiliate products that come with the answer.
<miso-answer>The generated answer.
<miso-feedback>The buttons that rate the answer.
<miso-images>The images that come with the answer.
<miso-question>The question being answered.
<miso-sources>The articles cited by the answer.

A container with elements from both groups stops with an error in the console: <miso-hybrid-search> cannot contain both … for they don't share the same data lifecycle.

Attributes

Controls the Miso logo at the end of the container.

ValueThe logo shows
Attribute left outWhen the container holds <miso-products> or <miso-answer>, once its data starts to arrive.
trueOnce the data of its group starts to arrive.
falseNever.

Any other value is an error. To turn the logo off in every <miso-hybrid-search>:

client.ui.hybridSearch.useLayouts({
  container: { logo: false },
});

visible-when

Shows the container only in the states it names. It also works on an element inside the container. The state is the state of the container's group: an answer container can be loading while the results are ready.

ValueShows the element when
initialThe workflow has not sent a request yet.
loadingThe request is out, and no data has arrived.
readyThe data is arriving or has arrived.
ongoingThe data is still arriving.
doneAll the data has arrived.
erroneousThe request failed.
emptyNo Miso element in the container has data.
nonemptyAt least one Miso element in the container has data.
  • Separate values with spaces to show the element in any of them: visible-when="initial loading".
  • Join a state to empty or nonempty with + to need both: visible-when="ready+empty".
  • Only the Miso elements that show data count toward empty and nonempty. The query box and the buttons do not.
  • The SDK shows the element with display: block !important. To lay it out as a flex row or a grid, put visible-when on a wrapper around it.

An answer container also has unanswerable when Miso has no answer for the query. visible-when="ready !unanswerable" shows the answer only when there is one.

Next