Search or Ask

One search field that also answers questions. A visitor who types a name gets results, as always. A visitor who types a question gets results too, and an offer to have it answered, in writing, from your own records.

Search or ask is built into Indx Server. It needs no change to your data, and the search itself works exactly as before whether the feature is on or off.

How It Works

On each pause in typing, a fast judge reads what has been typed and the top results, and decides what the visitor is doing:

  • Looking something up: a name, a code, a keyword. The results are the answer, and nothing more is offered.
  • Asking a question: how to do something, why something happens, which of two things to choose. The page offers to answer it.
  • Describing what to list (catalogues only): "a funny space movie from the 80s", "private schools in Bergen". The description can become filters on the list.

The offer appears as the visitor types and goes away when they keep typing a name. When the visitor asks, an answer model writes the answer from the records the search found, citing them. It uses those records and nothing else, and says so when they do not hold the answer.

The judge takes a fraction of a second and costs about five cents per thousand calls. The answer is written only when the visitor asks for it.


When It Fits

Search or ask has two kinds, and the dataset's records decide which one fits.

KindRecordsWhat an answer does
Documentation
Written to explain: help pages, manuals, policies, long descriptions
Says what no single page shows, from the pages that hold it
Catalogue
Facts about things: products, places, films, organisations
Turns a description into filters, and answers a question about one item from its fields

Records of identifiers alone, such as part numbers or codes, fit neither. Their visitors look things up, and the search already serves them.


Turning It On

Three switches, each with its own owner:

  1. The instance gets its model keys. In the console, Admin > Settings > Experimental, show Search or ask and save a key for each provider you use, or set them in the configuration as Indx:SearchOrAsk:Keys:OpenRouter, Keys:OpenAi, Keys:Anthropic and Keys:TypeSafe. Then choose a provider for the judge and one for the answers; switching later is a choice, not a new key. One OpenRouter key serves both. One OpenAI key does too: OpenAI for the answers (Sol and Luna by default, Ultrafast if you want it) and OpenAI's Decisions API as the judge. Anthropic, or any other OpenAI-compatible endpoint, can write the answers as well. The models offered are read from the provider's own list. Keep requests in the EU uses OpenRouter's EU endpoint for the answers, or OpenAI's EU data residency for everything. Both need the right account first: OpenRouter serves its EU endpoint only on a Business or Enterprise plan, and OpenAI's needs a key from a project created with Europe as its region. Without it every answer is refused. When a provider refuses a call, the Search or ask tab and the settings page show its own reason and what to do.
  2. The dataset shows it. A team admin turns on Search or ask on the dataset's Options tab. Until then, its routes answer 404 as if they were not there.
  3. The dataset switches it on. An editor sets it up on its own Search or ask tab and turns on Offer answers.

Privacy. With Search or ask on, what visitors type leaves your server: to the judge on each pause, and to the answer model when they ask. Name the providers in your privacy notice. The Search or ask tab says who they are.

The tab has a tester beside the settings: type as a visitor would and see the offer, the results the judge read, and the answer, with your settings saved or not. Each score is drawn against the thresholds it is held to, so you see how near an offer was.


Settings

Every setting has an explanation on its name in the console. Here they are in one place.

The site

SettingWhat it does
Kind of site
Documentation or catalogue, as above. It changes the questions the judge asks and how answers are written.
About the site
One or two sentences the judge and the answer model read with every request: who reads the site and what the records hold.
About the fields (catalogue)
What a value means on this site, one per line, such as barneskole: grades 1 to 7. It lets "schools for young children" become the right filter.
Knowledge
Markdown with what is true about the site that no record holds: what the set covers, what a rating means, that prices include VAT, delivery times, what you do not sell. An answer may state it, saying the site says so; about a particular record, the record decides. Up to 8,000 characters, sent with every question, never to the judge. Download and upload it as .md.

The answers

SettingWhat it does
Answers
The model that writes the answers. Best quality and Fast are the instance's two; an admin can offer more in Admin > Settings > Experimental. Where a model has answered on the dataset, the time to its first words over the last 30 days is shown beside it.
Searches
On a catalogue: Several, an agent that searches, sorts and filters until it has the answer, about 10 seconds; or One search, quicker and cheaper, which misses what a single search cannot see. Until you choose, the best quality model searches several times and the fast one once. The agent can filter on one of several values or leave one out, is told whether its words matched exactly or with a typo, reads a record whole when the answer depends on what it says, and reads its cold storage (the public and answer items, never private).
Answer instructions
How the answers speak: voice, house rules, what to say when nothing is found. They shape the wording; what an answer may claim stays bound to the records.
Answer language
The visitor's language by default, or one language for every answer.
Daily call budget
Calls per day, counted from midnight UTC. Every judgement, every question asked and every filter the model makes while a visitor types is one call. Once the budget is spent, the search works as before and no offers show until midnight. 0 stops all calls. Default 5,000.

