Stage 4, Find something
At a glance
| Start state | End state | Fallback baseline |
|---|---|---|
| A populated index | Useful lexical and semantic search over the archive | Stage 4 search-ready semantic config |
Learning goals
- Run lexical queries with filters, facets, and sorting.
- Add a semantic configuration and use semantic ranking for natural-language questions.
- Compare lexical and semantic results and state one concrete difference.
Why it matters
An index nobody can search is useless. This stage turns your loaded data into answers to real questions people ask about the archive.
What you will build
Queries (not new objects) plus one small index change: a semantic configuration. You will run three tested challenge queries and see how semantic ranking reorders results.
Knowledge-share outline
- Lexical search: terms,
filter,facets, andorderbyover your index. - Semantic ranking: better ordering (and captions) for natural-language questions, using the semantic configuration you add.
- Reading relevance: why one result beats another, and where lexical and semantic differ.
Lab steps
Use Search explorer on your index in the portal, then select View > JSON view. For each query, replace the entire request with the JSON shown and select Search. Do not merge requests: that can leave a previous filter, sort, or semantic option active. The lexical examples set "queryType": "simple"; the semantic example opts into semantic ranking explicitly. Each challenge query below is verified against the real dataset, so it returns a recognizable set.
1. Lexical query: printer problems
Search for printer issues across the archive:
{
"search": "printer",
"queryType": "simple"
}You get the memos and updates about printer outages and maintenance. This is plain full-text search over subject and content.
2. Filter and facet
Narrow to one record type, then group by department. Facets return counts you can show as a sidebar:
{
"search": "printer",
"queryType": "simple",
"filter": "recordType eq 'internal-memo'",
"facets": ["department"]
}Try a branch filter too. For example, look at Stamford activity and facet by department. Every branch carries records from several departments, so the facet comes back with a group and a count for each one (Stamford has Sales, Management, HR, Customer Service, and Warehouse):
{
"search": "*",
"queryType": "simple",
"filter": "branch eq 'Stamford'",
"facets": ["department"]
}3. Sort
Order results newest-first using the sortable date field. This sorts by date instead of relevance:
{
"search": "paper",
"queryType": "simple",
"orderby": "date desc"
}Now try sorting by a field that is not sortable. This request breaks because department was configured for filtering and faceting, but not sorting:
{
"search": "paper",
"queryType": "simple",
"orderby": "department desc"
}Search rejects the request with an error that the department field cannot be used in an orderby expression.
4. Add a semantic configuration
Semantic ranking needs a named configuration on the index that says which field is the title, which carries the body text, and which are keywords. Add one called corporate-semantic:
- Open Indexes >
tNN-pNN-corporate-index. - Select Edit JSON (or the Semantic configurations tab, then Add semantic configuration, if you prefer the form).
- In the JSON editor, add the
semanticblock below as a sibling of"fields", then Save.
{
"semantic": {
"configurations": [
{
"name": "corporate-semantic",
"prioritizedFields": {
"titleField": { "fieldName": "subject" },
"prioritizedContentFields": [ { "fieldName": "content" } ],
"prioritizedKeywordsFields": [ { "fieldName": "branch" }, { "fieldName": "department" } ]
}
}
]
}
}Every field a semantic configuration names has to be searchable and retrievable, which is why Stage 2 had you check Searchable on branch and department as well as Filterable and Facetable. If the save is rejected with a message about a field not being searchable, see semantic-config-field-not-searchable.
You may already have a semantic configuration, and it is not this one
Stage 2 left Enable semantic ranker checked on the wizard's Advanced settings step, so your index may already carry an auto-generated configuration with a name like search-1234567890-semantic-configuration. That one has no prioritized content fields, so it ranks nothing usefully.
Leave it or delete it as you like, but always select corporate-semantic by name, here and again in Stage 6. Picking the auto-generated one in Stage 6 is the single most common cause of a knowledge base that returns zero results.
Reference copy of the finished search-ready index: definitions/index.template.json. Semantic ranking also has to be enabled on the Search service itself, which the workshop provisioning already does for you.
5. Semantic query: stock left in front of a fire exit
Return to Search explorer > View > JSON view. Run a natural-language question with semantic ranking and your corporate-semantic configuration:
{
"search": "what happens if stock is left in front of a fire exit?",
"queryType": "semantic",
"semanticConfiguration": "corporate-semantic"
}The fire-safety policy records take the top of the list. Watch for Stock blocking a fire door in particular: the question never uses the words blocking or door, so that record shares fewer literal terms with it than the inspection records do, and semantic ranking still reads it as the closest answer to what was asked.
6. Compare lexical and semantic
Replace the request with the plain lexical version of the same question:
{
"search": "what happens if stock is left in front of a fire exit?",
"queryType": "simple"
}Same question, same index, different ranking. Look at what lexical puts near the top. Semantic ranking reorders those same candidates by what they mean.
Finding a person is a job for lexical search, not semantic ranking
Semantic ranking is a re-ranker: it reorders the results the underlying keyword search already found, scoring each one on how well its meaning answers the question. An exact token such as a person's name is precisely what keyword scoring is good at, and it carries little weight in a semantic score. Try fire safety involving Priya Nair both ways and compare: the simple run is the one that reliably puts her records on top. To retrieve by person, use a lexical query, a filter, or the extracted people field you add in Stage 5.
Expected output
- The printer query returns many printer-related records.
- The Stamford facet query returns a group and a count per department (Sales, Management, HR, Customer Service, and Warehouse).
- The semantic fire-exit query puts the fire-safety
policyrecords at the top, including Stock blocking a fire door. The lexical run of the same question puts Exit interview for ... HR notes above every fire record, which is the difference to talk about.
Checkpoint
search-ready: You can answer a natural-language question with semantic ranking, filter and facet by branch or department, sort by date, and you can state one concrete lexical-vs-semantic difference, for example: "Lexical ranks by term frequency and exact matches, so it rewards the literal word printer; semantic ranking reorders by meaning, so a conversational question about a blocked fire exit surfaces the right policy records even when the exact words differ."
Fallback baseline
Everything in this stage except the semantic configuration is a query, so there is nothing to restore. If the configuration will not save, paste the semantic block from step 4 into your index's Edit JSON view again and check that it sits alongside "fields", not inside it. The known-good index is at baseline/4/index.json.
Troubleshooting
- Semantic option is missing. Confirm the semantic configuration exists on the index and that semantic ranking is enabled on the service (the workshop enables it).
- Semantic results look no better than lexical. Check which configuration you selected. If it is the wizard's auto-generated
search-<timestamp>-semantic-configuration, it has no prioritized content fields and cannot rank meaningfully. Selectcorporate-semantic. - Filter returns nothing.
filteruses exact values and is case-sensitive; usebranch eq 'Stamford', notstamford. - Sort is rejected. Only
dateis sortable in the base schema; sorting other fields requires making them sortable first.
Optional stretch
Explore a scoring profile (boost recent records or a specific field) or synonyms (map "photocopier" to "printer"). These are optional and are not required for Stage 5 or any later stage.
What we will not cover
- Vector and hybrid retrieval; this stage stays on lexical plus semantic ranking, and the optional Stage 8 stretch picks them up.
- Custom relevance tuning beyond the optional stretch above.