Search widget features
Widget features are passed as a comma-separated list in the features
attribute of the <nuclia-search-bar>
tag:
<script src="https://cdn.nuclia.cloud/nuclia-video-widget.umd.js"></script>
<nuclia-search-bar
knowledgebox="YOUR-KB"
zone="ZONE"
features="answers,filter"
></nuclia-search-bar>
<nuclia-search-results></nuclia-search-results>
For the correct reading of the results, the width of the search bar should not be less than 384px.
If your search page background color isn't neutral, remember to add a background color on your search box to make it easier to read.
Generative answers
Answer generation
This feature will trigger the answer generation process when the user makes a search.
The first answer is displayed between the search bar and the results, and by clicking on Ask more, the user can access the full chat interface.
User prompt
Allows the user to provide a custom prompt to the generative model, it will take precedence over the prompt defined in the Knowledge Box AI models settings if any. It must use {context}
and {question}
variables.
Example:
Taking into account our previous conversation, and this context: {context} answer this {question}
Citations
When enabled, the generative answer will include citations, meaning that the answer will be followed by a list of the sources (among the sources returned by the search) that have been actually used to generate the answer.
This feature can make the response time longer.
Specific generative model
Allows the user to specify a generative model to use for the answer generation. It will take precedence over the model defined in the Knowledge Box AI models settings if any.
Hide results
Hide the search results, only the generative answer will be displayed (and its citations if any).
Only semantic results for answers
When enabled, answers will be generated using semantic results only.
Note: by default, it is based on both semantic and BM25 results.
Not enough data message
Allow to replace the default message displayed when there is not enough data to generate an answer.
RAG strategies
- Pass the entire resources as context: instead of passing only the most relevant text blocks returned by the search, the entire resources will be passed as context to the generative model.
- Pass specific field(s) as context: allow the user to force the generative model to use specific fields as context. Example: for any matching resource in the search results, pass the field named
last-update
if defined in the resource.
Search & filtering
Filter
This feature displays in the search bar a dropdown menu listing all the existing labels, allowing the user to filter the results by label.
Automatic filtering
This feature detects entities mentioned in the user query and turns them automatically into filters.
Preselected filters
Define filters that will be applied by default to any query.
Example:
/icon/application/pdf
/metadata.languages/fr
Match synonyms
Use the synonyms defined in the Knowledge Box to match the user query.
Suggestions
This feature displays a list of suggestions when the user starts typing in the search bar.
Navigation
Permalink
If you want users to be able to share a resource preview with a friend or a colleague, enable permalink mode by adding the permalink
attribute to <nuclia-widget>
in your code snippet.
Navigate to links
When a search result is a link field, or has an URL in the origin
metadata, this feature will redirect the user to the URL when clicking on the result instead of displaying the default viewer.
Navigate to files
When a search result is a file field, this feature will open the file in the browser when clicking on the result instead of displaying the default viewer.
When the widget is displaying results, it adds corresponding search query and criteria to the URL, allowing the widget to re-render the same results upon loading.
Similarly, when the widget is showing a resource, it adds the resource id to the URL, allowing the widget to render this resource directly upon loading.