We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
  • Hi,
    the parameter "showExtract" can accept also tv or only content and introtext?

    Thanks,
    Alessandro
    [ed. note: tillilab last edited this post 12 years, 6 months ago.]
      TilliLab | MODX Ambassador
      website
      • 5811
      • 1,717 Posts
      Yes, you could set up the text where the search term could be highlighted by concatening main fields, TVs and/or joined fields.

      e.g: &showExtract=`3:tv1,tv2,pagetitle,longtitle` set up a text with tv1 + tv2 + pagetitle + longtitle

      The fields should be defined as displayed fields ( see docFields, includeTVs parameters).

      Unfortunately, by setting up a demo, I discovered an issue that you should fix first.

      You could see this new demo here.

      To fix this issue, open the core/components/advsearch/model/advsearch/advsearchresults.class.php file and replace the line 677:
      			$this->tvFields = array_diff(array_merge($this->tvWhereFields, $this->tvFields), $this->tvWhereFields);

      by:
      			$this->tvFields = array_diff(array_merge($this->tvWhereFields, $this->tvFields), $this->tvFields);


      I will open a defect on Github with this issue and with this correction. See "No Extracts Shown from TV Results" issue and commit 4e37138
      [ed. note: coroico last edited this post 12 years, 6 months ago.]
      • Thanks! It works!

        Just a note, following your demo I've seen that I have to take off "&includeTvs=`myTVname`" in order to work,

        is it right?

        Thank you again!
          TilliLab | MODX Ambassador
          website
          • 5811
          • 1,717 Posts
          I've seen that I have to take off "&includeTvs=`myTVname`" in order to work, is it right?

          To be available inside the extracts, the "fields" (mainFields,TVs and joinedFields) should be displayed in the result (displayedFields).

          By default, &fields = `pagetitle,longtitle,alias,description,introtext,content` so except if you use a custom package you always have the main fields of a document resource.

          For TVs, you specify to add the search inside a TV content by adding &withTVs=`myTVname`. In this case by default the content of the TV is also displayable.

          But you could also define a search in a TV with &withTVs=`myTVname1` and add as displayedField the content of an another TV : &includeTVs=`myTVname2` In this case myTVname1 and myTVname2 are both displayable fields.


          • - &withFields defines the fields where to do the search

          • - &fields defines the fields you would like displayed

          • - &withTVs defines the TVs where to do the search and available as displayable content

          • - &includeTVs defines the TVs you would like displayed


          Take care the cheasheet 1.2 have some errors. Replace docFields by fields and withDocFields by withFields. I have released a new version of the document (1.3) See the documentation page of the demo site.


          [ed. note: coroico last edited this post 12 years, 6 months ago.]
          • Very clear!
            thank you again!
            Alessandro
              TilliLab | MODX Ambassador
              website
              • 5811
              • 1,717 Posts
              The proposed correction for bug #4 is not correct (you loose the TVs values added with includeTVs!).

              Find a better correction at https://github.com/Coroico/AdvSearch/issues/4