We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 36686
    • 165 Posts
    I have run into a strange problem. AjaxSearch won’t return results from inside a table, oh yes it will, but only some of the content...

    Feel free to test it on this page:
    http://test.somatherm.se/index.php?id=47

    - Search for the first product number, 9412973, and the page will show up in the search results
    - Search for the second product number, 9412974, and the page will NOT show up in the search results

    What’s going on here? The only explanation I can come up with is that it’s because it’s in a table, but it kind of doesn’t make sense anyway. Very odd huh

    PS. I should probably add that the problem goes away if I move the table from being in a TV to the content area, but I’d rather not do that...
      • 5811
      • 1,717 Posts
      Hi Lottaar

      Do you use the release AS 1.8.1 ?

      As I understand the number "9412974" searched is stored in the LS-11 document :
      Beställningsnummer
      Modell Best nr1 Krom Vit Borstad krom Guld Krom/Guld
      LS-11-DT SEG nr 9412973 9412974 9412975 9412940 9412941

      How is generated the "9412974" number ? Is it the result of a snippet or a chunck ?
      Could you post the content of the document LS-11around this number. Thanks

        • 36686
        • 165 Posts
        Yes, I use 1.8.1. Downloaded and reinstalled in yesterday just in case...

        This particular page is based on a product page template which calls a TV like this: [*BestallningsnummerTabell*]

        The TV type is RichText and it’s accessible only by the product page template.

        In the actual document (47), the content of the TV BestallningsnummerTabell is as follows:
        [tt]
        <h2>Beställningsnummer</h2>
        <div id="bestallningsnummer">
        <table border="0">
        <tbody>
        <tr class="rubriker">
        <th>Modell</th>
        <th>Best nr<sup>1</sup></th>
        <th>Krom</th>
        <th>Vit</th>
        <th>Borstad
        krom</th>
        <th>Guld</th>
        <th>Krom/Guld</th>
        </tr>
        <tr class="rad1">
        <th>LS-11-DT</th>
        <td>SEG nr</td>
        <td>9412973</td>
        <td>9412974</td>
        <td>9412975</td>
        <td>9412940</td>
        <td>9412941</td>
        </tr>
        <tr class="rad2">
        <th> </th>
        <td>RSK nr</td>
        <td>8758589</td>
        <td>8758590</td>
        <td>8758591</td>
        <td>8758592</td>
        <td>8758593</td>
        </tr>
        <tr class="rad1">
        <th>LS-11-RS</th>
        <td>SEG nr</td>
        <td>9412573</td>
        <td>9412574</td>
        <td>9412575</td>
        <td>9412576</td>
        <td>9412577</td>
        </tr>
        <tr class="rad2">
        <th> </th>
        <td>RSK nr</td>
        <td>8758727</td>
        <td>8758728</td>
        <td>8758729</td>
        <td>8758730</td>
        <td>8758731</td>
        </tr>
        </tbody>
        </table>
        <p>
        <sup>1</sup> SEG nr: för beställning hos elinstallatör. RSK nr: för beställning hos VVS-installatör.</p>
        <p> </p>
        </div>[/tt]

        AjaxSearch is called from the chunk {{sidhuvudInner}} which contains this:

        [tt][!AjaxSearch? &ajaxSearch=`0` &AS_landing=`37` &AS_showResults=`0` !][/tt]

        And on the search results page I have this:

        [tt][!AjaxSearch? &ajaxSearch=`0` &AS_showForm=`0` &grabMax=`10`!][/tt]

        Let me know if you need any other info.
          • 36686
          • 165 Posts
          I’ve done some more troubleshooting, and it seems like AjaxSearch stops searching through the content after a certain number of characters.

          So, if I put the article numbers higher up in the page they are searched. If I for example remove the heading, a couple of more article numbers are searchable.

          Is there a setting somewhere for this that I can change?

          I’m getting kind of desperate as the site as about to go live soon and my client demands the article numbers to be searchable before launch... undecided
            • 16610
            • 634 Posts
            Quote from: lottaar at Feb 18, 2009, 02:59 AM

            I’ve done some more troubleshooting, and it seems like AjaxSearch stops searching through the content after a certain number of characters.

            This is exactly what I encountered today also. When you try to search from template variable AjaxSearch will stop searching after about 300 characters. So TVs with a lot of content are definitely a problem. I will contunue to investigate this (bug?) further tomorrow.
              Mikko Lammi, Owner at Maagit
              • 5811
              • 1,717 Posts
              @lottaar

              Could your activate the debug mode of AjaxSearch (&debug=`3`), run a search with the number "9412974" and edit the file ajaxSearch_log.txt located into the snippets/ajaxSearch folder.
              Edit this txt file and search "SELECT", you will find the sql statement used to perform the search. Copy/paste this statement into phpMyAdmin and let me know if the request provide results.
                • 5811
                • 1,717 Posts
                Lottaar and Lammikko

                Look at : http://dev.mysql.com/doc/refman/5.0/en/group-by-functions.html
                The result is truncated to the maximum length that is given by the group_concat_max_len system variable, which has a default value of 1024. The value can be set higher, although the effective maximum length of the return value is constrained by the value of max_allowed_packet. The syntax to change the value of group_concat_max_len at runtime is as follows, where val is an unsigned integer:

                SET [GLOBAL | SESSION] group_concat_max_len = val;

                I have done the example of Lottaar on my laptop and when I search "9412973", I didn’t find anything.
                Then under PhyMyAdmin, in the sql window, I run "SET GLOBAL group_concat_max_len = 4096"; and I get the results.

                So as a quick fix, adds the following Php code lines:
                      if (isset($this->joined)) {
                        $modx->db->query("SET group_concat_max_len = 4096;"); // increase the group_concat
                      }  

                in the ajaxSearch/classes/search.class.inc.php file just before the line #156 :
                $records = $modx->db->query($select);


                Apologize for the inconvenience of this issue.

                Issue registered as AJAXSEARCH-24
                  • 16610
                  • 634 Posts
                  Quote from: coroico at Feb 18, 2009, 03:14 PM

                  Apologize for the inconvenience of this issue.
                  Don’t apologize anything wink Your support and dedication for the AjaxSearch development is outstanding!

                  Problem fixed with your quick fix, thank you very much!
                    Mikko Lammi, Owner at Maagit
                    • 36686
                    • 165 Posts
                    Awesome, fixed it for me as well. No need to apologize! Thanks a million Coroico, you rock!

                    Now I just need to work out why no extract comes up in the search result, but I’m sure I’ve just missed something... smiley

                    Thanks again!
                      • 16610
                      • 634 Posts
                      Quote from: lottaar at Feb 19, 2009, 03:33 AM

                      Now I just need to work out why no extract comes up in the search result, but I’m sure I’ve just missed something... smiley
                      You probably have the same problem as I had. Put something like this to your extract parameter:
                      &extract=`1:tv_value`


                      tv_value is the key part. In wiki documentation there is tv_content instead of tv_value, but that seems to be wrong.
                        Mikko Lammi, Owner at Maagit