Implemented Improve extensibility of Enhanced Search

Xon

Well-known member
Currently the ability to inject new behaviour into XenES_Search_SourceHandler_ElasticSearch::executeSearch() in a standard re0usable way is highly limited.

There isn't any easy way to inspect & modify the content of the DSL before it is sent to Elastic Search (Xen_Api is annoyingly poor at extensibility). And the functionality of executeSearch is one large block of code rather than discrete functions which can be hooked to introduce new behaviour.
 
Upvote 4
This suggestion has been implemented. Votes are no longer accepted.
Judging by the bug reports, it seems that a new version should be coming soon. I'd greatly appreciate if this was addressed in some way.
 
Judging by the bug reports, it seems that a new version should be coming soon. I'd greatly appreciate if this was addressed in some way.
It isn't like it would be a massive backwards compatibility change either. Given how much of the XFES add-on is basically an opaque blob w.r.t to extendibility by 3rd party add-ons
 
Please make how XenForo Enhanced Search determines if a content type is optimizable content types extendable.

https://github.com/Xon/XenForo-Word...WordCountSearch/XenES/Model/Elasticsearch.php

Currently XenES_Model_Elasticsearch::getOptimizableMappings uses a generic mapping for every type, I want to be able to extend it per type like so:

Code:
if (!$mappings || !isset($mappings->$type)) // no index or no mapping
{
     $optimize = true;
}
else
{
    $expectedMapping = array_merge(static::$optimizedGenericMapping, $this->getOptimizableMappingFor($type));
    $optimize = $this->_verifyMapping($mappings->$type, $expectedMapping);
}
_ doesn't contain the verifyMapping $type, so it can't be used.
 
I would very much like this too. I am in the process of writing a filter-string converter that replaces spaces and special symbols with alphanumeric values to make them work like the 'keyword' type in ES instead of the default 'text'. I also have to put an empty string in my metadata string arrays to make sure they are interpreted as strings.

I just realized something. This function (XenES_Model_Elasticsearch)
Code:
public function optimizeMapping($type, $deleteFirst = true, array $extra = array())
is never actually called with the $extra set, but if you overload it, you can inject your own $extra mappings:
Code:
$mapping = XenForo_Application::mapMerge(self::$optimizedGenericMapping, $extra);

Isn't this what we want?
 
@Ralle that isn't sufficient, as $optimizedGenericMapping is also used on index creation, determining if mapping optimization is required, and performing standalone mapping optimization.

Only the last one is hookable via the "optimizeMapping" function. The getOptimizableMappings function is basically an non-extendable blob, and index creation is tricky to hook.
 
Top Bottom