What the judge sees of a result

The judge reads five results, each as three parts:

  • Title: the field that names a result.
  • Section: short facts about the result, its values joined by semicolons and never cut.
  • Snippet: the prose the judge reads and answers are written from, cut at 240 characters.

Automatic chooses all three from a sample of your records and your field roles, and chooses again when the roles change or the number of records doubles:

  • Title: the searchable field with the highest weight.
  • Snippet: the prose, fields whose values are long sentences. At most two, and none when the records hold none.
  • Section: up to six short facts, by the rule below, the fields you made searchable, facetable or filterable first. Never codes, a number only when it is a year, never a value nearly every record has, and never a field another one already says (the category above a class).

In our tests on films, furniture and schools it chose as well as fields picked by hand. Choose yourself when your visitors ask about something a sample of the records cannot tell.

The judge can only tell a list that holds what the visitor means from one that just shares the words when what the visitor names is in front of it. Whether Automatic chooses or you do, the rule is the same: put in the section the short facts your visitors name besides the item's name. If visitors ask who wrote a book, the author goes in. If they search for gray sofas, the colour goes in.

  • Look at what your visitors type. Where the dataset has searches in its statistics, see which fields the words of the frequent ones match, besides the title. Without statistics, picture your visitors and what they ask.
  • When unsure, include the field. In our tests a missing field cost a lot: on a furniture shop the judge told the right lists from the wrong ones far more often with colour, material and style in the section than with the category alone. A field nobody asked about cost little or nothing, and an extra field does not make the judge slower.
  • Values that read on their own. The judge sees the values without the field names, so codes and ids tell it nothing. A true/false field is shown as its name when true and left out when false, so give it a name a reader understands, such as isPrivateSchool or upholstered.
  • Not the same thing twice, such as a category and a class that hold the same value.
  • A list of short items can go in whole, such as ten actors. Leave out a list of hundreds.

Anything visitors name belongs in the section, not the snippet: a field after a long description is cut away. Snippets are prose, longest first; never identifiers or links.

If visitors ask aboutSection
Who made a film, who is in it
genres, release_year, director, writers, actors
The colour, material and style of a product
class, color, material, style
A school's kind and place
municipality, categories, language

What the list searches while a question is typed

The list searches what the visitor types, question words and all. The judge reads a question from its first word, in any language, and the invitation comes from it. (Until November 2026 a list of Ask phrases took lead-ins such as "help me find the movie about" off the text before searching; that list and its switches are gone.)

When to offer

First, how forward the offer is. The mode goes from the most careful to the most forward:

ModeWhat the visitor sees
Strict
Only the full offer, once the judge is sure it is a question. For a site where a wrong offer costs more than a missed one.
Soft (the default)
The quieter Ask about this early, the full offer once the judge is sure.
Open
An Ask button whenever something is typed, and Enter asks, whatever the judge says. The judge decides only how strong the offer looks.
Inviting
Open, with For a quick answer, type a bit more and a highlight sweeping across it as soon as the judge reads a question starting, from the first word, and on anything typed like a sentence (three words, or a question mark) before the judge has read it. The answer waits until the visitor asks. Made to teach visitors that the field answers.
Proactive
Inviting, and the answer starts on its own once the judge is sure, reads the question as finished, and the visitor has stopped typing for a second. what type is is still being typed and waits.

Proactive writes answers nobody clicked for, so it has a cap of its own: Proactive answers, 500 a day by default. Past it the field works as Inviting until midnight UTC.

The early invitation has a threshold of its own, Hint, low on purpose: the judge scores a question's first word (How, Hvordan) above a name or a place, in any language. Its default depends on the judge: with Jev 0.25 on a catalogue and 0.31 on documentation, where lookups score higher; with OpenAI's Decisions API 0.05, since it scores almost nothing between a lookup and a question.

Then the scores. The judge scores what is typed from 0, a lookup, to 1, a question. Two offers, each with two thresholds:

OfferShowsDefault
Answer offer
Ask the assistant, which Enter asks
from 0.65, kept down to 0.45
Invitation
the quieter Ask about this
from 0.40, kept down to 0.30

The second number keeps an offer up while the score dips, so it does not blink as the visitor types on. On a catalogue, a sure description of what to list earns the full offer too.

In every mode the answer offer also waits for a Whole question: until the judge reads the question as finished (0.5 by default), what type is gets the invitation, and Proactive answers nothing.

