PassMark Logo
Home » Forum

Announcement

Collapse
No announcement yet.

Broken Categories

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Broken Categories

    Hi there,

    We have an issue with our categories. We just noticed the problem but it may have been there for a while ...

    The site is: www.infomed.ch

    - When you do a search from any page (top left search window), the results show the breakdown by category, e.g. search for "aspirin" will show 107 results by category (37/64/2 respectively). When you click on one of the categories the search results page refreshes with the correct results, so far so good.

    - However, if I click on a category (e.g. pharma-kritik) and then try to go to 2nd page of results the zoom_cat variable is not populated properly, ie. the variable in the url shows up as zoom_cat[]=0 so that the next page shows the unfiltered results again.

    - Also, when I try to do a search from the advanced interface and select a category the results are not filtered by category. (the value in the dropdown menu is correct, but somehow the value is not passed along properly) The resulting page url as shows something like zoom_cat[]=1

    Are we doing something wrong in the configuration?

    Best regards
    ph

  • #2
    We had a look at your site. First, to confirm, it appears that you have an "infomed_search.php" page which acts as a wrapper to the CGI.

    The problem appears to be that while this works (note the parameter "zoom_cat=0" refers to "pharama-kritik" category):
    http://www.infomed.ch/infomed_search...=1&zoom_sort=0

    This, however, does not work (even though it should and we expect it) with the parameter "zoom_cat[]=0":

    (replace the "zoom_cat=0" part of the URL above with "zoom_cat[]=0")

    Note that it failed to pick up the category parameter and now thinks we're searching in All categories.

    Now, we tried to guess where your CGI is, and think we found it. But you might want to confirm if this might be a different copy than what your PHP script is calling. Anyhow, passing the same parameters to the CGI here:

    (replace the "infomed_search.php" part of the last URL with "cgi-bin/search.cgi")

    You can see that the CGI successfully retrieved the "zoom_cat[]=0" parameter and it has narrowed the search to "pharma-kritik".

    Note that if you see broken encoding in the CGI output here it is not a problem, the browser simply does not recognize it is UTF-8 without the headers. If you switch the encoding in the browser to UTF-8, it will look ok.

    If you can show us the code you are using in infomed_search.php, we may be able to help. But best to check with the author of that code first.
    --Ray
    Wrensoft Web Software
    Sydney, Australia
    Zoom Search Engine

    Comment


    • #3
      Thank you Ray for your reply.

      I will try to answer your questions.

      - Correct, infomed_search.php acts as a wrapper for the cgi script

      - cgi script is located here: http://infomed.ch/cgi-bin/search.cgi
      (I think this is the same you already accessed)

      - Here is how the cgi script is called up within the php wrapper:

      NOTE: We switched web servers a few months ago and the hosting company had to make the change that you see below in order for the search to work at all, ie. switch from virtual() to echo_get_file_contents() ... maybe this is the culprit and we just didn't notice it yet?

      Code:
      <?php
      $QSTRING = rawurldecode($_SERVER['QUERY_STRING']);
      
      //virtual("/cgi-bin/search.cgi".'?'.$QSTRING);
      # virtual() wird in unserer Konfig nicht unterstuetzt
      #virtual("/cgi-bin/search.cgi".'?'.$QSTRING);
      # die folgende Zeile wuerde ich als virtual() Ersatz empfehlen
      # szyndler@datapark.ch 25.03.2013
      
      echo file_get_contents('http://infomed.ch/cgi-bin/search.cgi?'.$QSTRING);
      ?>
      Thanks
      ph

      Originally posted by Ray View Post
      We had a look at your site. First, to confirm, it appears that you have an "infomed_search.php" page which acts as a wrapper to the CGI.

      The problem appears to be that while this works (note the parameter "zoom_cat=0" refers to "pharama-kritik" category):
      http://www.infomed.ch/infomed_search...=1&zoom_sort=0

      This, however, does not work (even though it should and we expect it) with the parameter "zoom_cat[]=0":

      (replace the "zoom_cat=0" part of the URL above with "zoom_cat[]=0")

      Note that it failed to pick up the category parameter and now thinks we're searching in All categories.

      Now, we tried to guess where your CGI is, and think we found it. But you might want to confirm if this might be a different copy than what your PHP script is calling. Anyhow, passing the same parameters to the CGI here:

      (replace the "infomed_search.php" part of the last URL with "cgi-bin/search.cgi")

      You can see that the CGI successfully retrieved the "zoom_cat[]=0" parameter and it has narrowed the search to "pharma-kritik".

      Note that if you see broken encoding in the CGI output here it is not a problem, the browser simply does not recognize it is UTF-8 without the headers. If you switch the encoding in the browser to UTF-8, it will look ok.

      If you can show us the code you are using in infomed_search.php, we may be able to help. But best to check with the author of that code first.

      Comment


      • #4
        Not sure if this is the same host as the one you mentioned in your previous thread in April. There, we needed to use rawurldecode() because the server was encoding the URL. I wonder if you have since moved to a different web host, and you may not need this anymore. OR, if it's the same one and this is still needed.

        Anyhow if you still have problems, perhaps you can workaround it by adding this line before your file_get_contents line:

        $QSTRING = str_replace("zoom_cat%5B%5D", "zoom_cat", $QSTRING);
        Last edited by Ray; Aug-30-2013, 04:37 AM. Reason: typo in the line of code
        --Ray
        Wrensoft Web Software
        Sydney, Australia
        Zoom Search Engine

        Comment


        • #5
          Hi Ray,

          Thanks for your help.
          It is indeed still the same server as back in April. Nothing has changed since then, so it is likely that we just noticed the problem now.

          I have tried the following change, but this meant that no search results at all would be displayed.

          Code:
          <?php
          //$QSTRING = $_SERVER['QUERY_STRING'];
          $QSTRING = rawurldecode($_SERVER['QUERY_STRING']);
          
          //virtual("/cgi-bin/search.cgi".'?'.$QSTRING);
          # virtual() wird in unserer Konfig nicht unterstuetzt
          #virtual("/cgi-bin/search.cgi".'?'.$QSTRING);
          # die folgende Zeile wuerde ich als virtual() Ersatz empfehlen
          # [email]szyndler@datapark.ch[/email] 25.03.2013
          
          $QSTRING = str_replace("zoom_cat%5B%5D", "zoom_cat"); 
          echo file_get_contents('http://infomed.ch/cgi-bin/search.cgi?'.$QSTRING);
          ?>
          The line before the file_get_contents line is now commented out again on the live site.
          I also tried inserting the line before the rawurlencode but that made no change (ie. the original problems still exist).

          Rgds
          ph

          Comment


          • #6
            Sorry, I left out a pivotal part of that line of code. It should be:

            $QSTRING = str_replace("zoom_cat%5B%5D", "zoom_cat", $QSTRING);
            --Ray
            Wrensoft Web Software
            Sydney, Australia
            Zoom Search Engine

            Comment


            • #7
              Hi again Ray,

              Thanks, I should have noticed this myself!
              Anyway, I played around with this a little bit and got it to work.
              Instead of searching for "zoom_cat%5B%5D" (which didn't work), I searched and replaced "zoom_cat[]", which now works properly, as far as I can tell.

              Code:
              <?php
              //$QSTRING = $_SERVER['QUERY_STRING'];
              $QSTRING = rawurldecode($_SERVER['QUERY_STRING']);
              $QSTRING = str_replace("zoom_cat[]", "zoom_cat", $QSTRING);
              
              //virtual("/cgi-bin/search.cgi".'?'.$QSTRING);
              # virtual() wird in unserer Konfig nicht unterstuetzt
              #virtual("/cgi-bin/search.cgi".'?'.$QSTRING);
              # die folgende Zeile wuerde ich als virtual() Ersatz empfehlen
              # [email]szyndler@datapark.ch[/email] 25.03.2013
              
              echo file_get_contents('http://infomed.ch/cgi-bin/search.cgi?'.$QSTRING);
              ?>
              Thanks again for your help!
              ph

              Comment

              Working...
              X