We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 28788
    • 79 Posts
    Hi guys,

    I’ve looked all through the documentation and the forum but I cant find any mention of this:

    My search works perfectly but for results within a template variable there is no extract in the results.

    My call from within a chunk:
    [[AjaxSearch?&extract=`10`]]


    The returned search (source):
    <div class="AS_ajax_result">
      <a class="AS_ajax_resultLink" href="/index.php?id=55&searched=and&advsearch=oneword&highlight=ajaxSearch_highlight+ajaxSearch_highlight1" title="portfolio">Bedroom</a>
      <div class="AS_ajax_resultExtract"><p>...da again to totally revamp their online identity
    going from a Flash based site to a dynamic XHTML <span class="ajaxSearch_highlight ajaxSearch_highlight1">and</span> CSS site fully
    integrated with a custom CMS from Moonrocket.  ...</p></div>
    </div>
    
    <div class="AS_ajax_result">
      <a class="AS_ajax_resultLink" href="/index.php?id=1&searched=and&advsearch=oneword&highlight=ajaxSearch_highlight+ajaxSearch_highlight1" title="home">Home</a>
      <div class="AS_ajax_resultExtract"><p></p></div>
    </div>
    


    As you can see the first result is from the page content field the second with the empty extract is from the TV. This happens with all TVs regardless of the content, any ideas?

    Thanks.
      • 28788
      • 79 Posts
      Actually I’ve just noticed that is listed here under tests:
      http://www.modx.wangba.fr/index.php?id=214

      But I don’t get it, surely that is not a feature?

      Sorry that sounded like a criticism what I mean is, is there any way around it? I’d like to have extracts for TVs.

      Thanks
        • 5811
        • 1,717 Posts
        Thks to look at this new demo http://www.modx.wangba.fr/index.php?id=236. Use for instance 2007-10 as search word.

        Replace your call [[AjaxSearch?&extract=`10`]] by [[AjaxSearch?&extract=`10:content,tv_value`]]

        http://www.modx.wangba.fr/index.php?id=214 is deprecated regarding extract with TV and the ajaxSearch_readme.txt file is wrong :

        &extract [int : Comma separated list of searchable fields | ’99:site_content,tmplvar_contentvalues] (optional)
        should be replaced by
        &extract [int : Comma separated list of searchable fields | ’99:content,tv_content] (optional)
        Snippet code initialisation is correct:
        // &extract [ n:searchable fields list | 1:content,description,introtext,tv_content]
        // show the search terms highlighted in a little extract
        // n : maximum number of extracts displayed
        // ordered searchable fields list : separated list of fields define as searchable in the table definition
        // by default : 1:content,description,introtext,tv_content - One extract from content then description,introtext,tv_content
        $cfg[’extract’] = isset($extract) ? $extract : (isset($__extract) ? $__extract : ’1:content,description,introtext,tv_content’);
          • 28788
          • 79 Posts
          Fantastic thanks, that is now working as you described.

          Your help is appreciated.