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

Fixed Rebuild Search Index field does not use a phrase key

Discussion in 'Resolved Bug Reports' started by Onimua, Mar 11, 2013.

  1. Onimua

    Onimua Well-Known Member

    Tools > Rebuild Caches > Rebuild Search Index uses the content type to create the phrases for the list instead of using a content type phrase key. Not sure if this is a bug or suggestion. :unsure:
     
  2. Jon W

    Jon W Well-Known Member

    Are you saying that this is a problem because we can't name content types the same as a pre-existing phrase, so it would be better to be something like:
    Code:
    public function actionRebuild()
    {
    $this->assertAdminPermission('rebuildCache');
     
    /* @var $searchModel XenForo_Model_Search */
    $searchModel = XenForo_Model::create('XenForo_Model_Search');
     
    $searchContentTypeOptions = array();
    foreach ($searchModel->getSearchContentTypes() AS $contentType => $null)
    {
    $searchContentTypeOptions[$contentType] = new XenForo_Phrase('content_type_' . $contentType);
    }
     
    $viewParams = array(
    'searchContentTypes' => $searchContentTypeOptions
    );
     
    return $this->responseView('XenForo_ViewAdmin_Tools_Rebuild', 'tools_rebuild', $viewParams);
    }
    ?

    I guess this would have to be "fixed" in 1.2 (not 1.1.4), otherwise it would mess up too many add-ons? It would certainly mess up a few of my add-ons.
     
  3. Onimua

    Onimua Well-Known Member

    It shouldn't. Phrase keys were adds later into XF for the attachment handler with no issue. Here it looks like a phrase key just needs to be added to the search handler.
     
    Jeremy likes this.
  4. Jon W

    Jon W Well-Known Member

    When were phrase keys added for the attachment handler? I guess if that was done on a minor release, then that sets the precedent.

    I see that the function for the Attachment Handler returns 'unknown' if no phrase is set, and I wouldn't have thought that as a result of a minor release I would have to update all of my add-ons that add content types. But, if needs must...
     
  5. Mike

    Mike XenForo Developer Staff Member

    Yeah, a change to this would need to be a 1.2 thing. The better approach would be to handle it like the attachment handler, by the search data handlers returning a phrase key.
     
    Slavik and Jon W like this.
  6. Mike

    Mike XenForo Developer Staff Member

    I've added a getSearchContentTypePhrase() method for this, which will use the existing phrase by default. It can be overridden if necessary.
     

Share This Page