fixed the sapi_solr search autocompletewith synonyms

This commit is contained in:
Bachir Soussi Chiadmi 2021-07-28 22:11:46 +02:00
parent b67c88dfa7
commit f9a353a32b
6 changed files with 48 additions and 9 deletions

View File

@ -5,9 +5,11 @@ dependencies:
module:
- search_api_solr
- taxonomy
- synonyms
- search_api
- materio_sapi
config:
- field.storage.taxonomy_term.field_synonyms
- search_api.server.database_search_autocomplete
third_party_settings:
search_api_solr:
@ -15,7 +17,7 @@ third_party_settings:
commit_before_finalize: false
commit_after_finalize: false
multilingual:
limit_to_content_language: false
limit_to_content_language: true
include_language_independent: true
highlighter:
maxAnalyzedChars: 51200
@ -43,18 +45,26 @@ third_party_settings:
maxntp: 2000
boost: false
interestingTerms: none
term_modifiers:
slop: 10000000
fuzzy: 2
advanced:
index_prefix: ''
collection: ''
timezone: ''
term_modifiers:
slop: 10000000
fuzzy: 2
id: autocomplete
name: 'autocomplete taxonomy'
description: ''
read_only: false
field_settings:
field_synonyms:
label: Synonyms
datasource_id: 'entity:taxonomy_term'
property_path: field_synonyms
type: 'solr_text_custom:ngramstring'
dependencies:
config:
- field.storage.taxonomy_term.field_synonyms
name:
label: Name
datasource_id: 'entity:taxonomy_term'
@ -72,6 +82,14 @@ field_settings:
dependencies:
module:
- taxonomy
synonyms:
label: 'Synonyms list'
datasource_id: 'entity:taxonomy_term'
property_path: synonyms
type: 'solr_text_custom:ngram'
dependencies:
module:
- synonyms
tid:
label: 'Term ID'
datasource_id: 'entity:taxonomy_term'
@ -106,6 +124,8 @@ processor_settings:
boosts:
'entity:taxonomy_term':
datasource_boost: !!float 1
bundle_boosts:
thesaurus: !!float 2
weights:
preprocess_index: 0
tracker_settings:

View File

@ -38,7 +38,7 @@ class FormAutocomplete extends ControllerBase {
// Set fulltext search keywords and fields.
$query->keys($typed_string);
$query->setFulltextFields(['name', 'synonyms']);
$query->setFulltextFields(['name', 'field_synonyms']);
// Set additional conditions.
$query->addCondition('status', 1);
@ -49,7 +49,7 @@ class FormAutocomplete extends ControllerBase {
$query->setLanguages([$lang]);
// Do paging.
$query->range(0, 10);
$query->range(0, 15);
// Add sorting.
$query->sort('search_api_relevance', 'DESC');

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -733,6 +733,25 @@ header[role="banner"]{
}
ul.ui-menu.ui-widget-content.ui-autocomplete {
background-color: rgba(0, 0, 0, 0.6);
border-radius: 5px;
border: none;
padding: 0.3em 0.2em;
a.ui-menu-item-wrapper{
color: #fff;
padding:0.1em 0.1em;
display: block;
&.ui-state-active{
background: none;
border: none;
color:#fff;
background-color: rgba(0, 0, 0, 0.9);
}
}
}
// main
aside.messages{