eldur / jwbf

Java Wiki Bot Framework is a library to maintain Wikis like Wikipedia based on MediaWiki.
http://jwbf.sourceforge.net/
Apache License 2.0
78 stars 33 forks source link

make multiple API calls easier to combine #21

Open fhocutt opened 10 years ago

fhocutt commented 10 years ago

Make efficient usage of API calls easier, possibly by creating a method that combines calls for multiple items (e.g. title1|title2|title3|...).

eldur commented 10 years ago

I assume you check the code and found an inefficient section, can you give me a hint like a class or method ? ;-)

fhocutt commented 10 years ago

It's not that there's a particularly inefficient section; it's that I didn't find anything besides createNsString, SiteInfo, and generateRequest (from LogEvents.java) that joined items with | as would be needed to create an API request that would get information on multiple pages at the same time. So instead of one call with titles=title1 and a second with titles=title2, a method that combined API calls like this would allow the same data to be fetched in one call with titles=title1|title2.

minhlab commented 10 years ago

There should be something like:

public synchronized Article[] getArticles(final String names[], final int properties) public synchronized SimpleArticle[] readData(final String names[], final int properties)

Combining calls is not just about efficiency but also a recommendation from MediaWiki (e.g. in this page: https://www.mediawiki.org/wiki/API:Query, among other places) to reduce the burden on the server side.

eldur commented 10 years ago

Okay it is about, reading content from more than one title.

I'll write short draft, so we have a better view, about the target of this task.

eldur commented 10 years ago

see tests at https://github.com/eldur/jwbf/commit/5b734863e9d95b58fb4e84db4828afb33788fa21#diff-8d34f9cd9768c1d746661072a842189fR232

eldur commented 9 years ago

I tend to close this issue because no we have

ImmutableList<SimpleArticle> articles = bot.readData("ArticleNameA", "ArticleNameB", ...