Search Results showing only for limited text

Home Forums Product Support Forums Ajax Search Pro for WordPress Support Search Results showing only for limited text

This topic contains 1 reply, has 2 voices, and was last updated by Ernest Marcinko Ernest Marcinko 6 years, 11 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #10588
    jlasantha
    jlasantha
    Participant

    Hi,

    How to highlight a search key word at any place of the post?

    For example;
    I have a post which has around 45,000 characters (or 7500 words). When I run a search, it highlights keywords up to 1500 characters (or 270 words). If the keyword is after that many words, I get just search results, but the keyword with a highlight is not visible. Please check the attachment.

    How to fix this issue?

    Thanks

    Attachments:
    You must be logged in to view attached files.
    #10592
    Ernest Marcinko
    Ernest Marcinko
    Keymaster

    Hi,

    The contextual algorithm is limited on purpose to the first 1800 characters (roughly 300 words) programatically. While it’s highly optimized from various sources, I still implemented this limit for safety – as in some cases it might require much more memory as usual. Not a critical value, but I had to consider it.

    You can lift this limit by editing one of the plugin files. Open up the wp-content\plugins\ajax-search-pro\includes\classes\search\class-asp-search-cpt.php file on your server and scroll to line 1710, which should be this one:

    $haystack = wd_substr_at_word(ASP_mb::strtolower($haystack), 1800);

    and change that line to:

    $haystack = wd_substr_at_word(ASP_mb::strtolower($haystack), 300000);

    This will allow strings up to 300 thousands of characters instead of the initial 1800. However in case you experience any kind of performance problems, then please try reducing it to a lower number.

    Best,
    Ernest Marcinko

    If you like my products, don't forget to rate them on codecanyon :)


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

You must be logged in to reply to this topic.