New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Article history (revisions), search, etc. #18

Open
ghost opened this Issue Jul 7, 2014 · 4 comments

Comments

Projects
None yet
2 participants
@ghost

ghost commented Jul 7, 2014

Hi again!

As you library seems to be the only available library for Java (there are one or two apart, but those are not being updated more) when we talk about MediaWiki API (i.e., not through database dump), I did keep testing you library.

Are you thinking to introduce a way to work with the revisions?

Search for Wikitext in various pages? Seems that now they introduced the CirrusSearch and its able to do search with regular expressions (see http://www.mediawiki.org/wiki/Thread:Help_talk:CirrusSearch/Regular_expressions), but I don't known ifs available through the rest API.

Those features would be interesting for example, in the area of anti-vandalism.

@eldur eldur added the enhancement label Jul 8, 2014

@eldur

This comment has been minimized.

Show comment
Hide comment
@eldur

eldur Jul 8, 2014

Owner

Hi guiwp,

good point, but actually I have a few other plans instead of adding search entities, but if you want to help it seems not very difficult. (Else I have to schedule this task for later.)

See:
https://www.mediawiki.org/wiki/API:Search
http://www.mediawiki.org/w/api.php (search for "Perform a full text search.")

Maybe like this:

public class Search extends TitleQuery<SearchResult> {
...
Get searchRequest = new ApiRequestBuilder().action("query") //
        .formatJson() //
        .paramNewContinue(mediaWikiVersion) //
        .param("list", "search") //
        .param("srsearch", "wikipedia") //
        .param("srbackend", "CirrusSearch") // or LuceneSearch
// http://www.mediawiki.org/w/api.php?action=query&list=search
// &srsearch=wikipedia&srbackend=CirrusSearch&format=json&continue=-||
...

public class SearchResult {
  final int namespace;
  final String title;
  final String snippet;
  ...
}

At JsonMapperTest.java you can find an example how to map any json response.

Owner

eldur commented Jul 8, 2014

Hi guiwp,

good point, but actually I have a few other plans instead of adding search entities, but if you want to help it seems not very difficult. (Else I have to schedule this task for later.)

See:
https://www.mediawiki.org/wiki/API:Search
http://www.mediawiki.org/w/api.php (search for "Perform a full text search.")

Maybe like this:

public class Search extends TitleQuery<SearchResult> {
...
Get searchRequest = new ApiRequestBuilder().action("query") //
        .formatJson() //
        .paramNewContinue(mediaWikiVersion) //
        .param("list", "search") //
        .param("srsearch", "wikipedia") //
        .param("srbackend", "CirrusSearch") // or LuceneSearch
// http://www.mediawiki.org/w/api.php?action=query&list=search
// &srsearch=wikipedia&srbackend=CirrusSearch&format=json&continue=-||
...

public class SearchResult {
  final int namespace;
  final String title;
  final String snippet;
  ...
}

At JsonMapperTest.java you can find an example how to map any json response.

@ghost

This comment has been minimized.

Show comment
Hide comment
@ghost

ghost Jul 8, 2014

Good answer, I found very simple and effective to start testing adding stuff into the code. But anyway, I feel that I can wait (as you said Else I have to schedule this task for later).

Thank you again :)

ghost commented Jul 8, 2014

Good answer, I found very simple and effective to start testing adding stuff into the code. But anyway, I feel that I can wait (as you said Else I have to schedule this task for later).

Thank you again :)

@eldur eldur added this to the 3.1 milestone Jul 8, 2014

@fhocutt

This comment has been minimized.

Show comment
Hide comment
@fhocutt

fhocutt Aug 1, 2014

Contributor

I'm interested in adding a search function as described here.

Contributor

fhocutt commented Aug 1, 2014

I'm interested in adding a search function as described here.

@eldur eldur modified the milestones: 3.1, 3.2 Dec 7, 2014

eldur added a commit that referenced this issue Dec 7, 2014

eldur added a commit that referenced this issue Dec 7, 2014

eldur added a commit that referenced this issue Dec 7, 2014

@eldur

This comment has been minimized.

Show comment
Hide comment
@eldur

eldur Dec 13, 2014

Owner

@guiwp have you tried gerhardgossen implementation? Actual without a toggle for srbackend but maybe enough?

Owner

eldur commented Dec 13, 2014

@guiwp have you tried gerhardgossen implementation? Actual without a toggle for srbackend but maybe enough?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment