[ Index ]
 

Code source de SPIP Agora 1.4

Accédez au Source d'autres logiciels libresSoutenez Angelica Josefina !

title

Body

[fermer]

/Agora1-4/ecrire/include/sevenseas/SearchEngine/ -> indexserver.php (source)

   1  <?php
   2  /*****************************************************
   3  * This file is part of Agora, web based content management system.
   4  *
   5  * Agora is free software; you can redistribute it and/or modify
   6  * it under the terms of the GNU General Public License as published by
   7  * the Free Software Foundation; version 2 of the License.
   8  *
   9  * Agora is distributed in the hope that it will be useful,
  10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  12  * GNU General Public License for more details (file "COPYING").
  13  *
  14  * Copyright © Arnaud Martin, Antoine Pitrou et Philippe Rivière.
  15  * List of authors detailed in "copyright_fr.html" file.
  16  * E-mail : agora@sig.premier-ministre.gouv.fr
  17  * Web site : http://www.agora.gouv.fr
  18  *****************************************************/
  19  // Implementation class for Microsoft IndexServer.
  20  //
  21  
  22  require_once ("SearchEngine.php");
  23  
  24  require_once ("tools.inc.php");
  25  require_once ("conf/indexserver.inc.php");
  26  
  27  /**
  28   * Implementation class for Microsoft IndexServer.
  29   * This implementation posts a search query
  30   * to a .idq file served by Microst IIS server coupled
  31   * with Index Server.
  32   * Before calling search method, in any script, include
  33   * the configuration script defining the needed constants
  34   * to interface IndexServer. (Temporary solution).
  35   */
  36  class SearchEngine_IndexServer extends SearchEngine {
  37  
  38      // {{{ constructor
  39  
  40      /**
  41       * Constructor for this implementation, used by the SearchEngine factory method
  42       * @access  private
  43       */
  44  	function SearchEngine_IndexServer () {
  45          $par = get_parent_class($this);
  46          $res = $this->$par();
  47  
  48          if (PEAR::isError($res)) {
  49              die ($res->getMessage());
  50          }
  51      }
  52  
  53      // }}}
  54  
  55      // {{{ _computeQuery()
  56  
  57      /**
  58       * Implementation for Index Server
  59       *
  60       * @param   Array       query parameters
  61       * @return  String      XML result stream validating the indexresults.xsd XML Schema
  62       * @access  private
  63       */
  64      function &_computeQuery ($queryParameters) {
  65          $queryToPost = $this->_computePostFields($queryParameters);
  66          $xmlStream = &sendToHostNoHeader(IIS_ADDRESS, IIS_PORT, "POST", IDX_SRVR_IDQ, $queryToPost);
  67          return $xmlStream;
  68      }
  69  
  70      // }}}
  71  
  72      // {{{ _computePostFields()
  73  
  74      /**
  75       * This method computes the data to post given the query parameters
  76       * @param   Array   $queryParameters containing the query parameters
  77       * @return  String  representing the data ready to be posted as is
  78       * @access  private
  79       */
  80  	function _computePostFields ($queryParameters) {
  81          $textQuery = $this->_prepareTextQuery($queryParameters["textquery"]);
  82  
  83          if (isset($queryParameters["maxresults"])) {
  84              $resultLimit = "&CiLimits=" . urlencode($queryParameters["maxresults"]);
  85          }
  86          else {
  87              $resultLimit = "&CiLimits=100";
  88          }
  89  
  90          $dataToPost = "MyRestriction=" . urlencode($textQuery);
  91          $dataToPost .= $resultLimit;
  92          return $dataToPost;
  93      }
  94  
  95      // }}}
  96  
  97      // {{{ _prepareTextQuery()
  98  
  99      /**
 100       * This methods prepare a text query so that it is represented as IndexServer
 101       * uses it.
 102       * @param   String  $query Query that needs to be modified
 103       * @return  String  modified query
 104       * @access  private
 105       */
 106  	function _prepareTextQuery ($query) {
 107          // A implementer !
 108          return $query;
 109      }
 110  
 111  // }}}
 112  
 113  }
 114  ?>


Généré le : Sat Feb 24 14:40:03 2007 par Balluche grâce à PHPXref 0.7