mirror of
https://github.com/Codappix/search_core.git
synced 2024-12-28 05:36:10 +01:00
[TASK] Remove deprecated _all field query for Elastic 6.x
See: https://www.elastic.co/guide/en/elasticsearch/reference/current/mapping-all-field.html
This commit is contained in:
parent
a93a7af27f
commit
acac544f77
3 changed files with 26 additions and 14 deletions
|
@ -25,8 +25,8 @@ use Codappix\SearchCore\Configuration\ConfigurationContainerInterface;
|
|||
use Codappix\SearchCore\Configuration\ConfigurationUtility;
|
||||
use Codappix\SearchCore\Configuration\InvalidArgumentException;
|
||||
use Codappix\SearchCore\Connection\SearchRequestInterface;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
use TYPO3\CMS\Core\Utility\ArrayUtility;
|
||||
use TYPO3\CMS\Core\Utility\GeneralUtility;
|
||||
|
||||
class QueryFactory
|
||||
{
|
||||
|
@ -122,9 +122,13 @@ class QueryFactory
|
|||
$matchExpression = [
|
||||
'type' => 'most_fields',
|
||||
'query' => $searchRequest->getSearchTerm(),
|
||||
'fields' => GeneralUtility::trimExplode(',', $this->configuration->get('searching.fields.query')),
|
||||
];
|
||||
|
||||
$fieldsToQuery = GeneralUtility::trimExplode(',', $this->configuration->getIfExists('searching.fields.query'), true);
|
||||
if (!empty($fieldsToQuery)) {
|
||||
$matchExpression['fields'] = $fieldsToQuery;
|
||||
}
|
||||
|
||||
$minimumShouldMatch = $this->configuration->getIfExists('searching.minimumShouldMatch');
|
||||
if ($minimumShouldMatch) {
|
||||
$matchExpression['minimum_should_match'] = $minimumShouldMatch;
|
||||
|
|
|
@ -26,7 +26,8 @@ plugin {
|
|||
|
||||
searching {
|
||||
fields {
|
||||
query = _all
|
||||
# Default query fields (leave empty for all)
|
||||
query =
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,13 +1,20 @@
|
|||
<f:form name="searchRequest" object="{searchRequest}">
|
||||
<html xmlns:f="http://typo3.org/ns/TYPO3/CMS/Fluid/ViewHelpers"
|
||||
data-namespace-typo3-fluid="true">
|
||||
<div class="core-search">
|
||||
<f:form name="searchRequest" object="{searchRequest}">
|
||||
<f:form.textfield property="query"/>
|
||||
<f:form.submit value="search"/>
|
||||
</f:form>
|
||||
|
||||
<f:form.textfield property="query" />
|
||||
<f:form.submit value="search" />
|
||||
<ul>
|
||||
<f:for each="{searchResult}" as="result">
|
||||
<li>
|
||||
<f:link.page pageUid="{result.plainData.uid}">
|
||||
[{result.type}:{result.plainData.uid}] - {result.plainData.search_title}
|
||||
</f:link.page>
|
||||
</li>
|
||||
</f:for>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
</f:form>
|
||||
|
||||
<f:for each="{searchResult}" as="result">
|
||||
<f:link.page pageUid="{result.hit._source.pid}">
|
||||
{result.id} [{result.type}] - {result.hit._source.search_title}
|
||||
</f:link.page>
|
||||
<br>
|
||||
</f:for>
|
||||
</html>
|
||||
|
|
Loading…
Reference in a new issue