@@ 163-201 (lines=39) @@ | ||
160 | } |
|
161 | ||
162 | $show_score = elgg_get_plugin_setting('show_score', 'elgg_solr'); |
|
163 | foreach ($search_results as $guid => $matches) { |
|
164 | foreach ($entities_unsorted as $e) { |
|
165 | if ($e->guid == $guid) { |
|
166 | ||
167 | $desc_suffix = ''; |
|
168 | if ($show_score == 'yes' && elgg_is_admin_logged_in()) { |
|
169 | $desc_suffix .= elgg_view('output/longtext', array( |
|
170 | 'value' => elgg_echo('elgg_solr:relevancy', array($matches['score'])), |
|
171 | 'class' => 'elgg-subtext' |
|
172 | )); |
|
173 | } |
|
174 | ||
175 | ||
176 | if ($matches['title']) { |
|
177 | $e->setVolatileData('search_matched_title', $matches['title']); |
|
178 | } |
|
179 | else { |
|
180 | $e->setVolatileData('search_matched_title', $e->title); |
|
181 | } |
|
182 | ||
183 | if ($matches['description']) { |
|
184 | $desc = $matches['description']; |
|
185 | } |
|
186 | else { |
|
187 | $desc = elgg_get_excerpt($e->description, 100); |
|
188 | } |
|
189 | ||
190 | ||
191 | unset($matches['title']); |
|
192 | unset($matches['description']); |
|
193 | unset($matches['score']); |
|
194 | $desc .= implode('...', $matches); |
|
195 | ||
196 | $e->setVolatileData('search_matched_description', $desc . $desc_suffix); |
|
197 | ||
198 | $entities[] = $e; |
|
199 | } |
|
200 | } |
|
201 | } |
|
202 | ||
203 | return array( |
|
204 | 'entities' => $entities, |
|
@@ 357-392 (lines=36) @@ | ||
354 | } |
|
355 | ||
356 | $show_score = elgg_get_plugin_setting('show_score', 'elgg_solr'); |
|
357 | foreach ($search_results as $guid => $matches) { |
|
358 | foreach ($entities_unsorted as $e) { |
|
359 | ||
360 | $desc_suffix = ''; |
|
361 | if ($show_score == 'yes' && elgg_is_admin_logged_in()) { |
|
362 | $desc_suffix .= elgg_view('output/longtext', array( |
|
363 | 'value' => elgg_echo('elgg_solr:relevancy', array($matches['score'])), |
|
364 | 'class' => 'elgg-subtext' |
|
365 | )); |
|
366 | } |
|
367 | ||
368 | if ($e->guid == $guid) { |
|
369 | if ($matches['title']) { |
|
370 | $e->setVolatileData('search_matched_title', $matches['title']); |
|
371 | } |
|
372 | else { |
|
373 | $e->setVolatileData('search_matched_title', $e->title); |
|
374 | } |
|
375 | ||
376 | if ($matches['description']) { |
|
377 | $desc = $matches['description']; |
|
378 | } |
|
379 | else { |
|
380 | $desc = elgg_get_excerpt($e->description, 100); |
|
381 | } |
|
382 | ||
383 | unset($matches['title']); |
|
384 | unset($matches['description']); |
|
385 | unset($matches['score']); |
|
386 | $desc .= implode('...', $matches); |
|
387 | ||
388 | $e->setVolatileData('search_matched_description', $desc . $desc_suffix); |
|
389 | $entities[] = $e; |
|
390 | } |
|
391 | } |
|
392 | } |
|
393 | ||
394 | return array( |
|
395 | 'entities' => $entities, |