Need to some change in helper file app\code\core\Mage\CatalogSearch\Helper\Data.php
from
public function getQueryText()
{
if (!isset($this->_queryText)) {
$this->_queryText = $this->_getRequest()->getParam($this->getQueryParamName());
if ($this->_queryText === null) {
$this->_queryText = '';
} else {
/* @var $stringHelper Mage_Core_Helper_String */
$stringHelper = Mage::helper('core/string');
$this->_queryText = is_array($this->_queryText) ? ''
: $stringHelper->cleanString(trim($this->_queryText));
$maxQueryLength = $this->getMaxQueryLength();
if ($maxQueryLength !== '' && $stringHelper->strlen($this->_queryText) > $maxQueryLength) {
$this->_queryText = $stringHelper->substr($this->_queryText, 0, $maxQueryLength);
$this->_isMaxLength = true;
}
}
}
return $this->_queryText;
}
To
public function getQueryText()
{
if (!isset($this->_queryText)) {
$this->_queryText = $this->_getRequest()->getParam($this->getQueryParamName());
$this->_queryText = preg_replace('/[^A-Za-z0-9\-\']/', '', $this->_queryText); // escape apostraphe
if ($this->_queryText === null) {
$this->_queryText = '';
} else {
/* @var $stringHelper Mage_Core_Helper_String */
$stringHelper = Mage::helper('core/string');
$this->_queryText = is_array($this->_queryText) ? ''
: $stringHelper->cleanString(trim($this->_queryText));
$maxQueryLength = $this->getMaxQueryLength();
if ($maxQueryLength !== '' && $stringHelper->strlen($this->_queryText) > $maxQueryLength) {
$this->_queryText = $stringHelper->substr($this->_queryText, 0, $maxQueryLength);
$this->_isMaxLength = true;
}
}
}
return $this->_queryText;
}
We have add only one line code in above function $this->_queryText = preg_replace('/[^A-Za-z0-9\-\']/', '', $this->_queryText);
Note: first move core file to local app\code\local\Mage\CatalogSearch\Helper\Data.php
after add above change or rewrite a helper class Mage_CatalogSearch_Helper_Data
to local click here to rewrite helper steps
I do not know your search engine, I suppose that you use Mysql. I cannot comment your question.
But you may try to use SolR or Elastic Search if you want to affine your search experience. It is EE feature, but you can find community module.
You need also to see which raw data is indexed to Mysql / SolR / ElasticSearch to know if the problem occurs on the index level or in the query level.
I test it with ElasticSearch and it works on my side.
I reproduice your error with Mysql search engine.
Resolution :
The data indexed (catalogsearch_fulltext_scope1) is :
*************************** 1. row ***************************
entity_id: 45
attribute_id: 73
data_index: Xxxx 1 DS
The SQL query for 'xxxx' request :
SELECT `main_select`.`entity_id`, MAX(score) AS `relevance` FROM (SELECT `search_index`.`entity_id`, ((0) + LEAST((MATCH (data_index) AGAINST ('xxxx*' IN BOOLEAN MODE)), 1000000) * POW(2, search_weight)) AS `score` FROM `catalogsearch_fulltext_scope1` AS `search_index` LEFT JOIN `catalog_eav_attribute` AS `cea` ON search_index.attribute_id = cea.attribute_id LEFT JOIN `cataloginventory_stock_status` AS `stock_index` ON search_index.entity_id = stock_index.product_id AND stock_index.website_id = 0 WHERE (stock_index.stock_status = 1) AND (MATCH (data_index) AGAINST ('xxxx*' IN BOOLEAN MODE))) AS `main_select` GROUP BY `entity_id` ORDER BY `relevance` DESC LIMIT 10000
The SQL query for '1 ds' request:
SELECT `main_select`.`entity_id`, MAX(score) AS `relevance` FROM (SELECT `search_index`.`entity_id`, ((0) + LEAST((MATCH (data_index) AGAINST ('1 DS' IN BOOLEAN MODE)), 1000000) * POW(2, search_weight)) AS `score` FROM `catalogsearch_fulltext_scope1` AS `search_index` LEFT JOIN `catalog_eav_attribute` AS `cea` ON search_index.attribute_id = cea.attribute_id LEFT JOIN `cataloginventory_stock_status` AS `stock_index` ON search_index.entity_id = stock_index.product_id AND stock_index.website_id = 0 WHERE (stock_index.stock_status = 1) AND (MATCH (data_index) AGAINST ('1 DS' IN BOOLEAN MODE))) AS `main_select` GROUP BY `entity_id` ORDER BY `relevance` DESC LIMIT 10000
If you check Mysql documentation, there are two parameters for Configuring Minimum and Maximum Word Length :
http://dev.mysql.com/doc/refman/5.7/en/fulltext-fine-tuning.html
So edit your my.cnf file, add these parameters :
ft_min_word_len = 1
innodb_ft_min_token_size = 1
Restart mysql
service mysql restart
Rebuild your index
bin/magento indexer:reindex
Then you will see your product on the search result page.
Best Answer
The default search is MySQL-based. So can be impacted by DB character set options.
However is it possible you can look in the database for semiautomático value?
There is a possibility the accent character has been saved as an HTML entity which is why you are not getting a match.
In which case you may have to look at this feature https://docs.magento.com/m2/ce/user_guide/marketing/search-synonyms.html