r113905 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r113904‎ | r113905 | r113906 >
Date:10:56, 15 March 2012
Author:schuellersa
Status:fixme (Comments)
Tags:
Comment:
Language fix
Modified paths:
  • /trunk/extensions/SolrStore/templates/SolrSearchTemplate_FIS.php (modified) (history)

Diff [purge]

Index: trunk/extensions/SolrStore/templates/SolrSearchTemplate_FIS.php
@@ -1,4 +1,5 @@
22 <?php
 3+
34 /**
45 * Dynamic Template 'FIS' -> Example
56 *
@@ -6,9 +7,9 @@
78 * with : makeHighlightText and makeHighlightTitle functions
89 *
910 * to use this template add this peace of code to LocalSettings.php
10 - *
 11+ *
1112 * # define Template
12 - * $wgSolrTemplate = "_FIS";
 13+ * $wgSolrTemplate = "_FIS";
1314 *
1415 *
1516 * @ingroup SolrStore
@@ -28,6 +29,10 @@
2930 var $mHighlightText = null;
3031 var $mHighlightTitle = null;
3132 var $mWordCount = null;
 33+ var $category = null;
 34+ var $higherdept = null;
 35+ var $maindept = null;
 36+ var $methode = null;
3237
3338 public function applyTemplate( $xml ) {
3439 global $wgSolrFields;
@@ -38,7 +43,8 @@
3944
4045 // Bugfix: clear the var!
4146 unset( $this->Inhalt_de_t );
42 -
 47+ unset( $this->methode );
 48+ print_r( $xml );
4349 // get Size, Wordcound, Date, Inhalt_de_t from XML:
4450 foreach ( $xml->arr as $doc ) {
4551 switch ( $doc[ 'name' ] ) {
@@ -63,10 +69,36 @@
6470 case 'Zuletzt geändert_dt':
6571 $this->mDate = $doc->date;
6672 break;
67 -
 73+
6874 case 'Inhalt de_t':
6975 $this->Inhalt_de_t[ ] = $doc->str;
7076 break;
 77+
 78+ case 'Inhalt fr_t':
 79+ $this->Inhalt_de_t[ ] = $doc->str;
 80+ break;
 81+
 82+ case 'Inhalt en_t':
 83+ $this->Inhalt_de_t[ ] = $doc->str;
 84+ break;
 85+
 86+ case 'category':
 87+ $this->category = $doc->str;
 88+ break;
 89+
 90+ case 'Higher-Dept_s':
 91+ $this->higherdept = $doc->str;
 92+ break;
 93+
 94+ case 'Main-Dept_s':
 95+ $this->maindept = $doc->str;
 96+ break;
 97+
 98+ case 'Methode_t':
 99+ foreach ( $doc->str as $methoden ) {
 100+ $this->methode[ ] = $methoden;
 101+ }
 102+ break;
71103 }
72104 }
73105
@@ -133,6 +165,38 @@
134166 $this->makeHighlightText( $wgSolrFields, $textsnip ); // TEXTSNIP: Highlight the searching stuff:
135167 } else {
136168 $this->mHighlightText = "";
 169+ if ( $this->category == 'Institution' ) {
 170+ $tmpmaind = 0;
 171+ if ( $this->maindept != '' ) {
 172+ $this->mHighlightText = $this->maindept;
 173+ $tmpmaind = 1;
 174+ }
 175+ if ( $this->higherdept != '' ) {
 176+ if ( $tmpmaind == 1 ) {
 177+ $this->mHighlightText.="<br>";
 178+ }
 179+ $this->mHighlightText.= $this->higherdept;
 180+ }
 181+ $textsnip = $this->mHighlightText;
 182+ $this->makeHighlightText( $wgSolrFields, $textsnip ); // TEXTSNIP: Highlight the searching stuff:
 183+ }
 184+ if ( $this->category == 'Projekte' ) {
 185+ $tmpmethode = "";
 186+ if ( count( $this->methode ) > 0 ) {
 187+ for ( $i = 0; $i <= count( $this->methode ); $i++ ) {
 188+ if ( $i == 0 ) {
 189+ $tmpmethode = "Vorgehensweise: " . $this->methode[ $i ];
 190+ } else {
 191+ if ( $this->methode[ $i ] != "" ) {
 192+ $tmpmethode.=", " . $this->methode[ $i ];
 193+ }
 194+ }
 195+ }
 196+ }
 197+
 198+ $textsnip = $this->mHighlightText = $tmpmethode; // . "->" . count( $this->methode );
 199+ $this->makeHighlightText( $wgSolrFields, $textsnip ); // TEXTSNIP: Highlight the searching stuff:
 200+ }
137201 }
138202
139203 return $this;

Comments

#Comment by Nikerabbit (talk | contribs)   13:59, 15 March 2012

Adds debugging output. Why is part of the code in German?

#Comment by Schuellersa (talk | contribs)   15:02, 15 March 2012

because is needet in this case.

we can splitt the highlichtoutput by checking the category

(Institution or Project -> searchresoult)

#Comment by Schuellersa (talk | contribs)   15:04, 15 March 2012

line 48 + print_r( $xml );

DELETE only 4 debug

Status & tagging log