MER-C/wiki-java

constructTitleString() should sort titles

Nirvanchik opened this issue · 2 comments

This is because they say here :

Also note that a request cannot be served from cache unless the URL is exactly the same. If you make a request for api.php?....titles=Foo|Bar|Hello, and cache the result, then a request for api.php?....titles=Hello|Bar|Hello|Foo will not go through the cache — even though MediaWiki returns the same data!

You should take care to normalize the URLs you send to the MediaWiki web service, so that slightly different user input won't cause you to waste time on unnecessary HTTP requests. You can normalize a list of page titles by removing duplicates and sorting the titles alphabetically. Similar techniques will work for other kinds of data.

"Removing duplicates" is a thing that customers of Wiki.java should take care about.
But you are not always going to sort titles when you call Wiki.exists() so it would be nice for Wiki.java to do that.

MER-C commented

I will be away for a week. This will need a breaking change to fix by the looks of it -- something I want to defer until I release a stable version.