Jump to content

mike2

Members
  • Posts

    73
  • Joined

  • Last visited

Posts posted by mike2

  1. you need to do a little defining before you can write any code. for each of the four possibilities, 1) exact,  2) exact with excluded word(s), 3) any, 4) any with excluded word(s), what will be the search term you build and supply to the $swish->query() method?

     

    you also need to define if you are going to allow multiple excluded words (i.e. -word1 -word2) and you must handle the case where there is a - as part of an exact phrase search, such as finding a negative number -1000 and how to distinguish that from excluded word(s). you also need to decide if the excluded -word can appear at any place within the term entered in the search box or if they must be at the end (or even if you should have a separate box for excluded word(s) - this method would address the questions i posed about things like a -1000 in an exact phrase search. you could even do away with the - to identify excluded words since any excluded words would come from a different input text box.) also, if the search box contains any of the and, or, near or not boolean operator keywords, you must surround those keywords with double-quotes, making them a phrase, so that they won't affect the actual search result logic.

     

    the key to understanding the search terms you are trying to build is that the search term is a logical statement that produces a boolean (true/false) value. when the search term is TRUE, the matching file will be in the search results.

     

    1) for an exact phrase search, the phrase must be enclosed by double-quotes. the double-quotes are part of the string you pass to the $swish->query() method, not be confused with any double-quotes that delimit php strings that are part of the php syntax in your code. for your Oil Gas Company example, the literal query would be "Oil Gas Company".

     

    2) for an exact phrase with excluded word(s), the phrase is enclosed by double-quotes, followed by the not keyword and the word(s) to exclude. for the example Oil Gas Company -money, the search term would be "Oil Gas Company" not money (there is an implied/default and operator right before the not keyword.)

     

    3) your any phrase condition is actually an or (the default between words/terms is an and). for the example Oil Gas Company, the search term would be Oil or Gas or Company.

     

    4) for the any phrase with excluded word(s), for the example Oil Gas Company -money, the search term would be (Oil or Gas or Company) not money (the (...) around the or'ed term insures the intended operator precedence due to the implied/default and operator right before the not keyword.)

     

    next, in addition to your exact phrase and any word searches, are you planning on an all word search (all the word(s) must be present, but not necessarily together in the form of a phrase)? this would use and between the words (or simply leave it out between the words since it is the default.)

     

    lastly, you may want to consider having the user's put double quotes around the exact phrase part of what they are searching for.so that they can enter just about anything for a search - "Oil Gas Company" credit -money (search for the exact phrase Oil Gas Company, with the word credit, and without the word money. in this case, they would need to select between the any/all search (or you could allow them an option to enter the search exactly the way the want with the and, or, near or not boolean operator keywords fully under their control.)

    OK I will take all of that into consideration. In your opinion is still possible to do this using the Swish-e search engine?

     

    Here is the Swish-e link

     

    Swish-e.org

  2. To whom it may concern:

     

    I have PHP code that I am trying to improve upon. I want to fix it so that when I put a dash next to a word, the word that is next to a dash is excluded.

     

    I also want to see if it is possible, what would I have to change in my code so that when I search for words or phrases within PDF documents, that I get exactly what I want.

     

    Whenever I have the Exact Phrase radio button enabled, and I type in the phrase Oil Gas Company, three PDF appear, however when I open the links of those PDF documents to search for that phrase, that exact phrase is not there so since it is not there I want to know what I would have to do to fix it so that the 0 matches found appears on my screen?

     

    also

     

    When it comes to using the dash what I want know is, is it possible to have something like Tax credit -appraisal in the search box and when either the Exact Phrase or the Any Phrase radio is selected it will do the function of both radio buttons but at the same time exclude the word appraisal in its search?

     

    Any Phrase meaning of course it will search for either words in the phrase and bring up PDFs that have either results or both.

     

    I ask these questions because whenever I type into the my search box bank and loans -money while the Exact Phrase radio button is highlighted it is only suppose to return PDF documents that have that exact phrase but without the word money in them. Is this possible with my code. 

     

    Is this possible with my code?

    attached with this message is my php code. Any help would be greatly appreciated.

     

    Finalsearchcode2.txt

  3. this is code (untested since i don't have any swish code) based on your previous thread, using the swish data seek method, hopefully you can learn from this -

    <?php
    // business logic - determine what to do on the page and get/produce the data that's needed for the content on the page
    
    $limit = 10; // pagination number of rows per page
    
    // get any search term (required)
    $search_term = isset($_GET['q']) ? trim($_GET['q']) : '';
    
    if($search_term != ''){
        try {
            $swish = new Swish('/var/www/html/pdf2/index.swish-e');
    
            // get and run query from url query string
            $result = $swish->query($search_term);
    
            // at this point, you know how many matches there are and can calculate the number of pages
            // Find out how many items are in the table
            $totalItems = $result->hits;
    
            // find how many pages are needed
            $totalPages = ceil($totalItems / $limit);
    
            // Find out which page we are on
            $page = min($totalPages, filter_input(INPUT_GET, 'page', FILTER_VALIDATE_INT, array(
                'options' => array(
                    'default'   => 1,
                    'min_range' => 1,
                ),
            )));
    
            // Calculate the offset for the query/result set
            $offset = ($page - 1)  * $limit;
            
            $data = array();
            if($totalItems > 0){ // at least one result
                // the calculated $offset is used in the following to seek to the correct starting row
                $result->seekResult($offset);
                $x = 1;
                // loop until no more rows or $limit has been reached
                while(($r = $result->nextResult()) && $x <= $limit)
                {
                    $data[] = $r;
                    $x++;
                }
    
                // get company/country information (only if there are results to display)
                $file = '/var/www/html/active_colist.csv';
                $fh = fopen($file, 'r');
                $companies = array();
                $row = fgetcsv($fh, 1024); // ignore header
                while ($row = fgetcsv($fh, 1024)) {
                    $companies[$row[0]] = array('company' => $row[1], 'country' => $row[3]); //changed line
                }
                fclose($fh);
            }
        
        } catch (SwishException $e) {
            trigger_error($e->getMessage());
            die('Sorry, the application experienced an error and cannot run.');
        }
    }
    
    // presentation logic - take the data produced by the business logic above and output the html document
    
    // build pagination here...
    $pagination_links = '';
    if(isset($totalPages) && $totalPages > 1){ // more than one page
        // Some information to display to the user
        $start = $offset + 1;
        $end = min(($offset + $limit), $totalItems);
    
        // "back" link
        if($page > 1){
            $_GET['page'] = 1;
            $qs = http_build_query($_GET, '', '&');
            $prevlink =  "<a href='?$qs' title='First page'>«</a>";
            $_GET['page'] = $page - 1;
            $qs = http_build_query($_GET, '', '&');
            $prevlink .= " <a href='?$qs' title='Previous page'>‹</a>";
        } else {
            $prevlink = '<span class="disabled">«</span> <span class="disabled">‹</span>';
        }
    
        // "forward" link
        if($page < $totalPages){
            $_GET['page'] = $page + 1;
            $qs = http_build_query($_GET, '', '&');
            $nextlink =  "<a href='?$qs' title='Next page'>›</a>";
            $_GET['page'] = $totalPages;
            $qs = http_build_query($_GET, '', '&');        
            $nextlink .= " <a href='?$qs' title='Last page'>»</a>";
        } else {
            $nextlink = '<span class="disabled">›</span> <span class="disabled">»</span>';
        }
        $pagination_links = "<div id='paging'><p>$prevlink Page $page of $totalPages pages, displaying $start-$end of $totalItems results $nextlink</p></div>";
    }
    ?>
    <html>
    <head></head>
    <body>
    <img src="/wvb-logo-slogen.png" border="0" />
    <h2>Search</h2>
    <form method="get" action="<?php echo htmlentities($_SERVER['PHP_SELF']); ?>">
    <input type="text" name="q" size="30" value="<?php echo htmlentities($search_term); ?>" />
    <input type='submit' value='Submit'>
    </form>
    
    <?php
    if($search_term != ''){ ?>
        <h2>Search Results</h2>
        Found <?php echo $totalItems; ?> match(es) for '<?php echo htmlentities($search_term); ?>'.
        <?php
        echo "<div>$pagination_links</div>"; // display pagination at the top of data
        // iterate over result set
        foreach($data as $r)
        { ?>
            <p>
            <?php echo $r->swishreccount; ?>
            <strong>
            <a href="<?php echo '/pdf2', ltrim($r->swishdocpath, '.') ;  ?>">
            <?php echo $r->swishdocpath; ?>
            </a>
            </strong> (score: <?php echo $r->swishrank; ?>) <br/>
            <?php echo $r->swishdocpath; ?><br />
            <?php
            //Split a filename  by .
            $filenames = explode(".", $r->swishdocpath);
            //get 3 chars from $filenames to $country
            $wvb_number = substr($filenames[1],1,12);
            $country = substr($filenames[1],1,3);
            echo 'Country: '.$companies[$wvb_number]['country']."<br />";
            //echo 'Country Name: '.$country."<br />";
            //$filenames[2] = explode(".", $r->swishdocpath);
            $year = substr($filenames[2],0,4);
            echo 'Year: '.$year."<br />";
            //$filenames = explode(".", $r->swishdocpath);
            //$wvb_number = substr($filenames[1],1,12);
            echo 'WVB Number: '.$wvb_number."<br />";
            echo 'Company Name: '.$companies[$wvb_number]['company'];
            //echo 'Country: '.$companies[$wvb_number]['country'];
    
            echo '</p>';
        } // end of data display loop
        echo "<div>$pagination_links</div>"; // display pagination at the bottom of data
    } // end search results
    ?>
    </body>
    </html>

    btw - again not trying to pick on you, but are you testing your current code? what happens after you preform one search (or your search doesn't match anything)? you are not redisplaying the search form, so the visitor doesn't have any direct way of searching again. in the above code, the display of the search form is unconditional.

    I will learn from this. Thank you for the advice.

  4. what you are asking can be accomplished, but as stated in one of your previous threads, requires that the code on your page be organized correctly (which Psycho has now also told you is needed.)

     

    also as stated in the previous thread, to paginate using an array requires that you store the result from your Swish query in that array, in a session variable (there's little point in using the array method over using the swish data seek method if you are not saving any processing time by doing it since it requires more program logic to be written for the array method.)

     

    not trying to pick on you, but do you know where in your current code you are getting the result from the Swish query so that you could modify it to use either the Swish data seek or the array method for pagination?

     

    btw - the part of the pagination code you found that is getting and modifying the url's query string parameters can all pretty much be replaced with a http_build_query() statement.

    Here is my answer to your question:

     

    This is where I am getting the result from my Swish query:

     

     

          <a href="<?php echo '/pdf2', ltrim($r->swishdocpath, '.') ;  ?>">
             <?php echo $r->swishdocpath; ?>
          </a>
       </strong> (score: <?php echo $r->swishrank; ?>) <br/>
    <?php echo $r->swishdocpath; ?><br />
    

     

    To the best of my knowledge this code displays my PDF files as links and they open up when you click them.

     

    Is that what you are asking me?

  5. this is code (untested since i don't have any swish code) based on your previous thread, using the swish data seek method, hopefully you can learn from this -

    <?php
    // business logic - determine what to do on the page and get/produce the data that's needed for the content on the page
    
    $limit = 10; // pagination number of rows per page
    
    // get any search term (required)
    $search_term = isset($_GET['q']) ? trim($_GET['q']) : '';
    
    if($search_term != ''){
        try {
            $swish = new Swish('/var/www/html/pdf2/index.swish-e');
    
            // get and run query from url query string
            $result = $swish->query($search_term);
    
            // at this point, you know how many matches there are and can calculate the number of pages
            // Find out how many items are in the table
            $totalItems = $result->hits;
    
            // find how many pages are needed
            $totalPages = ceil($totalItems / $limit);
    
            // Find out which page we are on
            $page = min($totalPages, filter_input(INPUT_GET, 'page', FILTER_VALIDATE_INT, array(
                'options' => array(
                    'default'   => 1,
                    'min_range' => 1,
                ),
            )));
    
            // Calculate the offset for the query/result set
            $offset = ($page - 1)  * $limit;
            
            $data = array();
            if($totalItems > 0){ // at least one result
                // the calculated $offset is used in the following to seek to the correct starting row
                $result->seekResult($offset);
                $x = 1;
                // loop until no more rows or $limit has been reached
                while(($r = $result->nextResult()) && $x <= $limit)
                {
                    $data[] = $r;
                    $x++;
                }
    
                // get company/country information (only if there are results to display)
                $file = '/var/www/html/active_colist.csv';
                $fh = fopen($file, 'r');
                $companies = array();
                $row = fgetcsv($fh, 1024); // ignore header
                while ($row = fgetcsv($fh, 1024)) {
                    $companies[$row[0]] = array('company' => $row[1], 'country' => $row[3]); //changed line
                }
                fclose($fh);
            }
        
        } catch (SwishException $e) {
            trigger_error($e->getMessage());
            die('Sorry, the application experienced an error and cannot run.');
        }
    }
    
    // presentation logic - take the data produced by the business logic above and output the html document
    
    // build pagination here...
    $pagination_links = '';
    if(isset($totalPages) && $totalPages > 1){ // more than one page
        // Some information to display to the user
        $start = $offset + 1;
        $end = min(($offset + $limit), $totalItems);
    
        // "back" link
        if($page > 1){
            $_GET['page'] = 1;
            $qs = http_build_query($_GET, '', '&');
            $prevlink =  "<a href='?$qs' title='First page'>«</a>";
            $_GET['page'] = $page - 1;
            $qs = http_build_query($_GET, '', '&');
            $prevlink .= " <a href='?$qs' title='Previous page'>‹</a>";
        } else {
            $prevlink = '<span class="disabled">«</span> <span class="disabled">‹</span>';
        }
    
        // "forward" link
        if($page < $totalPages){
            $_GET['page'] = $page + 1;
            $qs = http_build_query($_GET, '', '&');
            $nextlink =  "<a href='?$qs' title='Next page'>›</a>";
            $_GET['page'] = $totalPages;
            $qs = http_build_query($_GET, '', '&');        
            $nextlink .= " <a href='?$qs' title='Last page'>»</a>";
        } else {
            $nextlink = '<span class="disabled">›</span> <span class="disabled">»</span>';
        }
        $pagination_links = "<div id='paging'><p>$prevlink Page $page of $totalPages pages, displaying $start-$end of $totalItems results $nextlink</p></div>";
    }
    ?>
    <html>
    <head></head>
    <body>
    <img src="/wvb-logo-slogen.png" border="0" />
    <h2>Search</h2>
    <form method="get" action="<?php echo htmlentities($_SERVER['PHP_SELF']); ?>">
    <input type="text" name="q" size="30" value="<?php echo htmlentities($search_term); ?>" />
    <input type='submit' value='Submit'>
    </form>
    
    <?php
    if($search_term != ''){ ?>
        <h2>Search Results</h2>
        Found <?php echo $totalItems; ?> match(es) for '<?php echo htmlentities($search_term); ?>'.
        <?php
        echo "<div>$pagination_links</div>"; // display pagination at the top of data
        // iterate over result set
        foreach($data as $r)
        { ?>
            <p>
            <?php echo $r->swishreccount; ?>
            <strong>
            <a href="<?php echo '/pdf2', ltrim($r->swishdocpath, '.') ;  ?>">
            <?php echo $r->swishdocpath; ?>
            </a>
            </strong> (score: <?php echo $r->swishrank; ?>) <br/>
            <?php echo $r->swishdocpath; ?><br />
            <?php
            //Split a filename  by .
            $filenames = explode(".", $r->swishdocpath);
            //get 3 chars from $filenames to $country
            $wvb_number = substr($filenames[1],1,12);
            $country = substr($filenames[1],1,3);
            echo 'Country: '.$companies[$wvb_number]['country']."<br />";
            //echo 'Country Name: '.$country."<br />";
            //$filenames[2] = explode(".", $r->swishdocpath);
            $year = substr($filenames[2],0,4);
            echo 'Year: '.$year."<br />";
            //$filenames = explode(".", $r->swishdocpath);
            //$wvb_number = substr($filenames[1],1,12);
            echo 'WVB Number: '.$wvb_number."<br />";
            echo 'Company Name: '.$companies[$wvb_number]['company'];
            //echo 'Country: '.$companies[$wvb_number]['country'];
    
            echo '</p>';
        } // end of data display loop
        echo "<div>$pagination_links</div>"; // display pagination at the bottom of data
    } // end search results
    ?>
    </body>
    </html>

    btw - again not trying to pick on you, but are you testing your current code? what happens after you preform one search (or your search doesn't match anything)? you are not redisplaying the search form, so the visitor doesn't have any direct way of searching again. in the above code, the display of the search form is unconditional.

    I am testing my current code. I got the results as shown above where the paginated links just keep showing up in separate results.

  6. Hello everyone.

     

     

    I have some code that I need some assistance with. By the way I am using CentOS 6.5 on my Linux server.

     

    Here is my current code:

     

     

    <html>
      <head></head>
      <body>
      <?php if (!isset($_POST['q'])) { ?>
    
    
    <img src="/wvb-logo-slogen.png" border="0" /> //code for logo
        <h2>Search</h2>
        <form method="post" action="<?php echo htmlentities($_SERVER['PHP_SELF']); ?>">
          <input type="text" name="q" size="30" />
        </form>
    
      <?php } else { ?>
    
    <img src="/wvb-logo-slogen.png" border="0" /> //code for logo
        <h2>Search Results</h2>
    
    
      <?php
        try {
          // create object
         // $swish = new Swish('/usr/local/apache/htdocs/swish/index.swish-e');
            $swish = new Swish('/var/www/html/pdf2/index.swish-e');
    
    
          // get and run query from command-line
          $queryStr = htmlentities($_POST['q']);
          $result = $swish->query($queryStr);
      ?>
    
       Found <?php echo $result->hits; ?> match(es) for '<?php echo $queryStr; ?>'.
    
      <?php
          // iterate over result set
          // print details for each match
          while($r = $result->nextResult()) {
       ?>
    
      <p>
        <?php echo $r->swishreccount; ?>
          <strong>
          <a href="<?php echo '/pdf2', ltrim($r->swishdocpath, '.') ;  ?>">
             <?php echo $r->swishdocpath; ?>
          </a>
       </strong> (score: <?php echo $r->swishrank; ?>) <br/>
    <?php echo $r->swishdocpath; ?><br />
    
    <?php
    
    $file = '/var/www/html/active_colist.csv';
    $fh = fopen($file, 'r');
    $companies = array();
    $row = fgetcsv($fh, 1024); // ignore header
    while ($row = fgetcsv($fh, 1024)) {
        $companies[$row[0]] = array('company' => $row[1], 'country' => $row[3]); //changed line
       }
    fclose($fh);
    
    
    //Split a filename  by .
    $filenames = explode(".", $r->swishdocpath);
    //get 3 chars from $filenames to $country
    $wvb_number = substr($filenames[1],1,12);
    $country = substr($filenames[1],1,3);
    echo 'Country: '.$companies[$wvb_number]['country']."<br />";
    //echo 'Country Name: '.$country."<br />";
    //$filenames[2] = explode(".", $r->swishdocpath);
    $year = substr($filenames[2],0,4);
    echo 'Year: '.$year."<br />";
    //$filenames = explode(".", $r->swishdocpath);
    //$wvb_number = substr($filenames[1],1,12);
    echo 'WVB Number: '.$wvb_number."<br />";
    echo 'Company Name: '.$companies[$wvb_number]['company'];
    
    
    ?>
     
      </p>
    
    
    //Suggested Pagination code.
    
        <?php  
        ///////////////FILLING ARRAY WITH DUMMY DATA////////////////////  
        $key = array();  
        for($i=0; $i<200; $i++)  
        {  
         //fill array data  
         $key[] = "num = ".$i;  
        }  
        ////////////////////////////////////////////////////////////////  
          
        /////////////////////START OF ARRAY PAGINATION CODE/////////////////////  
        $ptemp="http://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];  
        $pt=explode('&',$ptemp);  
        if (strpos($ptemp,'pageno'))  
         array_pop($pt);  
        $pt=implode('&',$pt);  
        $ptemp=$pt;  
        $array=$key; // REPLACE $KEY WITH YOUR ARRAY VARIABLE  
        $page = $_REQUEST['pageno'];  
          
        $currentpage = isset($page) ? (integer)$page : 1;  
        $numperpage = 10; //NUMBER OF RECORDS TO BE DISPLAYED PER PAGE  
          
        $total = count($array);  
        $numofpages = ceil($total / $numperpage); //TOTAL NUMBER OF PAGES  
          
        if(isset($array))  
        {  
            if (($currentpage > 0) && ($currentpages <= $numofpages))  
         {  
                //STARTING LOOP FOR ARRAY DATA  
                $start = ($currentpage-1) * $numperpage;  
                for($i=$start;$i<=($numperpage+$start-1);$i++)   
          {  
                    ///////////PLACE YOUR CODE HERE//////////////////////////  
                    echo $array[$i] .'  
        ';  
           ////////////////////////////////////////////////////////  
                }  
         }  
        }  
        if ($currentpage != 1)   
        { //GOING BACK FROM PAGE 1 SHOULD NOT BET ALLOWED  
         $previous_page = $currentpage - 1;  
         $previous = '<a href="'.$ptemp.'?pageno='.$previous_page.'"> <</a> ';      
        }      
        $pages = '';  
        for ($a=1; $a<=$numofpages; $a++)  
        {  
          if ($a == $currentpage)   
         $pages .= $a .'</u> ';  
          else   
         $pages .= '<a href="'.$ptemp.'?pageno='.$a.'" >'. $a .'</a> ';  
        }  
        $pages = substr($pages,0,-1); //REMOVING THE LAST COMMA (,)  
          
        if ($currentpage != $numofpages)   
        { //GOING AHEAD OF LAST PAGE SHOULD NOT BE ALLOWED  
         $next_page = $currentpage + 1;  
         $next = ' <a href="'.$ptemp.'?pageno='.$next_page.'"> ></a>';  
        }  
        echo '  
          
        '. $previous . $pages . $next; //PAGINATION LINKS  
        /////////////////////END OF ARRAY PAGINATION CODE/////////////////////  
        ?>  
    
    
    
    
    
    
      <?php
          }
        } catch (Exception $e) {
          die('ERROR: ' . $e->getMessage());
        }
      }
      ?>
    
      </body>
    </html>

     

    As you can see from the code above when I implemented that code into my script I was able to get it to display but only after the </p> marker. When I did that I got the following results.

     

    Results:

     

    Found 736 match(es) for 'test'. 1   ./ITA000030192.2013.A.00.L.12.31.PDF   (score: 1000)
    ./ITA000030192.2013.A.00.L.12.31.PDF
    Country: Italian Republic (Italy)
    Year: 2013
    WVB Number: ITA000030192
    Company Name: BEGHELLI
    num = 0 num = 1 num = 2 num = 3 num = 4 num = 5 num = 6 num = 7 num = 8 num = 9 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20  > 2   ./ITA000030164.2013.A.00.L.12.31.PDF   (score: 976)
    ./ITA000030164.2013.A.00.L.12.31.PDF
    Country: Italian Republic (Italy)
    Year: 2013
    WVB Number: ITA000030164
    Company Name: CREDITO EMILIANO
    num = 0 num = 1 num = 2 num = 3 num = 4 num = 5 num = 6 num = 7 num = 8 num = 9 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20  >
    
    127   ./IND000102048.2012.A.00.E.03.31.PDF   (score: 457)
    ./IND000102048.2012.A.00.E.03.31.PDF
    Country:
    Year: 2012
    WVB Number: IND000102048
    Company Name:
    num = 0 num = 1 num = 2 num = 3 num = 4 num = 5 num = 6 num = 7 num = 8 num = 9 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20  > 128   ./NLD000030064.2013.A.00.E.12.28.PDF   (score: 457)
    ./NLD000030064.2013.A.00.E.12.28.PDF
    

     

    The results page shows that there are 736 matches. There are currently 5000 PDF files in the /var/www/html/pdf2 directory.

    What I am trying to accomplish in terms of pagination is twofold.

    First get the above page links to display on the top and bottom of the page and only display 10 results at a time on each page.

    Second have the links working correctly so that they can go to the correct results.

    Can this be accomplished with the above pagination code where it states //Suggested pagination code? Do I need to change my layout?

     

    Furthermore I was also told that I should focus on the following lines of code:

     

        <?php  
        ///////////////FILLING ARRAY WITH DUMMY DATA////////////////////  
        $key = array();  
        for($i=0; $i<200; $i++)  
        {  
         //fill array data  
         $key[] = "num = ".$i;  
        }
    

     

    as well as the result variable

     

          $queryStr = htmlentities($_POST['q']);
          $result = $swish->query($queryStr);
    

     

    What would I need to change in these two areas in order to get what it is that I am trying to accomplish. Sorry for the large post. Any assistance would be greatly appreciated.

     

  7. Here in lies my problem with changing the layout of the code:

     

    I have never used php coding before to do a project like this. This project was assigned to me for work and I have mostly been getting help from people who do know php. I e-mailed this one particular individual to see if he would be willing to do it for me and if so would he charge me because to be quite honest with you I am not sure I am going to have this completed by the June 20th date. 

     

    Would it be wrong of me to send you the complete details of what I am trying to accomplish as well as ask if either you or someone you know whom you could recommend would be willing to do it for me?

     

    I am in way over my head here. I have never done anything like this before and I am getting desperate to get this project completed because I don't want to get in trouble for not having this completed on time.

    To answer your question honestly I am worried that my output is not going to come out correctly. I am concerned it is going to come out with lines skipped. Also are you sure that I need to rearrange this code? Can't I just incorporate this code somewhere?

  8. define: would this negatively affect my Swish-e search results? all you are doing is changing how the results are displayed on the page. what negative effect are you worried about? btw - this page is getting and displaying data, your search form should use method='get' as this will allow you to easily propagate the search term with the pagination links.

     

     

    modifying the code to include pagination will pretty much require a rethinking of your current code layout. what you have now is a html document that has php logic pasted into it to produce the overall document.

     

    what you need is a separation of the 'business logic' (determines what to do on the page and gets the data the page needs) from the 'presentation logic' (deals only with the production of the html/css/javascript output.)

     

    the reason for needing to rearrange the logic is the pagination code needs things like the $totalItems (this is your $result->hits value) and your swish code needs to use the $offset/$limit to accomplish the pagination. i also see that your .csv file code is inside your main data retrieval while(){} loop, running every time the loop runs. this code should run only once to produce the $companies array, i.e. it's part of the 'business logic'.

     

    edit: i also see that you have duplicated the wvb-logo-slogen.png image tag. you should not duplicate code/markup and reorganizing the logic on the page will help you see duplication since it cleans up the whole layout of the code.

    Here in lies my problem with changing the layout of the code:

     

    I have never used php coding before to do a project like this. This project was assigned to me for work and I have mostly been getting help from people who do know php. I e-mailed this one particular individual to see if he would be willing to do it for me and if so would he charge me because to be quite honest with you I am not sure I am going to have this completed by the June 20th date. 

     

    Would it be wrong of me to send you the complete details of what I am trying to accomplish as well as ask if either you or someone you know whom you could recommend would be willing to do it for me?

     

    I am in way over my head here. I have never done anything like this before and I am getting desperate to get this project completed because I don't want to get in trouble for not having this completed on time.

  9. i would also add that i suggested two different methods, you would need to pick one.

     

    you would use the first method if the underlying data is dynamic and could change during the visit to your site by any person, so that the changes would show up in the data. this method uses more resources since the swish query will be executed on every page load, not just when the search term gets changed.

     

    the second method would use less server resources, but the data would be static for the duration of one search/the visit to your site since the data from one single swish query/search would be stored in a session variable.

    The user would not be allowed to change the PDF files. However PDF files would be constantly uploaded to the site. I have 5000 PDF files indexed at the moment.

  10. swish has a ->seekResult() method - http://www.php.net/manual/en/swishresults.seekresult.php that would allow you to seek to the starting point in the swish result set. this would use the $offset value from the pagination code. you would then loop, up to the $limit times, calling the ->nextResult() method to get up to $limit rows from the result.

     

    you could also just initially store all the swish results in an array, in a session variable, and use array_slice() to paginate the array. the $offset and $limit from the pagination code would be the offset and length parameters in the array_slice() statement.

    How would I do that though? Would that code be at the very beginning before my search results or after?

  11. swish has a ->seekResult() method - http://www.php.net/manual/en/swishresults.seekresult.php that would allow you to seek to the starting point in the swish result set. this would use the $offset value from the pagination code. you would then loop, up to the $limit times, calling the ->nextResult() method to get up to $limit rows from the result.

     

    you could also just initially store all the swish results in an array, in a session variable, and use array_slice() to paginate the array. the $offset and $limit from the pagination code would be the offset and length parameters in the array_slice() statement.

    Okay. I will try doing that but my question is would this negatively affect my Swish-e search results?

  12. Hi Everyone,

     

    I have a question about pagination. I have this code that I would like to incorporate into my php file.

     

    This is said code that will be incorporated:

     

     

     
    try {
    
        // Find out how many items are in the table
        $totalItems = $databaseHandle->query('
            select
                count(*)
            from
                tableName
        ')->fetchColumn();
    
        // Set how many items per page to display
        $limit = 10;
    
        // find how many pages are needed
        $totalPages = ceil($totalItems / $limit);
    
        // Find out which page we are on
        $currentPage = min($totalPages, filter_input(INPUT_GET, 'page', FILTER_VALIDATE_INT, array(
            'options' => array(
                'default'   => 1,
                'min_range' => 1,
            ),
        )));
    
        // Calculate the offset for the query
        $offset = ($page - 1)  * $limit;
    
        // Some information to display to the user
        $start = $offset + 1;
        $end = min(($offset + $limit), $total);
    
        // "back" link
        $prevlink = ($page > 1) ? '<a href="?page=1" title="First page">«</a> <a href="?page=' . ($currentPage - 1) . '" title="Previous page">‹</a>' : '<span class="disabled">«</span> <span class="disabled">‹</span>';
    
        // "forward" link
        $nextlink = ($page < $pages) ? '<a href="?page=' . ($page + 1) . '" title="Next page">›</a> <a href="?page=' . $totalPages . '" title="Last page">»</a>' : '<span class="disabled">›</span> <span class="disabled">»</span>';
    
        // Display the paging information
        echo '<div id="paging"><p>', $prevlink, ' Page ', $currentPage, ' of ', $totalPages, ' pages, displaying ', $start, '-', $end, ' of ', $totalItems, ' results ', $nextlink, ' </p></div>';
    
        // Get the results. Paged query
        $stmt = $databaseHandle->prepare('
            select
                *
            from
                tableName
            order by
                name
            limit
                :limit
            offset
                :offset
        ');
    
        // Bind the query params
        $stmt->bindParam(':limit', $limit, PDO:: PARAM_INT);
        $stmt->bindParam(':offset', $offset, PDO:: PARAM_INT);
        $stmt->execute();
    
        // Results?
        if ($stmt->rowCount() > 0) {
            $stmt->setFetchMode(PDO::FETCH_ASSOC);
            $iterator = new IteratorIterator($stmt);
    
            // Display the results
            foreach ($iterator as $row) {
                echo '<p>', $row['name'], '</p>';
            }
    
        } else {
            echo '<p>No results could be displayed.</p>';
        }
    
    } catch (Exception $e) {
        echo '<p>', $e->getMessage(), '</p>';
    }

     

    and this is what is in my php file:

     

     

    <html>
      <head></head>
      <body>
      <?php if (!isset($_POST['q'])) { ?>
    
    
    <img src="/wvb-logo-slogen.png" border="0" />
        <h2>Search</h2>
        <form method="post" action="<?php echo htmlentities($_SERVER['PHP_SELF']); ?>">
          <input type="text" name="q" size="30" />
        </form>
    
      <?php } else { ?>
    
    <img src="/wvb-logo-slogen.png" border="0" />
        <h2>Search Results</h2>
    
      <?php
        try {
          // create object
         // $swish = new Swish('/usr/local/apache/htdocs/swish/index.swish-e');
            $swish = new Swish('/var/www/html/pdf2/index.swish-e');
    
    
          // get and run query from command-line
          $queryStr = htmlentities($_POST['q']);
          $result = $swish->query($queryStr);
      ?>
    
       Found <?php echo $result->hits; ?> match(es) for '<?php echo $queryStr; ?>'.
    
      <?php
          // iterate over result set
          // print details for each match
          while($r = $result->nextResult()) {
       ?>
    
      <p>
        <?php echo $r->swishreccount; ?>
          <strong>
          <a href="<?php echo '/pdf2', ltrim($r->swishdocpath, '.') ;  ?>">
             <?php echo $r->swishdocpath; ?>
          </a>
       </strong> (score: <?php echo $r->swishrank; ?>) <br/>
    <?php echo $r->swishdocpath; ?><br />
    <?php
    
    $file = '/var/www/html/active_colist.csv';
    $fh = fopen($file, 'r');
    $companies = array();
    $row = fgetcsv($fh, 1024); // ignore header
    while ($row = fgetcsv($fh, 1024)) {
        $companies[$row[0]] = array('company' => $row[1], 'country' => $row[3]); //changed line
       }
    fclose($fh);
    
    
    //Split a filename  by .
    $filenames = explode(".", $r->swishdocpath);
    //get 3 chars from $filenames to $country
    $wvb_number = substr($filenames[1],1,12);
    $country = substr($filenames[1],1,3);
    echo 'Country: '.$companies[$wvb_number]['country']."<br />";
    //echo 'Country Name: '.$country."<br />";
    //$filenames[2] = explode(".", $r->swishdocpath);
    $year = substr($filenames[2],0,4);
    echo 'Year: '.$year."<br />";
    //$filenames = explode(".", $r->swishdocpath);
    //$wvb_number = substr($filenames[1],1,12);
    echo 'WVB Number: '.$wvb_number."<br />";
    echo 'Company Name: '.$companies[$wvb_number]['company'];
    //echo 'Country: '.$companies[$wvb_number]['country'];
    
    ?>
    
    
      </p>
    
      <?php
          }
        } catch (Exception $e) {
          die('ERROR: ' . $e->getMessage());
        }
      }
      ?>
    
      </body>
    </html>
     
    

     

    My question is what would be the best way incorporate this into my php file so that I am able to display a limit number link by page so that not all of the results are listed on the same page? If that is even possible.

     

  13.  

    Cut and paste

     

    EDIT: Here's the spoonfeeding answer

    //Split a filename  by .
    $filenames = explode(".", $r->swishdocpath);
    //get 3 chars from $filenames to $country                    <-----------+
    $country = substr($filenames[1],1,3);                                    |
    echo 'Country: '.$companies[$wvb_number]['country']."<br />";            |
    //echo 'Country Name: '.$country."<br />";                               |
    //$filenames[2] = explode(".", $r->swishdocpath);                        |
    $year = substr($filenames[2],0,4);                                       |
    echo 'Year: '.$year."<br />";                                            |
    //$filenames = explode(".", $r->swishdocpath);                           |
    $wvb_number = substr($filenames[1],1,12);          //------- MOVE ME ----+
    echo 'WVB Number: '.$wvb_number."<br />";
    echo 'Company Name: '.$companies[$wvb_number]['company'];
    

    I did just that a few minutes ago. Thanks again.

  14. $file = '/var/www/html/active_colist.csv';
    $fh = fopen($file, 'r');
    $companies = array();
    $row = fgetcsv($fh, 1024); // ignore header
    while ($row = fgetcsv($fh, 1024)) {
        $companies[$row[0]] = array('company' => $row[1], 'country' => $row[3]);    // CHANGED LINE
    }
    fclose($fh);
    

    Then, to display the company it will now be

    echo 'Company: ' . $companies[$wvbnumber]['company];

    and for the country

    echo 'Country: ' . $companies[$wvbnumber]['country'];

    All right. I made those changes but now it is skipping a line for some reason.

     

    Let me show you what I mean. When I took a look at my results I saw that the country code had skipped a line over.

     

    When I did the following:

     

    [root@zeus html]# grep IDN000030159 active_colist.csv
    "IDN000030159","FAJAR SURYA WISESA","IDN","Republic of Indonesia"
    

     

    I saw the above result. However if you take a look at my search results for this particular item, the line for that particular country is being skipped and as you can see Republic of Indonesia is supposed to correspond with ./IDN000030159.2013.A.00.E.12.31.PDF:

     

    2 ./IDN000030159.2013.A.00.E.12.31.PDF (score: 1000)

    ./IDN000030159.2013.A.00.E.12.31.PDF

    Country:

    Year: 2013

    WVB Number: IDN000030159

    Company Name: FAJAR SURYA WISESA

    3 ./ZWE000030003.2013.A.00.E.02.28.PDF (score: 1000)

    ./ZWE000030003.2013.A.00.E.02.28.PDF

    Country: Republic of Indonesia

    Year: 2013

    WVB Number: ZWE000030003

    Company Name: ECONET WIRELESS ZIMBABWE

    Is there a way to correct this so that the .csv file is being read correctly with the proper code:

     

     

    <?php
    
    $file = '/var/www/html/active_colist.csv';
    $fh = fopen($file, 'r');
    $companies = array();
    $row = fgetcsv($fh, 1024); // ignore header
    while ($row = fgetcsv($fh, 1024)) {
        $companies[$row[0]] = array('company' => $row[1], 'country' => $row[3]); //changed line
       }
    fclose($fh);
    
    //Split a filename  by .
    $filenames = explode(".", $r->swishdocpath);
    //get 3 chars from $filenames to $country
    $country = substr($filenames[1],1,3);
    echo 'Country: '.$companies[$wvb_number]['country']."<br />";
    //echo 'Country Name: '.$country."<br />";
    //$filenames[2] = explode(".", $r->swishdocpath);
    $year = substr($filenames[2],0,4);
    echo 'Year: '.$year."<br />";
    //$filenames = explode(".", $r->swishdocpath);
    $wvb_number = substr($filenames[1],1,12);
    echo 'WVB Number: '.$wvb_number."<br />";
    echo 'Company Name: '.$companies[$wvb_number]['company'];
    //echo 'Country: '.$companies[$wvb_number]['country'];
    ?>
    
     
  15.  

    You could store the csv data in an array
    $file = '/var/www/html/active_colist.csv';
    $fh = fopen($file, 'r');
    $companies = array();
    $row = fgetcsv($fh, 1024); // ignore header
    while ($row = fgetcsv($fh, 1024)) {
    $companies[$row[0]] = $row[1];
    }
    fclose($fh);
    then, when you have the $wvb_number
    echo $companies[$wvb_number];
     
    Okay I just put in a new .csv file. I haven't made changes to my code yet because I am afraid I might mess something up. Now my question is how would I go about changing the code so that the full country name is displayed?
     
    This is what is inside the new .csv file:
    

     

    "AIA000030001","THE NATIONAL BANK OF ANGUILLA","AIA","Anguilla"
    "AIA000030003","ANGUILLA ELECTRICITY COMPANY","AIA","Anguilla"
    "AIA000030005","KMT-HANSA","AIA","Anguilla"
    "ALB000040001","BURSE E TIRANES","ALB","Albania"
    "ANT000020000","RORENTO","ANT","Netherlands Antilles"
    "ANT000030001","INTRUM JUSTITIA","SWE","Kingdom of Sweden"

     

    This is what the code currently looks like:

    <?php
    
    $file = '/var/www/html/active_colist.csv';
    $fh = fopen($file, 'r');
    $companies = array();
    $row = fgetcsv($fh, 1024); // ignore header
    while ($row = fgetcsv($fh, 1024)) {
        $companies[$row[0]] = $row[1];
    }
    fclose($fh);
    
    
    //Split a filename  by .
    $filenames = explode(".", $r->swishdocpath);
    //get 3 chars from $filenames to $country
    $country = substr($filenames[1],1,3);
    echo 'Country Name: '.$country."<br />";
    //$filenames[2] = explode(".", $r->swishdocpath);
    $year = substr($filenames[2],0,4);
    echo 'Year: '.$year."<br />";
    //$filenames = explode(".", $r->swishdocpath);
    $wvb_number = substr($filenames[1],1,12);
    echo 'WVB Number: '.$wvb_number."<br />";
    echo 'Company Name: '.$companies[$wvb_number];
    
    
    ?>

    This is what the current output looks like:

     

    3 ./ZWE000030003.2013.A.00.E.02.28.PDF (score: 1000)
    ./ZWE000030003.2013.A.00.E.02.28.PDF
    Country Name: ZWE
    Year: 2013
    WVB Number: ZWE000030003
    Company Name: ECONET WIRELESS ZIMBABWE

    4 ./POL000040092.2013.A.00.E.12.31.PDF (score: 945)
    ./POL000040092.2013.A.00.E.12.31.PDF
    Country Name: POL
    Year: 2013
    WVB Number: POL000040092
    Company Name: ASSECOSEE

  16. echo 'WVB Number: '.$wvbnumber."<br />";

    echo 'Company Name: ' . $companies[$wvb_number];

                                         add ^                      change^                                                                     

     

    Also check the $companies array was created OK

    echo "<pre>", print_r($companies, 1) . "</pre>";

    If it's empty it could be an error in the file path.

    I did just that and it worked. Thank you. If I have any other questions can I message you privately?

  17. Storing the csv data would be done only once so that can go anywhere before you need the data.

     

    Echoing the company name would go, well, where you want to echo the company name.

    Here is what I did and my output disappeared on me upon hitting refresh: 

     

     

    <?php
    $file = '/var/www/html/active_colist.csv'; //Suggested code
    $fh = fopen($file, 'r');
    $companies = array();
    $row = fgetcsv($fh, 1024); // ignore header
    while ($row = fgetcsv($fh, 1024)) {
        $companies[$row[0]] = $row[1];
    }
    fclose($fh);
    ?>
    
      <?php
          // iterate over result set
          // print details for each match
          while($r = $result->nextResult()) {
       ?>
    
      <p>
        <?php echo $r->swishreccount; ?>
          <strong>
          <a href="<?php echo '/pdf2', ltrim($r->swishdocpath, '.') ;  ?>">
             <?php echo $r->swishdocpath; ?>
          </a>
       </strong> (score: <?php echo $r->swishrank; ?>) <br/>
    <?php echo $r->swishdocpath; ?><br />
    <?php
    //Split a filename  by .
    $filenames = explode(".", $r->swishdocpath);
    //get 3 chars from $filenames to $country
    $country = substr($filenames[1],1,3);
    echo 'Country Name: '.$country."<br />";
    //$filenames[2] = explode(".", $r->swishdocpath);
    $year = substr($filenames[2],0,4);
    echo 'Year: '.$year."<br />";
    //$filenames = explode(".", $r->swishdocpath);
    $wvbnumber = substr($filenames[1],1,12);
    echo 'WVB Number: '.$wvbnumber."<br />";
    echo 'Company Name: '$companies[$wvb_number]; //what is supposed to be outputted to the screen
     
     
    

     

    My question is where did I go wrong?

  18.  

    You could store the csv data in an array

    $file = '/var/www/html/active_colist.csv';
    $fh = fopen($file, 'r');
    $companies = array();
    $row = fgetcsv($fh, 1024); // ignore header
    while ($row = fgetcsv($fh, 1024)) {
        $companies[$row[0]] = $row[1];
    }
    fclose($fh);
    

    then, when you have the $wvb_number

    echo $companies[$wvb_number];

    Okay so where in my code would I put these lines of code? Do I incorporate this into what is being searched? If so, how? Keep in mind that I have never used php before so this is my first time.

     

    After this?:

    //$filenames = explode(".", $r->swishdocpath);
    $wvbnumber = substr($filenames[1],1,12);
    echo 'WVB Number: '.$wvbnumber;
    ?>
  19. I would like assistance in displaying a company name in my web search results.

     

    Below is my code:

    <html>
    
      <head></head>
    
      <body>
    
      <?php if (!isset($_POST['q'])) { ?>
    
    
    
    
    
    <img src="/wvb-logo-slogen.png" border="0" />
    
        <h2>Search</h2>
    
        <form method="post" action="<?php echo htmlentities($_SERVER['PHP_SELF']); ?>">
    
          <input type="text" name="q" size="30" />
    
        </form>
    
    
    
      <?php } else { ?>
    
    
    
    <img src="/wvb-logo-slogen.png" border="0" />
    
        <h2>Search Results</h2>
    
    
    
      <?php
    
        try {
    
          // create object
    
         // $swish = new Swish('/usr/local/apache/htdocs/swish/index.swish-e');
    
            $swish = new Swish('/var/www/html/pdf2/index.swish-e');
    
    
    
    
    
          // get and run query from command-line
    
          $queryStr = htmlentities($_POST['q']);
    
          $result = $swish->query($queryStr);
    
      ?>
    
    
    
       Found <?php echo $result->hits; ?> match(es) for '<?php echo $queryStr; ?>'.
    
    
    
      <?php
    
          // iterate over result set
    
          // print details for each match
    
          while($r = $result->nextResult()) {
    
       ?>
    
    
    
      <p>
    
        <?php echo $r->swishreccount; ?>
    
          <strong>
    
          <a href="<?php echo '/pdf2', ltrim($r->swishdocpath, '.') ;  ?>">
    
             <?php echo $r->swishdocpath; ?>
    
          </a>
    
       </strong> (score: <?php echo $r->swishrank; ?>) <br/>
    
    <?php echo $r->swishdocpath; ?><br />
    
    <?php
    
    //Split a filename  by .
    
    $filenames = explode(".", $r->swishdocpath);
    
    //get 3 chars from $filenames to $country
    
    $country = substr($filenames[1],1,3);
    
    echo 'Country name: '.$country."<br />";
    
    //$filenames[2] = explode(".", $r->swishdocpath);
    
    $year = substr($filenames[2],0,4);
    
    echo 'Year: '.$year;
    
    //$filenames = explode(".", $r->swishdocpath);
    
    $wvbnumber = substr($filenames[1],1,12);
    
    echo 'WVB Number: '.$wvbnumber;
    
    
    
    ?>
    
    
    
      </p>
    
    
    
     <?php
    
          }
    
        } catch (Exception $e) {
    
          die('ERROR: ' . $e->getMessage());
    
        }
    
      }
    
      ?>
    
    
    
      </body>
    
    </html>
    
     
    

    As you can see I am able now display the WVB number, country name and year. But my question to anyone is how would I display the company name that it corresponds to?

    The names of the company are located in a .csv file called active_colist.csv and it is under the /var/www/html directory.

    This is what my /var/www/html directory looks like:

    [root@zeus wvbadmin]# cd /var/www/html
    [root@zeus html]# ls -l
    total 2140
    -rw-r--r--. 1 root root 2110323 May 14 23:39 active_colist.csv
    -rw-r--r--. 1 root root    6678 Apr 30 13:25 favicon.ico
    -rw-r--r--. 1 root root   17256 May  5 16:02 h1
    -rw-r--r--. 1 root root     113 Apr 29 16:45 hello.php
    -rw-r--r--. 1 root root      19 Apr 24 23:53 info.php
    drwxr-xr-x. 2 root root   12288 May 12 15:30 pdf2
    lrwxrwxrwx. 1 root root      20 May  5 15:46 pdf3 -> /home/wvbadmin/pdf3/
    -rw-r--r--. 1 root root    1227 May  6 16:33 pdfsearch2.php
    -rw-r--r--. 1 root root    1204 May  6 15:13 pdfsearch3.php
    -rw-r--r--. 1 root root    1625 May 19 23:27 pdfsearch.php
    -rw-r--r--. 1 root root    1838 Apr 30 13:10 search.php
    -rw-r--r--. 1 root root   10077 May 12 11:38 wvb-logo-slogen.png


    What is in the .csv file is the first 12 characters that correspond to the company name. What PHP code would I use to grab the first 12 characters of search results match them up with what is in the .csv file and display the proper company name?

    This is what is inside of the .csv file:

    WVB_NUMBER,PRIMARY_SHORT_COMPANY_NAME,CURR_ISO_CNTRY_OF_INCORP
    "AIA000030001","THE NATIONAL BANK OF ANGUILLA","AIA"
    "AIA000030003","ANGUILLA ELECTRICITY COMPANY","AIA"
    "AIA000030005","KMT-HANSA","AIA"
    "ALB000040001","BURSE E TIRANES","ALB"
    "ANT000020000","RORENTO","ANT"
    "ANT000030001","INTRUM JUSTITIA","SWE"
    "ANT000030002","ORTHOFIX INTERNATIONAL","ANT"
    "ANT000030004","HAL TRUST","ANT"
    "ARE000030001","MASHREQBANK","ARE"
    "ARE000030002","COMMERCIAL BANK OF DUBAI","ARE"

     

    Any assistance would be greatly appreciated.

  20. Hi, 

     

    Not to familiar with Swish, but research I have done found two prospects:

    • SwishSearch::resetLimit — Reset the search limits
    • SwishSearch::setLimit — Set the search limits

    Reference: http://www.php.net/manual/en/book.swish.php

     

    Hope this helps.

    One more thing that I would like to mention to you is that I would like to have the names of the companies displayed the names of the actually companies are in a a .csv file located under the same directory that I am running my php search script from.

     

    What would I have to put in my PHP search script so that when it runs that it would check the first 12 characters of the PDF title that are in the /var/www/html/pdf2 directory to the /var/www/html/active_colist.csv directory? The .csv file has the first 12 characters of the PDF titles as well as teh corresponding companies. 

  21. Hi, 

     

    Not to familiar with Swish, but research I have done found two prospects:

    • SwishSearch::resetLimit — Reset the search limits
    • SwishSearch::setLimit — Set the search limits

    Reference: http://www.php.net/manual/en/book.swish.php

     

    Hope this helps.

    Thank you for the information. Actually I am looking to do something a little bit more specific. Allow me to further elaborate.

     

    What I want to show up on my search results page is for there to be a drop down menu with the values to be 10 20 or 50 for example and if a user wants to just display 10 results per page than 10 results per page would only be displayed. What I am asking is there a correct way using PHP code to accomplish this task? What would that code even look like and does it even exist? As well as the other questions that I asked above.

     

    But that is not to say that I am not going to look into the links you gave me because I will.

     

    Do you know anyone familiar with Swish-e who would be able to assist me?

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.