Overview

Packages

  • CONTENIDO
  • Core
    • Authentication
    • Backend
    • Cache
    • CEC
    • Chain
    • ContentType
    • Database
    • Debug
    • Exception
    • Frontend
      • Search
      • URI
      • Util
    • GenericDB
      • Model
    • GUI
      • HTML
    • I18N
    • LayoutHandler
    • Log
    • Security
    • Session
    • Util
    • Validation
    • Versioning
    • XML
  • Module
    • ContentRssCreator
    • ContentSitemapHtml
    • ContentSitemapXml
    • ContentUserForum
    • NavigationTop
    • ScriptCookieDirective
  • mpAutoloaderClassMap
  • None
  • Plugin
    • ContentAllocation
    • CronjobOverview
    • FormAssistant
    • FrontendLogic
    • FrontendUsers
    • Linkchecker
    • ModRewrite
    • Newsletter
    • Repository
      • FrontendNavigation
      • KeywordDensity
    • SearchSolr
    • SmartyWrapper
    • UrlShortener
    • UserForum
    • Workflow
  • PluginManager
  • Setup
    • Form
    • GUI
    • Helper
      • Environment
      • Filesystem
      • MySQL
      • PHP
    • UpgradeJob
  • Smarty
    • Cacher
    • Compiler
    • Config
    • Debug
    • PluginsBlock
    • PluginsFilter
    • PluginsFunction
    • PluginsInternal
    • PluginsModifier
    • PluginsModifierCompiler
    • PluginsShared
    • Security
    • Template
    • TemplateResources
  • Swift
    • ByteStream
    • CharacterStream
    • Encoder
    • Events
    • KeyCache
    • Mailer
    • Mime
    • Plugins
    • Transport

Classes

  • Swift_FailoverTransport
  • Swift_LoadBalancedTransport
  • Swift_MailTransport
  • Swift_Plugins_Loggers_ArrayLogger
  • Swift_Plugins_Loggers_EchoLogger
  • Swift_SendmailTransport
  • Swift_SmtpTransport
  • Swift_Transport_AbstractSmtpTransport
  • Swift_Transport_Esmtp_Auth_CramMd5Authenticator
  • Swift_Transport_Esmtp_Auth_LoginAuthenticator
  • Swift_Transport_Esmtp_Auth_PlainAuthenticator
  • Swift_Transport_Esmtp_AuthHandler
  • Swift_Transport_EsmtpTransport
  • Swift_Transport_FailoverTransport
  • Swift_Transport_LoadBalancedTransport
  • Swift_Transport_MailTransport
  • Swift_Transport_SendmailTransport
  • Swift_Transport_SimpleMailInvoker
  • Swift_Transport_StreamBuffer

Interfaces

  • Swift_Plugins_Logger
  • Swift_Plugins_Pop_Pop3Exception
  • Swift_Transport
  • Swift_Transport_Esmtp_Authenticator
  • Swift_Transport_EsmtpHandler
  • Swift_Transport_IoBuffer
  • Swift_Transport_MailInvoker
  • Swift_Transport_SmtpAgent
  • Swift_TransportException
  • Overview
  • Package
  • Function
  • Todo
  • Download
 1: <?php
 2: 
 3: /**
 4:  *
 5:  * @package Plugin
 6:  * @subpackage SearchSolr
 7:  * @version SVN Revision $Rev:$
 8:  * @author marcus.gnass
 9:  * @copyright four for business AG
10:  * @link http://www.4fb.de
11:  */
12: 
13: // assert CONTENIDO framework
14: defined('CON_FRAMEWORK') || die('Illegal call: Missing framework initialization - request aborted.');
15: 
16: /**
17:  * Simple Solr search implementation.
18:  *
19:  * This searcher is restricted on single core searches (due to the fact that
20:  * SolrQuery does not support multi core requests).
21:  *
22:  * @author marcus.gnass
23:  */
24: class SolrSearcherSimple extends SolrSearcherAbstract {
25: 
26:     /**
27:      *
28:      * @throws cException if search cannot be performed for empty search term
29:      * @return SolrObject
30:      */
31:     public function getSearchResults() {
32: 
33:         $searchTerm = $this->_searchTerm;
34:         $searchTerm = trim($searchTerm);
35:         $searchTerm = explode(' ', $searchTerm);
36:         $searchTerm = array_map('trim', $searchTerm);
37:         $searchTerm = array_filter($searchTerm);
38: 
39:         // there are no results if there is no search term
40:         if (empty($searchTerm)) {
41:             throw new cException('search cannot be performed for empty search term');
42:         }
43: 
44:         /* SolrQuery */
45:         $query = new SolrQuery();
46:         // set the search query
47:         $query->setQuery('content:*' . implode('* *', $searchTerm) . '*');
48:         // specify the number of rows to skip
49:         $query->setStart(($this->_page - 1) * $this->_itemsPerPage);
50:         // specify the maximum number of rows to return in the result
51:         $query->setRows($this->_itemsPerPage);
52:         // specify fields to return
53:         // $query->addField('content');
54:         // $query->addField('id_art_lang');
55: 
56:         /* SolrClient */
57:         $idclient = cRegistry::getClientId();
58:         $idlang = cRegistry::getLanguageId();
59:         $options = Solr::getClientOptions($idclient, $idlang);
60:         Solr::log(print_r($options, true));
61:         $solrClient = new SolrClient($options);
62:         // $solrClient->setServlet(SolrClient::SEARCH_SERVLET_TYPE,
63:         // $this->_servlet);
64: 
65:         $results = NULL;
66:         try {
67:             $solrQueryResponse = @$solrClient->query($query);
68:             $response = $solrQueryResponse->getResponse();
69:             $response = $response->response;
70:         } catch (SolrClientException $e) {
71:             Solr::log($e, $e->getFile(), $e->getLine());
72:             Solr::log($solrClient->getDebug());
73:             Solr::log($query->toString());
74:         }
75: 
76:         return $response;
77:     }
78: 
79: }
80: 
81: 
CMS CONTENIDO 4.9.7 API documentation generated by ApiGen