Last modified: 2011-07-06 20:41:42 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T31746, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 29746 - API returns page title instead of sectiontitle when you request sectiontitle
API returns page title instead of sectiontitle when you request sectiontitle
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
API (Other open bugs)
1.17.x
All All
: Unprioritized normal (vote)
: ---
Assigned To: Roan Kattouw
http://en.wikipedia.org/w/api.php?act...
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-07-06 20:15 UTC by Derk-Jan Hartman
Modified: 2011-07-06 20:41 UTC (History)
4 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Derk-Jan Hartman 2011-07-06 20:15:47 UTC
Note that the title is repeated in sectiontitle.

<?xml version="1.0"?>
<api>
  <query>
    <searchinfo totalhits="3" />
    <search>
      <p ns="5" title="Wikipedia talk:WikiProject Spam/2011 Archive Jun 1" sectiontitle="Wikipedia talk:WikiProject Spam/2011 Archive Jun 1" />
      <p ns="5" title="Wikipedia talk:WikiProject Spam/2010 Archive Aug 3" sectiontitle="Wikipedia talk:WikiProject Spam/2010 Archive Aug 3" />
      <p ns="5" title="Wikipedia talk:WikiProject Spam/2010 Archive Jun 1" sectiontitle="Wikipedia talk:WikiProject Spam/2010 Archive Jun 1" />
    </search>
  </query>
</api>
Comment 1 Derk-Jan Hartman 2011-07-06 20:18:25 UTC
$vals['sectiontitle'] = $result->getSectionTitle();

getSectionTitle actually returns a Title object, not the name/anchor of the section itself.
Comment 2 Sam Reed (reedy) 2011-07-06 20:22:14 UTC
				if ( !is_null( $result->getSectionTitle() ) ) {
					if ( isset( $prop['sectiontitle'] ) ) {
						$vals['sectiontitle'] = $result->getSectionTitle();
					}
					if ( isset( $prop['sectionsnippet'] ) ) {
						$vals['sectionsnippet'] = $result->getSectionSnippet();
					}
				}



http://en.wikipedia.org/w/api.php?action=query&list=search&srsearch=WikiProject%20Spam%20zola%20enterprises&srwhat=text&srnamespace=5&srprop=sectiontitle|sectionsnippet

<?xml version="1.0"?>
<api>
  <query>
    <searchinfo totalhits="3" />
    <search>
      <p ns="5" title="Wikipedia talk:WikiProject Spam/2011 Archive Jun 1" sectiontitle="Wikipedia talk:WikiProject Spam/2011 Archive Jun 1" sectionsnippet="&lt;span class=&#039;searchmatch&#039;&gt;Zola&lt;/span&gt; &lt;span class=&#039;searchmatch&#039;&gt;Enterprises&lt;/span&gt; &lt;span class=&#039;searchmatch&#039;&gt;spam&lt;/span&gt; on Wikipedia 3" />
      <p ns="5" title="Wikipedia talk:WikiProject Spam/2010 Archive Aug 3" sectiontitle="Wikipedia talk:WikiProject Spam/2010 Archive Aug 3" sectionsnippet="&lt;span class=&#039;searchmatch&#039;&gt;Zola&lt;/span&gt; &lt;span class=&#039;searchmatch&#039;&gt;Enterprises&lt;/span&gt; &lt;span class=&#039;searchmatch&#039;&gt;spam&lt;/span&gt; on Wikipedia 2" />
      <p ns="5" title="Wikipedia talk:WikiProject Spam/2010 Archive Jun 1" sectiontitle="Wikipedia talk:WikiProject Spam/2010 Archive Jun 1" sectionsnippet="&lt;span class=&#039;searchmatch&#039;&gt;Zola&lt;/span&gt; &lt;span class=&#039;searchmatch&#039;&gt;Enterprises&lt;/span&gt; &lt;span class=&#039;searchmatch&#039;&gt;spam&lt;/span&gt; on Wikipedia" />
    </search>
  </query>
</api>
Comment 3 Derk-Jan Hartman 2011-07-06 20:41:42 UTC
Fixed in r91599

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links