Chad has uploaded a new change for review.
https://gerrit.wikimedia.org/r/105227
Change subject: Index necessary data in CirrusSearch
......................................................................
Index necessary data in CirrusSearch
Change-Id: I018e2725cc7ddf038ccb34caf9ff26915e761910
---
M LiquidThreads.php
M classes/Hooks.php
2 files changed, 21 insertions(+), 2 deletions(-)
git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/LiquidThreads
refs/changes/27/105227/1
diff --git a/LiquidThreads.php b/LiquidThreads.php
index 58d3d45..39721d1 100644
--- a/LiquidThreads.php
+++ b/LiquidThreads.php
@@ -128,7 +128,8 @@
$wgHooks['ModifyExportQuery'][] = 'LqtHooks::modifyExportQuery';
$wgHooks['OAIFetchRowsQuery'][] = 'LqtHooks::modifyOAIQuery';
$wgHooks['OAIFetchRecordQuery'][] = 'LqtHooks::modifyOAIQuery';
-$wgHooks['CirrusSearchMappingConfig'] = 'LqtHooks::modifyElasticSchema';
+$wgHooks['CirrusSearchMappingConfig'] = 'LqtHooks::modifyCirrusSchema';
+$wgHooks['CirrusSearchBuildDocument'] = 'LqtHooks::modifyCirrusDocument';
// Import-related
$wgHooks['ImportHandlePageXMLTag'][] = 'LqtHooks::handlePageXMLTag';
diff --git a/classes/Hooks.php b/classes/Hooks.php
index 6798e0d..aa41b90 100644
--- a/classes/Hooks.php
+++ b/classes/Hooks.php
@@ -250,7 +250,7 @@
/**
* Add our fields to the CirrusSearch core schema
*/
- static function modifyElasticSchema( &$config, $builder ) {
+ static function modifyCirrusSchema( &$config, $builder ) {
$config['DiscussionThreadingInfo'] = array(
'dynamic' => false,
'properties' => array(
@@ -262,6 +262,24 @@
return true;
}
+ /**
+ * Add our fields to the CirrusSearch document
+ */
+ static function modifyCirrusDocument( $doc, $page, $flags ) {
+ $title = $page->getTitle();
+ if ( LqtDispatch::isLqtPage( $title ) ) {
+ $thread = Threads::withRoot( new Article( $title, 0 ) );
+ if ( $thread ) {
+ if ( $thread->hasSuperThread() &&
$thread->topmostThread()->title() ) {
+ $doc->add( 'ThreadAncestor',
$thread->topmostThread()->title()->getPrefixedText() );
+ }
+ $doc->add( 'ThreadPage',
$thread->getTitle()->getPrefixedText() );
+ $doc->add( 'ThreadSubject', $thread->subject()
);
+ }
+ }
+ return true;
+ }
+
static function customiseSearchResultTitle( &$title, &$text, $result,
$terms, $page ) {
if ( $title->getNamespace() != NS_LQT_THREAD ) {
return true;
--
To view, visit https://gerrit.wikimedia.org/r/105227
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I018e2725cc7ddf038ccb34caf9ff26915e761910
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/LiquidThreads
Gerrit-Branch: master
Gerrit-Owner: Chad <[email protected]>
_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits