• [SOLVED] advsearch: showextract from tv#

  • tillilab Reply #1, 7 months ago

    Reply
    Hi,
    the parameter "showExtract" can accept also tv or only content and introtext?

    Thanks,
    Alessandro


  • coroico Reply #2, 7 months ago

    Reply
    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


  • tillilab Reply #3, 7 months ago

    Reply
    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!


  • coroico Reply #4, 7 months ago

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




  • tillilab Reply #5, 6 months, 4 weeks ago

    Reply
    Very clear!
    thank you again!
    Alessandro


  • coroico Reply #6, 6 months, 3 weeks ago

    Reply
    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