No mode offers anything while asking could not be answered: once the day's budget is spent, and while the model provider refuses answers (out of credit, a key refused). The provider's refusal pauses the offers for two minutes, then longer each time it repeats, up to half an hour; they come back on their own. The search is untouched either way.

While asking

What the page does with its list while the full offer is up:

  • The list stays as the search found it. Where the judge reads what is asked about as not in the results (Found below, 0.3 by default; 0 turns it off), the page dims it, with a line above it, so the offer is read first. (Until November 2026 the list could be cut to the strong matches; a question is nearly always a search where no record holds every word, so it emptied the list under most questions, and it is gone.)
  • Matching: the page's searches match whole words only, so a long question does not pick up typos and partial words everywhere. The answer still searches with the full setup.
  • Filters (catalogue): when the text describes what to list, filter the list only after the visitor asks, at once from facet values (instant), or with the model (about a second and a half).

Building It Into a Page

intrface has Search or ask ready made in three shapes. Each goes inside your SearchProvider, follows the dataset's mode, and is an ordinary search where Search or ask is off.

  • SearchPage is a whole search page: a title, your filters on the left, the field and the results on the right, with no background of its own, so it sits on your page as part of it. Asking switches the page to ask mode: the field and the filters step aside, and the conversation takes the full width with the assistant's picks under it. Back to search returns the page with the question in the field.
  • SearchOrAsk is a search component for a place on a page of yours: the field, the results, and beside them a column that two buttons switch between your filters and the assistant. The answer stays in the column while the list becomes what the assistant found.
  • AskChat is a support chat for a help or docs site: a launcher in the corner opens a chat window with an intro, example questions and follow-ups. actions adds your own ways on, such as Talk to a person.
tsx
import { SearchProvider, SearchPage, ValueFilterPanel } from '@indxsearch/intrface';

export default function App() {
  return (
    <SearchProvider url="https://your-server" team="your-team" dataset="your-dataset"
                    preAuthenticatedToken="a Search key" allowEmptySearch>
      <SearchPage
        title="Films"
        filters={<ValueFilterPanel field="genres" label="Genres" />}
        renderResult={item => <h3>{item.title}</h3>}
        examples={['Films about grief', 'Who directed Titanic?']} />
    </SearchProvider>
  );
}

SearchOrAsk takes the same filters, renderResult and examples. All three take words and labels for your language and voice; SearchPage and SearchOrAsk take results for the rest of SearchResults' props, and restore for your page's own start (a default order), run again when Clear takes off an order the assistant put on.

A page of your own

The three are built from parts you can use yourself:

tsx
import {
  SearchInput, SearchResults, AskOffer, AskPanel, useSearchOrAsk, useAskFlow,
} from '@indxsearch/intrface';

