How to show full post title while searching with any keyword

  • 1 year, 2 months ago #32609

    Hello Team,

    When I try to search with an keyword the results are showing relevant to the keyword but the full post title was not showing due to that it looks like duplicate results was shown.

    How could we show full title of the post?

    wpsolr
    Keymaster
    1 year, 2 months ago #32610

    Could you show a screenshot here, so I can understand?

    1 year, 2 months ago #32611

    Please find the screenshot for your reference. Those have different post titles but due to we are showing only highlighting data from method get_highlighting() it was like we are showing repeated data.

    showing only Highlihted related title instead of full title

    wpsolr
    Keymaster
    1 year, 2 months ago #32612

    You can deactivate highlighting with the following code.

    use wpsolr\core\classes\WPSOLR_Events;
    
    add_filter( WPSOLR_Events::WPSOLR_FILTER_HIGHLIGHTING_FIELDS,
    function () {
      /*
      return [					 
      WpSolrSchema::_FIELD_NAME_TITLE,					    
      WpSolrSchema::_FIELD_NAME_CONTENT,					 
      WpSolrSchema::_FIELD_NAME_COMMENTS,
      ];				] 
      */
    
      // No fields highlighted
      return [];
    }
    , 10, 1 );
    1 year, 2 months ago #32613

    Instead of removing the functionality of highlighting, can we increase title characters length. Is that possible?

    wpsolr
    Keymaster
    1 year, 2 months ago #32614

    The length of highlighting snippets is set with “Maximum size of each snippet text in results” on screen 2.1

    1 year, 2 months ago #32615

    My bad, it’s not working even I increased the “Maximum size of each snippet text in results” to 1000 from 100. is anything I’m missing?

    wpsolr
    Keymaster
    1 year, 2 months ago #32616

    You can then turn off highlighting with my previous code

    1 year, 2 months ago #32631

    Sure, Thank you

Viewing 9 posts - 1 through 9 (of 9 total)

You must be logged in to reply to this topic.