$this->extractWikitextParts();
return $this->auxText;
}
+
+ /**
+ * Get the defaultsort property
+ * @return string|null
+ */
+ public function getDefaultSort() {
+ return $this->parserOutput->getProperty( 'defaultsort' );
+ }
}
$fields['file_text'] =
$engine->makeSearchFieldMapping( 'file_text', SearchIndexField::INDEX_TYPE_TEXT );
+ $fields['defaultsort'] = $engine->makeSearchFieldMapping( 'defaultsort',
+ SearchIndexField::INDEX_TYPE_TEXT );
+ $fields['defaultsort']->setFlag( SearchIndexField::FLAG_SOURCE_DATA );
+
return $fields;
}
$fields['opening_text'] = $structure->getOpeningText();
$fields['text'] = $structure->getMainText(); // overwrites one from ContentHandler
$fields['auxiliary_text'] = $structure->getAuxiliaryText();
+ $fields['defaultsort'] = $structure->getDefaultSort();
$title = $page->getTitle();
if ( NS_FILE == $title->getNamespace() ) {
* Do not index this field, just store it.
*/
const FLAG_NO_INDEX = 8;
+
+ /**
+ * Similar to FLAG_NO_INDEX but we inform the SearchEngine
+ * that this field should not be part of the search schema
+ * by default.
+ * SearchEngine implementations could then override its settings
+ * or simply use this data for other purposes.
+ */
+ const FLAG_SOURCE_DATA = 16;
+
/**
* Get mapping for specific search engine
* @param SearchEngine $engine
$this->assertContains( "Wikitext in Heading and also html", $headings );
}
+ public function testDefaultSort() {
+ $text = <<<END
+Louise Michel
+== Heading one ==
+Some text
+==== See also ====
+* Also things to see!
+{{DEFAULTSORT:Michel, Louise}}
+END;
+ $struct = $this->getStructure( $text );
+ $this->assertEquals( "Michel, Louise", $struct->getDefaultSort() );
+ }
+
public function testHeadingsFirst() {
$text = <<<END
== Heading one ==