1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Improve extensibility of Enhanced Search

Discussion in 'Enhanced Search Suggestions' started by Xon, Oct 7, 2015.

  1. Xon

    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.
     
  2. Daniel Hood

    Daniel Hood Well-Known Member

    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.
     
    Xon likes this.
  3. Xon

    Xon Well-Known Member

    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
     
  4. Xon

    Xon Well-Known Member

    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.
     
    NixFifty likes this.
  5. Xon

    Xon Well-Known Member

  6. Ralle

    Ralle Active Member

    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?
     
  7. Xon

    Xon Well-Known Member

    @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.
     

Share This Page