Add autocomplete endpoint via EXT:solr suggest page type
GET /search?type=7384&tx_solr[queryString]=<input> answers term completions from the index (spell field) with document counts as lean JSON - no page envelope, synonyms apply automatically. Two deliberate deviations from the shipped example, which predates TYPO3 v14: the plugin runs as USER_INT (config.no_cache is gone, and a cached USER would pin the first query's suggestions for every later request), and showTopResults is off (the top-result shape is hardcoded upstream with the raw document type and full indexed content). Documented in spec v1.12 clause 7.16. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
@@ -549,3 +549,40 @@ plugin.tx_solr.search.faceting {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# =============================================================================
|
||||
# Autocomplete endpoint: GET /search?type=7384&tx_solr[queryString]=<input>
|
||||
# Lean JSON page type (no page envelope) for type-ahead in the React search
|
||||
# field. Response: { suggestions: {term: count}, suggestion, documents[],
|
||||
# didSecondSearch }.
|
||||
# 10 is deliberately USER_INT, not USER as in the shipped example: the example
|
||||
# predates TYPO3 v14 (config.no_cache is gone), and a cached USER would pin
|
||||
# the first query's suggestions for every later request.
|
||||
# =============================================================================
|
||||
tx_solr_suggest = PAGE
|
||||
tx_solr_suggest {
|
||||
typeNum = 7384
|
||||
config {
|
||||
disableAllHeaderCode = 1
|
||||
additionalHeaders.10.header = Content-Type: application/json; charset=utf-8
|
||||
}
|
||||
|
||||
10 = USER_INT
|
||||
10 {
|
||||
userFunc = TYPO3\CMS\Extbase\Core\Bootstrap->run
|
||||
extensionName = Solr
|
||||
pluginName = pi_suggest
|
||||
vendorName = ApacheSolrForTypo3
|
||||
controller = Suggest
|
||||
action = suggest
|
||||
}
|
||||
}
|
||||
|
||||
plugin.tx_solr.suggest = 1
|
||||
plugin.tx_solr.suggest {
|
||||
numberOfSuggestions = 8
|
||||
suggestField = spell
|
||||
# term suggestions only: the built-in top-results carry the raw document
|
||||
# type and the full indexed content - too fat and off-contract for type-ahead
|
||||
showTopResults = 0
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user