Jump to content

ajidnair

New Members
  • Posts

    2
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

ajidnair's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Dear All, I have a search page configured to display 20 results per page using PHP 4 and MySql 4.1. My problem is that whenever after a search {POST}, i hit the back button i get a "Page : Expired Warning". I Want to get rid of this problem. When i use the following code, i m able to overcome this problem. header("Cache-Control: private"); ini_set('session.cache_limiter','private'); But then, my search results are cached and my search results are thrown from the cached pages. I would want a suggestion for eliminating this warning and the caching !! Please help ::: Thanks in Advance !!
  2. i have a searching script that is integrated with lucene but i am not able to sort by relevance.following is the code <html> <head><head> <body> <?php #java_set_library_path("/usr/lib/jre/lib/ext/lucene-1.4.3.jar:/usr/lib/jre/lib/ext/my.jar"); function microtime_float() {   list($usec, $sec) = explode(" ", microtime());   return ((float)$usec + (float)$sec); } $location="/var/www/html/test/index"; //$location = "/var/www/index/emp"; //$location = "/var/www/html/fieldsindex"; //$location = "/var/www/html/js/indexer/index"; $time_start = microtime(); $hits = new java("org.apache.lucene.search.Hits"); $indexreader = new java("org.apache.lucene.index.IndexReader"); //echo $indexreader; $reader_ref = $indexreader->open($location); $searcher = new java("org.apache.lucene.search.IndexSearcher",$reader_ref); $queryparser = new java("org.apache.lucene.queryParser.QueryParser"); $analyzer = new java("org.apache.lucene.custom.MyAnalyzer"); //$query = $queryparser->parse( 'gender:male','content',$analyzer); $query = $queryparser->parse('sequence:(java^4)','name',$analyzer); //$query = $queryparser->parse('salary:"0000" AND keywords:"php"','content',$analyzer); $sortfield = new java("java.lang.String","DocRef"); //$sortfield = new java("org.apache.lucene.search.SortField","sequence"); $sort = new java("org.apache.lucene.search.Sort",$sortfield); $system = new Java('java.lang.System'); $startTime = $system->currentTimeMillis(); $hits = $searcher->search($query,$sort); $endTime = $system->currentTimeMillis(); //$time_end = microtime(true); $start = 0; $max = 50; echo "hits".$hits->length(); echo "<br>"; if ($hits->length()!=0 ) { if (@$_GET['startat'] && @$_GET['maxresults']) { $start = $_GET['startat']; $max = $_GET['maxresults']; } $thispage = $max; if ($start+$max > $hits->length()) {         $thispage = $hits->length()-$start; } $document = new java('org.apache.lucene.document.Document'); for ($i=$start;$i<$thispage+$start;$i++) { $document = $hits->doc($i); $docref = $document->get("DocRef"); //$docid = $document->get("docref"); echo 'DocRef:'.$docref.'<br>'; } } $search_time = ($endTime - $startTime)/1000.0; $search_time = round($search_time,3); echo 'search response:'.$search_time.'secs<br>'; echo 'number of hits:'.$hits->length(); ?> <form> <table> <tr> <td> <a href="fieldssearch.php?startat=<?=$start+$max?>&maxresults=<?=$max?>">More</a> </td> </tr> </table> </form> </body> </html>
×
×
  • 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.