[ Index ]
 

Code source de LifeType 1.2.4

Accédez au Source d'autres logiciels libres

Classes | Fonctions | Variables | Constantes | Tables

title

Body

[fermer]

/class/dao/ -> searchresult.class.php (source)

   1  <?php
   2  
   3      
   4      
   5      define( "SEARCH_RESULT_ARTICLE", 1 );
   6      define( "SEARCH_RESULT_CUSTOM_FIELD", 2 );
   7      define( "SEARCH_RESULT_COMMENT", 3 );
   8      define( "SEARCH_RESULT_BLOG", 4 );
   9      define( "SEARCH_RESULT_GALLERYRESOURCE", 5 );
  10      
  11      /**
  12       * represents a result from a search query.
  13       *
  14       * Includes things like the relevance and a reference to the article object
  15       * that matched the query
  16       *
  17       * \ingroup DAO
  18       */
  19      class SearchResult 
  20      {
  21          
  22          var $_relevance;
  23          var $_result;
  24          var $_resultType;
  25          var $_searchTerms;
  26          
  27          /**
  28           * Constructor
  29           * 
  30           * @param result The DbObject that was returned by the search
  31           * @param type Whether the search result is coming from an article, comment or custom field
  32           * @param relevance The relevance factor         
  33           * @see getType()
  34           */
  35          function SearchResult( $result, $type, $searchTerms = "", $relevance = 0 )
  36          {                        
  37              $this->_relevance = $relevance;
  38              $this->_result    = $result;
  39              $this->_type      = $type;
  40          }
  41          
  42          /**
  43           * returns the Article object, if any
  44           *
  45           * @return an Article object
  46           */
  47          function getResult()
  48          {
  49              return $this->_result;
  50          }
  51          
  52          /**
  53           * Alias for getResult()
  54           * @see getResult
  55           */
  56          function getArticle()
  57          {
  58              return( $this->getResult());
  59          }        
  60          
  61          /**
  62           * returns the relevance of the result
  63           *
  64           * @return an integer specfying the relevance of the result
  65           */
  66          function getRelevance()
  67          {
  68              return $this->_relevance;
  69          }
  70          
  71          /**
  72           * returns the type of the result. 
  73           *
  74           * @return The returned result is one of the following values:
  75           * Possible values are:
  76           * - SEARCH_RESULT_ARTICLE
  77           * - SEARCH_RESULT_CUSTOM_FIELD
  78           * - SEARCH_RESULT_COMMENT
  79           */         
  80  		function getType()
  81          {
  82              return $this->_type;
  83          }
  84          
  85          /**
  86           * Returns the search terms that generated this result
  87           *
  88           * @return A string
  89           */
  90  		function getSearchTerms()
  91          {
  92              return( $this->_searchTerms );
  93          }
  94      }
  95  ?>


Généré le : Mon Nov 26 21:04:15 2007 par Balluche grâce à PHPXref 0.7
  Clicky Web Analytics