function Search() {
  const sor = useSearchOrAsk();
  const flow = useAskFlow({ searchOrAsk: sor });
  return (
    <>
      <SearchInput askOffer="door" {...flow.inputProps} />
      {flow.offerShown && <AskOffer searchOrAsk={sor} onAsk={flow.ask} />}
      {flow.question && <AskPanel key={flow.run} {...flow.panelProps} followUps />}
      {!flow.waiting && <SearchResults fields={['title', 'description']} searchOrAsk={sor} />}
    </>
  );
}
  • useSearchOrAsk() reads the dataset's settings and asks the judge on each pause, and while the visitor types too, so the offer can appear as soon as they stop; prefetch: false waits for the pause. mode lets one page choose its own, such as strict on a checkout page; proactive applies only where the dataset is set to proactive, and is inviting elsewhere. It says what each surface should show: door, offerRow, offerKind and enterAsks, for a page that draws its own.
  • useAskFlow() is what happens around an answer. Asking turns the page to it, and the page waits for the assistant and then for the search with the filters it read, so the question's own list does not flash first. Typing hands the field back to the search, a proactive start leaves the page as the visitor has it, and Clear takes off an order the assistant put on. Spread inputProps on SearchInput and panelProps on AskPanel.
  • SearchInput with askOffer="door" has a quiet Ask in the field wherever the mode allows asking, with the same words every time. Enter asks on the sure offer only, and otherwise searches. In Proactive it starts the answer on its own once the judge is sure. The default, askOffer="chip", puts the whole offer in the field instead, for a page without AskOffer.
  • AskOffer is the offer, a row for above the results that appears only when there is something to say: the early hint, the sure offer, or Thinking before a proactive answer. The sure offer says what the judge read: a question, something not among the results, or a description to explore. Its words are yours through words, which is given what the row is about to say.
  • AskPanel writes the answer as it streams, with its sources numbered and a field for follow-up questions (followUps). fill makes it take the height of its container. showSearched={false} leaves out what the answer searched with, for a page that shows it elsewhere.
  • SearchResults with searchOrAsk dims the list, with a line above it, when the judge reads what is asked about as not in it (notFoundLabel words the line).
  • While asking is held (the day's budget spent, the provider refusing answers) every surface offers nothing and Enter searches; held says so. A proactive start the server refuses shows nothing, since nobody asked; a visitor's question past the budget is told asking is back tomorrow.
  • The assistant's picks: on a catalogue answered with several searches, the answer chooses the records that answer the visitor by reading them, best first, each with why. AskPanel makes them the list through the SearchProvider, with nothing to wire: SearchResults lists them in place of the search, numbered as the answer cites them, and SearchInput drops its Nearest and No results chips, which are about the search. Typing, Clear, a new conversation, or the way back over the list ("Show the search instead", or "Show all 45 found" when the visitor asked for all of something) gives the list back to the search. A proactive answer leaves the list alone. onPicks tells the page when they come; listPicks={false} keeps them in the panel. A film catalogue asked for "queer movies" has no field that says so: a search finds the word, the picks are the films about it.
  • useFilterSuggestion turns a catalogue's described filters into filters on the list, while typing or when the answer brings them. useAskFlow uses it for you.

QuickAnswer and askOffer="below" from earlier betas still work, and are deprecated: use AskOffer and askOffer="door".

Use a Search key in the page. It is the only kind that belongs in a browser, and it reads the settings without the Knowledge text.


The HTTP API

The same, for a front end of your own. All routes are under /api/teams/{team}/datasets/{dataset}/search-or-ask, and take a Search key unless noted.

RouteWhat it does
GET
The dataset's settings, what it runs with after defaults (effective), and whether a page can run it (available: the instance has a model key and the dataset shows it).
PUT
Replaces the settings (Full key). Applies from the next call; nothing is re-indexed.
POST /intent
Judges { "text": "..." }: p, the probability the visitor is asking; answerable, whether the results could answer it; criteria, whether it describes what to list; finished, whether they have finished typing it; found, whether what they ask about is in the results; the mode that applies; and the offer those come to (none, invite, strong). Call it on a typing pause, beside your own search. A judge that is slow or failing answers p 0 with a reason, and so does an instance whose offers are paused (paused): show nothing then. The call never fails.
POST /filters
A catalogue's description, { "text": "..." }, as filters on the dataset's own fields, and the text no filter covers.
POST /ask
Answers { "question": "...", "history": [...] } as server-sent events: status (what it is doing), sources (the records it may use, numbered), filters (on a catalogue answered with one search, what it searched with), picks (on a catalogue answered with several, the records it chose, each with why), text (the answer as it is written, citing [n]), then done; or error with a code (nothingFound, upstreamBusy, failed). The response's Indx-Ask-Id header names the answer for the statistics.

Texts are 1 to 300 characters, questions 1 to 1,000. A call over the per-address limit or the daily budget answers 429 with Retry-After; one on a dataset where Search or ask is off answers 409 (searchOrAskDisabled), or searchOrAskUnavailable where the instance has no model key.

Pass ?session=, ?source= and ?queryId= (the search behind the call) as you do on searches, so the statistics tie the judgements and questions to the searches they came from. When your page searches something other than what was typed, send the typed text as ?typed= on the search: the statistics then count a visitor's typing once.


Costs and Statistics

Most of the cost is the answers. On a film catalogue, a judgement averaged $0.00005 and a Best answer $0.035: one answer costs as much as about 700 judgements. Fast answers cost a twentieth of Best.

The Statistics tab gets a Search or ask section:

  • Proactive answers, once the proactive mode has written one: the answers no visitor asked for, kept out of Questions asked.
  • Offers shown, Questions asked and Not answered: the questions the search found nothing for, or whose sources the judge doubted could answer them. These are what to write next.
  • Cost: the judge, the answers and the filters together, as OpenRouter reports them for each call. Other providers report only tokens, so the tile shows "—" and says which provider to look up; your bill is in that provider's own console.
  • Asked again: answers the visitor followed within five minutes with the same question in other words, the quiet sign an answer missed. Under Questions, the pairs show how each question was meant. It needs the ?session= your page sends; a follow-up to an answer is not counted.
  • Needs: what visitors wanted, in all the ways they asked it, each with how its visits ended (answered at the first try, after asking again, or given up), the wordings, and the records the answers landed on. The ones given up most come first.
  • Calls: against the daily budget, with the days it ran out.
  • Questions and Offers tables: each question with its outcome and answerable score, and each text an offer was shown beside, so a false offer can be found.

The same is served by GET /api/teams/{team}/datasets/{dataset}/statistics/search-or-ask?days=30 (a Read key).