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

Lack of Interest Admin quick search relevancy

Discussion in 'Closed Suggestions' started by rellect, Aug 5, 2013.

  1. rellect

    rellect Well-Known Member

    Not sure if bug or not.
    I've noticed that the admin quick search gives not so relevant results at times.

    If you will search the word: "message", in order to find that template, it won't show up in the results. Instead, you'll see other template results which contain that word.
    I think that template name which start with that word, would be more relevant than strings that have the word in the middle/end.
    You can test the same with the word "post".
  2. Brogan

    Brogan XenForo Moderator Staff Member

    They are sorted alphabetically.
    The same thing happens when filtering template names.
  3. Mike

    Mike XenForo Developer Staff Member

    Relevancy isn't something that we even attempt to do. As said, matching results are simply listed alphabetically. Relevancy (of some form, given that we're just doing a "like" search) would have to be a suggestion... so I'll just move this.
  4. rellect

    rellect Well-Known Member

    Guess it won't be fixed in the near future, so I've fixed that for myself.
    if anyone interested, the code below will add relevancy for templates search:

    public function getEffectiveTemplateListForStyle($styleId, array $conditions = array(), $fetchOptions = array())
    $whereClause $this->prepareTemplateConditions($conditions$fetchOptions);
    $limitOptions $this->prepareLimitFetchOptions($fetchOptions);

    $titleRelevancy '';
    $titleRelevancy '(CASE WHEN template.title LIKE \''.$conditions['title'].'%\' THEN 0 ELSE 1 END),';

            SELECT template_map.template_map_id,
                template_map.style_id AS map_style_id,
                addon.addon_id, addon.title AS addonTitle,
                IF(template.style_id = 0, \'default\', IF(template.style_id = template_map.style_id, \'custom\', \'inherited\')) AS template_state,
                IF(template.style_id = template_map.style_id, 1, 0) AS canDelete
            FROM xf_template_map AS template_map
            INNER JOIN xf_template AS template ON
                (template_map.template_id = template.template_id)
            LEFT JOIN xf_addon AS addon ON
                (addon.addon_id = template.addon_id)
            WHERE template_map.style_id = ?
                AND ' 
    $whereClause '
            ORDER BY ' 
    $titleRelevancy ' CONVERT(template_map.title USING utf8)
    $limitOptions['limit'], $limitOptions['offset']), $styleId);
    Jay likes this.

Share This Page