search api autocomplete withour accent, and splitting numbers (fruhstuck40)

This commit is contained in:
Bachir Soussi Chiadmi 2021-10-07 22:44:32 +02:00
parent dd22a6e143
commit aca756e64d
5 changed files with 119 additions and 10 deletions

View File

@ -7,7 +7,6 @@ dependencies:
- taxonomy
- synonyms
- search_api
- materio_sapi
config:
- field.storage.taxonomy_term.field_synonyms
- search_api.server.database_search_autocomplete
@ -61,7 +60,7 @@ field_settings:
label: Synonyms
datasource_id: 'entity:taxonomy_term'
property_path: field_synonyms
type: 'solr_text_custom:edgestring'
type: 'solr_text_custom:edgeasciistring'
dependencies:
config:
- field.storage.taxonomy_term.field_synonyms
@ -69,7 +68,7 @@ field_settings:
label: Name
datasource_id: 'entity:taxonomy_term'
property_path: name
type: 'solr_text_custom:edgestring'
type: 'solr_text_custom:edgeasciistring'
boost: !!float 2
dependencies:
module:
@ -119,7 +118,6 @@ processor_settings:
solr_date_range:
weights:
preprocess_index: 0
term_used: { }
type_boost:
boosts:
'entity:taxonomy_term':

View File

@ -9,6 +9,7 @@ dependencies:
- search_api_solr.solr_cache.cache_persegfilter_default_7_0_0
- search_api_solr.solr_cache.cache_queryresult_default_7_0_0
- search_api_solr.solr_field_type.text_edge_und_7_0_0
- search_api_solr.solr_field_type.text_edgestring_ascii_und_6_0_0
- search_api_solr.solr_field_type.text_edgestring_und_6_0_0
- search_api_solr.solr_field_type.text_en_7_0_0
- search_api_solr.solr_field_type.text_fr_7_0_0
@ -47,9 +48,10 @@ backend_config:
commit_within: 1000
solr_version: '8'
http_method: AUTO
jmx: false
solr_install_dir: ../../..
skip_schema_check: false
jmx: false
jts: false
solr_install_dir: ../../..
disabled_field_types: { }
disabled_caches: { }
disabled_request_handlers:
@ -59,12 +61,12 @@ backend_config:
disabled_request_dispatchers:
- request_dispatcher_httpcaching_default_7_0_0
rows: 10
index_single_documents_fallback_count: 10
retrieve_data: true
highlight_data: false
fallback_multiple: true
server_prefix: ''
domain: generic
environment: default
optimize: false
site_hash: true
index_single_documents_fallback_count: 10
fallback_multiple: true

View File

@ -0,0 +1,56 @@
uuid: af25836c-6eca-4621-a803-7a7394fff660
langcode: en
status: true
dependencies: { }
_core:
default_config_hash: 2jPHrZPHYA4ZBHAbJDAoVD465MybfBXiepOZsUHyg-o
id: text_edgestring_ascii_und_6_0_0
label: 'Edge NGram ASCII String Field'
minimum_solr_version: 6.0.0
custom_code: edgeasciistring
field_type_language_code: und
domains: { }
field_type:
name: text_edgenasciistring
class: solr.TextField
positionIncrementGap: 100
analyzers:
-
type: index
tokenizer:
class: solr.StandardTokenizerFactory
filters:
-
class: solr.LowerCaseFilterFactory
-
class: solr.RemoveDuplicatesTokenFilterFactory
-
class: solr.EdgeNGramFilterFactory
minGramSize: 2
maxGramSize: 25
-
class: solr.ASCIIFoldingFilterFactory
preserveOriginal: true
-
class: solr.WordDelimiterGraphFilterFactory
preserveOriginal: 1
-
type: query
tokenizer:
class: solr.StandardTokenizerFactory
filters:
-
class: solr.LowerCaseFilterFactory
-
class: solr.RemoveDuplicatesTokenFilterFactory
-
class: solr.ASCIIFoldingFilterFactory
preserveOriginal: true
-
class: solr.WordDelimiterGraphFilterFactory
preserveOriginal: 1
unstemmed_field_type: null
spellcheck_field_type: null
collated_field_type: null
solr_configs: { }
text_files: { }

View File

@ -0,0 +1,52 @@
langcode: en
status: true
dependencies:
module:
- search_api_solr
id: text_edgestring_ascii_und_6_0_0
label: 'Edge NGram ASCII String Field'
minimum_solr_version: 6.0.0
custom_code: 'edgeasciistring'
field_type_language_code: und
domains: {}
field_type:
name: text_edgenasciistring
class: solr.TextField
positionIncrementGap: 100
analyzers:
-
type: index
tokenizer:
class: solr.StandardTokenizerFactory
filters:
-
class: solr.LowerCaseFilterFactory
-
class: solr.RemoveDuplicatesTokenFilterFactory
-
class: solr.EdgeNGramFilterFactory
minGramSize: 2
maxGramSize: 25
-
class: solr.ASCIIFoldingFilterFactory
preserveOriginal: true
-
class: solr.WordDelimiterGraphFilterFactory
preserveOriginal: 1
-
type: query
tokenizer:
class: solr.StandardTokenizerFactory
filters:
-
class: solr.LowerCaseFilterFactory
-
class: solr.RemoveDuplicatesTokenFilterFactory
-
class: solr.ASCIIFoldingFilterFactory
preserveOriginal: true
-
class: solr.WordDelimiterGraphFilterFactory
preserveOriginal: 1
solr_configs: {}
text_files: {}

View File

@ -8,7 +8,7 @@ use Drupal\Core\Controller\ControllerBase;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Drupal\Component\Utility\Tags;
use Drupal\Component\Utility\Unicode;
// use Drupal\Component\Utility\Unicode;
use Drupal\search_api\Entity\Index;
@ -24,7 +24,8 @@ class FormAutocomplete extends ControllerBase {
// Get the typed string from the URL, if it exists.
if ($input = $request->query->get('q')) {
$typed_string = Tags::explode($input);
$typed_string = Unicode::strtolower(array_pop($typed_string));
// $typed_string = Unicode::strtolower(array_pop($typed_string));
$typed_string = mb_strtolower(array_pop($typed_string));
// \Drupal::logger('materio_sapi')->notice($typed_string);
$index = Index::load('autocomplete');