2017-10-14 13:02:48 +02:00
.. _configuration_options_search:
Searching
=========
.. _size:
size
----
2017-10-29 12:25:25 +01:00
Used by: Elasticsearch connection while building search query.
2017-10-14 13:02:48 +02:00
2017-10-29 12:25:25 +01:00
Defined how many search results should be fetched to be available in search result.
2017-10-14 13:02:48 +02:00
2017-10-29 12:25:25 +01:00
Example::
2017-10-14 13:02:48 +02:00
2017-10-29 12:25:25 +01:00
plugin.tx_searchcore.settings.searching.size = 50
2017-10-14 13:02:48 +02:00
2017-10-29 12:25:25 +01:00
Default if not configured is 10.
2017-10-14 13:02:48 +02:00
.. _facets:
facets
------
2017-10-29 12:25:25 +01:00
Used by: Elasticsearch connection while building search query.
2017-10-14 13:02:48 +02:00
2017-10-29 12:25:25 +01:00
Define aggregations for Elasticsearch, have a look at the official docs: https://www.elastic.co/guide/en/elasticsearch/reference/5.2/search-aggregations-bucket-terms-aggregation.html
Currently only the term facet is provided.
2017-10-14 13:02:48 +02:00
2017-10-29 12:25:25 +01:00
Example::
2017-10-14 13:02:48 +02:00
2017-10-29 12:25:25 +01:00
plugin.tx_searchcore.settings.searching.facets {
contentTypes {
field = CType
2017-10-14 13:02:48 +02:00
}
2017-10-29 12:25:25 +01:00
}
2017-10-14 13:02:48 +02:00
2017-10-29 12:25:25 +01:00
The above example will provide a facet with options for all found `` CType `` results together
with a count.
2017-10-14 13:02:48 +02:00
.. _filter:
2017-10-29 12:25:25 +01:00
filter
------
2017-10-14 13:02:48 +02:00
2017-10-29 12:25:25 +01:00
Used by: While building search request.
2017-10-14 13:02:48 +02:00
2017-10-29 12:25:25 +01:00
Define filter that should be set for all requests.
2017-10-14 13:02:48 +02:00
2017-10-29 12:25:25 +01:00
Example::
2017-10-14 13:02:48 +02:00
2017-10-29 12:25:25 +01:00
plugin.tx_searchcore.settings.searching.filter {
property = value
}
2017-10-14 13:02:48 +02:00
2017-10-29 12:25:25 +01:00
For Elasticsearch the fields have to be filterable, e.g. need a mapping as `` keyword `` .
2017-10-14 13:02:48 +02:00
.. _minimumShouldMatch:
minimumShouldMatch
------------------
2017-10-29 12:25:25 +01:00
Used by: Elasticsearch connection while building search query.
2017-10-14 13:02:48 +02:00
2017-10-29 12:25:25 +01:00
Define the minimum match for Elasticsearch, have a look at the official docs: https://www.elastic.co/guide/en/elasticsearch/reference/5.2/query-dsl-minimum-should-match.html
2017-10-14 13:02:48 +02:00
2017-10-29 12:25:25 +01:00
Example::
2017-10-14 13:02:48 +02:00
2017-10-29 12:25:25 +01:00
plugin.tx_searchcore.settings.searching.minimumShouldMatch = 50%
2017-10-14 13:02:48 +02:00
.. _boost:
boost
-----
2017-10-29 12:25:25 +01:00
Used by: Elasticsearch connection while building search query.
2017-10-14 13:02:48 +02:00
2017-10-29 12:25:25 +01:00
Define fields that should boost the score for results.
2017-10-14 13:02:48 +02:00
2017-10-29 12:25:25 +01:00
Example::
2017-10-14 13:02:48 +02:00
2017-10-29 12:25:25 +01:00
plugin.tx_searchcore.settings.searching.boost {
search_title = 3
search_abstract = 1.5
}
2017-10-14 13:02:48 +02:00
2017-10-29 12:25:25 +01:00
For further information take a look at
https://www.elastic.co/guide/en/elasticsearch/guide/2.x/_boosting_query_clauses.html
2017-10-14 13:02:48 +02:00
.. _fieldValueFactor:
fieldValueFactor
----------------
2017-10-29 12:25:25 +01:00
Used by: Elasticsearch connection while building search query.
Define a field to use as a factor for scoring. The configuration is passed through to elastic
search `` field_value_factor `` , see: https://www.elastic.co/guide/en/elasticsearch/reference/5.2/query-dsl-function-score-query.html#function-field-value-factor
Example::
plugin.tx_searchcore.settings.searching.field_value_factor {
field = rootlineLevel
modifier = reciprocal
factor = 2
missing = 1
}
.. _mapping.filter:
mapping.filter
--------------
Allows to configure filter more in depth. If a filter with the given key exists, the TypoScript will
be added.
E.g. you submit a filter in form of:
.. code-block :: html
<f:form.textfield property="filter.distance.location.lat" value="51.168098" />
<f:form.textfield property="filter.distance.location.lon" value="6.381384" />
<f:form.textfield property="filter.distance.distance" value="100km" />
This will create a `` distance `` filter with subproperties. To make this filter actually work, you
can add the following TypoScript, which will be added to the filter::
2017-10-14 13:02:48 +02:00
2017-10-29 12:25:25 +01:00
mapping {
filter {
distance {
field = geo_distance
fields {
distance = distance
location = location
}
}
}
}
`` fields `` has a special meaning here. This will actually map the properties of the filter to fields
in elasticsearch. In above example they do match, but you can also use different names in your form.
On the left hand side is the elasticsearch field name, on the right side the one submitted as a
filter.
The `` field `` , in above example `` geo_distance `` , will be used as the elasticsearch field for
filtering. This way you can use arbitrary filter names and map them to existing elasticsearch fields.
2017-10-14 13:02:48 +02:00
2017-10-29 12:25:25 +01:00
.. _fields:
2017-10-14 13:02:48 +02:00
2017-10-29 12:25:25 +01:00
fields
------
2017-11-29 18:57:09 +01:00
Defines the fields to fetch and search from elasticsearch. With the following sub keys:
`` query `` defines the fields to search in. Default is `` _all `` from 5.x times of elasticsearch.
Configure a comma separated list of fields to search in. This is necessary if you have configured
special mapping for some fields, or just want to search some fields.
The most hits get ranked highest. The following is an example configuration::
fields {
query = _all, city
}
The following sub properties configure the fields to fetch from elasticsearch:
2017-10-29 12:25:25 +01:00
First `` stored_fields `` which is a list of comma separated fields which actually exist and will be
added. Typically you will use `` _source `` to fetch the whole indexed fields.
Second is `` script_fields `` , which allow you to configure scripted fields for elasticsearch.
An example might look like the following::
fields {
script_fields {
distance {
condition = {request.filter.distance.location}
script {
params {
lat = {request.filter.distance.location.lat -> f:format.number()}
lon = {request.filter.distance.location.lon -> f:format.number()}
}
lang = painless
inline = doc["location"].arcDistance(params.lat,params.lon) * 0.001
}
}
2017-10-14 13:02:48 +02:00
}
2017-10-29 12:25:25 +01:00
}
In above example we add a single `` script_field `` called `` distance `` . We add a condition when this
field should be added. The condition will be parsed as Fluidtemplate and is casted to bool via PHP.
If the condition is true, or no `` condition `` exists, the `` script_field `` will be added to the
query. The `` condition `` will be removed and everything else is submitted one to one to
elasticsearch, except each property is run through Fluidtemplate, to allow you to use information
from search request, e.g. to insert latitude and longitude from a filter, like in the above example.
.. _sort:
sort
----
Sort is handled like :ref: `fields` .
2017-10-14 13:02:48 +02:00
.. _mode:
2017-10-29 12:25:25 +01:00
mode
----
2017-10-14 13:02:48 +02:00
2017-10-29 12:25:25 +01:00
Used by: Controller while preparing action.
2017-10-14 13:02:48 +02:00
2017-10-29 12:25:25 +01:00
Define to switch from search to filter mode.
2017-10-14 13:02:48 +02:00
2017-10-29 12:25:25 +01:00
Example::
2017-10-14 13:02:48 +02:00
2017-10-29 12:25:25 +01:00
plugin.tx_searchcore.settings.searching {
mode = filter
}
2017-10-14 13:02:48 +02:00
2017-10-29 12:25:25 +01:00
Only `` filter `` is allowed as value. Will submit an empty query to switch to filter mode.
2018-03-06 10:47:14 +01:00
.. _searching_dataProcessing:
dataProcessing
--------------
Used by: All connections while indexing, due to implementation inside `` SearchService `` .
Configure modifications on each document before returning search result. Same as provided by TYPO3
for :ref: `t3tsref:cobj-fluidtemplate` through
:ref: `t3tsref:cobj-fluidtemplate-properties-dataprocessing` .
All processors are applied in configured order. Allowing to work with already processed data.
Example::
plugin.tx_searchcore.settings.searching.dataProcessing {
1 = Codappix\SearchCore\DataProcessing\CopyToProcessor
1 {
to = search_spellcheck
}
2 = Codappix\SearchCore\DataProcessing\CopyToProcessor
2 {
to = search_all
}
}
The above example will copy all existing fields to the field `` search_spellcheck `` . Afterwards
all fields, including `` search_spellcheck `` will be copied to `` search_all `` .
.. include :: /configuration/dataProcessing/availableAndPlanned.rst
Also data processors are available while indexing too, see :ref: `dataProcessing` .