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

    Calling the advs with an empty string to search for (just clicked ok too fast) the landing page instead of showing a "human" warning (such as : You did not provide any word to search for! )
    display in my case 34 errors list
    (all the same) :

    Warning: mb_strpos() [function.mb-strpos]: Offset not contained in string in ..../core/components/advsearch/model/advsearch/advsearch.class.php on line 702



    This part of the php file is :
    $nbTerms = count($searchTerms);
    		if (!$nbTerms) {
    			// with an empty searchString - show as introduction the first characters of the text
                if (!empty($text)) {
                    $pos = min(mb_strpos($text, ' ', $extractLength - 1, $encoding), mb_strpos($text, '.', $extractLength - 1, $encoding));
                    if ($pos) $intro = rtrim(mb_substr($text,0,$pos,$encoding), $trimchars) . $ellipsis;
                    else $intro = $text;
                }
                else $intro = '';
               return($this->processChunk($tpl,array('extract' => $intro)));
    		
    		}

    I'm not a php guru but I could understand this is supposed to deal with this empy search case, isn't it ?
    But I just cant understand what this comment means:
    « // with an empty searchString - show as introduction the first characters of the text »

    well, but what text huh Something is not good here of I missed something.

    Thank you
      • 5811
      • 1,717 Posts
      See https://github.com/Coroico/AdvSearch/issues/26 for the fix.

      But I just cant understand what this comment means:
      « // with an empty searchString - show as introduction the first characters of the text »
      well, but what text Something is not good here of I missed something.
      If the searchString is empty (for instance if you only filter the results) then the extract text displayed will be set up with the first characters of the text.
      Obviously if the length of extract requested is zero or if the text to use for setting up the extract is empty, the extract should be empty.
        • 36604
        • 268 Posts
        Heuh. Yes but what about the error?

        It display dozen of those warning in the results page
          • 5811
          • 1,717 Posts
          Have you fixed the code like explained on Github ?
          I can't reproduce your issue so I can't really be hepfull.
            • 36604
            • 268 Posts
            I don't know about the Github stuff : I'll try to check it out asap.

            thank you
              • 42497
              • 5 Posts
              Hi,

              I've had this problem since upgrading to revo 2.2.6 and using AdvSearch 1.0.0 pl. I have a faceted search similar to Example 3 – Dvd Shop. As in docs:
              http://www.revo.wangba.fr/advsearch-documentation.html

              When the text input search is empty the results on next pages (when offset > 0) include the error:

              Warning: mb_strpos() [function.mb-strpos]: Offset not contained in string in ..../core/components/advsearch/model/advsearch/advsearch.class.php on line 702


              I have fixed this by replacing advsearch.class.php with the one here:
              https://github.com/Coroico/AdvSearch/commit/52fee23

              Is this fixed in the Advsearch pl2 release?

              Thanks.