Changeset 1281

Show
Ignore:
Timestamp:
02/06/11 15:10:33 (2 years ago)
Author:
Torben Brodt
Message:

woltlab does not support an interface to get the target url from a search result, so i built a wrapper around it, searching for the first link within the h3 tag

Location:
solr
Files:
4 added
5 modified

Legend:

Unmodified
Added
Removed
  • solr/files/lib/page/SolrSearchPage.class.php

    r1268 r1281  
    5151                return $string; 
    5252        } 
    53  
    54         /** 
    55          * if the client is (or claims to be) connected via HTTPS 
    56          * @return boolean 
    57          */ 
    58         protected function isHTTPS() { 
    59                 return isset($_SERVER["HTTP_X_PROTO"]) || 
    60                         (isset($_SERVER['HTTPS']) && 
    61                                 !empty($_SERVER['HTTPS']) && 
    62                                 $_SERVER['HTTPS'] !== 'off'); 
    63         } 
    6453         
    6554        /** 
     
    117106                                $val = array_slice($val, 0, 20, true); 
    118107                        } 
     108                        /* 
     109                        if($key == 'type') { 
     110                                $tmp = $val; 
     111                                $val = array(); 
     112                                foreach($tmp as $key => $value) { 
     113                                        $key = WCF::getLanguage()->get("wcf.search.type.".$key); 
     114                                        $val[$key] = $value; 
     115                                } 
     116                        }*/ 
    119117                } 
    120118                $this->facets = array_filter($facets); 
     
    182180         */ 
    183181        public function assignVariables() { 
     182 
    184183                parent::assignVariables(); 
     184                 
     185                if($this->templateName == 'solrAtom') { 
     186                        require_once(WCF_DIR.'lib/util/SolrTemplateWrapperUtil.class.php'); 
     187                        $this->messages = SolrTemplateWrapperUtil::parse($this->messages); 
     188                } 
    185189                 
    186190                $additionalPagesParameters = array(); 
     
    190194 
    191195                WCF::getTPL()->assign(array( 
     196                        'messages' => $this->messages, 
    192197                        'facets' => $this->facets, 
    193198                        'additionalPagesParameterString' => $additionalPagesParameters ? '&'.http_build_query($additionalPagesParameters) : '', 
     
    196201                )); 
    197202         } 
     203         
     204        /** 
     205         * @see Page::show() 
     206         */ 
     207        public function show() { 
     208                 
     209                // overwrite template with atom format 
     210                if (isset($_REQUEST['format']) && $_REQUEST['format'] == 'atom') { 
     211                        $this->templateName = 'solrAtom'; 
     212                } 
     213                if (isset($_REQUEST['num'])) $this->itemsPerPage = intval($_REQUEST['num']); 
     214                 
     215                parent::show(); 
     216                 
     217                // overwrite template with atom format 
     218                if (isset($_REQUEST['format']) && $_REQUEST['format'] == 'atom') { 
     219                        header('Content-type: text/xml'); 
     220                } 
     221        } 
    198222} 
    199223?> 
  • solr/optionals/de.easy-coding.wcf.opensearch/templates/openSearch.tpl

    r1276 r1281  
    11<?xml version="1.0" encoding="{@CHARSET}"?> 
    22<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/"> 
    3         <ShortName>{@PAGE_TITLE}</ShortName> 
    4         <Description>{@PAGE_TITLE} {lang}wcf.search.title{/lang}</Description> 
     3        <ShortName><![CDATA[{lang}{@PAGE_TITLE}{/lang}]]></ShortName> 
     4        <Description><![CDATA[{lang}{@PAGE_TITLE}{/lang} {lang}wcf.search.title{/lang}]]></Description> 
    55        <Url type="text/html" template="{@PAGE_URL}/index.php?form=SolrSearch&amp;q={literal}{searchTerms}{/literal}"/> 
     6        <Url type="application/atom+xml" template="{@PAGE_URL}/index.php?form=SolrSearch&amp;format=atom&amp;q={literal}{searchTerms}{/literal}"/> 
     7<!--    <Url type="application/x-suggestions+json" template="{@PAGE_URL}/index.php?form=SolrSearchSuggestion&amp;q={literal}{searchTerms}{/literal}"/> --> 
    68</OpenSearchDescription> 
  • solr/package.xml

    r1272 r1281  
    66                <packagedescription>Solr powered search client. Solr backend needed!</packagedescription> 
    77                <packagedescription language="de">Das Paket integriert ein Solr Search Interface. Es wird ein zusÀtzlicher Solr Server benötigt.</packagedescription> 
    8                 <version>1.0.0 RC 3</version> 
     8                <version>1.0.0 RC 4</version> 
    99                <plugin>com.woltlab.wcf</plugin> 
    1010                <isunique>1</isunique> 
     
    4444                <languages languagecode="en">en.xml</languages> 
    4545        </instructions> 
    46          
    47         <instructions type="update" fromversion="1.0.0 RC 2"> 
     46 
     47        <instructions type="update" fromversion="1.0.0 RC 3"> 
    4848                <files>files.tar</files> 
    4949                <templates>templates.tar</templates> 
    50                 <acptemplates>acptemplates.tar</acptemplates> 
    51                 <sql>update.sql</sql> 
    5250                 
    5351                <!-- languages --> 
  • solr/templates/searchResultSolr.tpl

    r1190 r1281  
    1515                 
    1616                <div class="messageFooter"> 
    17                         <a href="{$item.message->url}" class="externalURL">{@$item.message->displayurl}</a> 
     17                        <a href="{$item.message->url}{@SID_ARG_2ND}" class="externalURL">{@$item.message->displayurl}</a> 
    1818                </div> 
    1919                <hr /> 
  • solr/templates/solr.tpl

    r1268 r1281  
    110110                                                                        <div class="containerHead">  
    111111                                                                                <h3>{lang}{$headline}{/lang}</h3>  
    112                                                                         </div>  
     112                                                                        </div> 
    113113                                                                          
    114114                                                                        <ul class="dataList">