rehamaltamimi / gwtwiki

Automatically exported from code.google.com/p/gwtwiki
0 stars 0 forks source link

wordcount attribute not read correctly because of case mismatch #66

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1.

Use queryXML method to invoke mediawiki search API, then parse results using 
XMLSearchParser, e.g.

                 String responseBody = connector.queryXML(user, valuePairs);

                         parser = new XMLSearchParser(responseBody);
                         parser.parse();

The results returned in getSearchResultList do not have the wordcount attribute 
set correctly.

What is the expected output? What do you see instead?

getWordCount() should return non-null.

What version of the product are you using? On what operating system?

bliki-core-3.0.16.jar on MacOS 10.6, Java 1.6

Please provide any additional information below.

As seen in the returned XML from mediawiki, the attribute wordcount is 
lowercase.

Body: <?xml version="1.0"?><api><query><searchinfo totalhits="233" /><search><p 
ns="0" title="Liver function tests" wordcount="1322" 
timestamp="2011-04-13T13:42:06Z" /><p ns="0" title="Biopsy" wordcount="3724" 
timestamp="2011-04-18T22:33:01Z" /><p ns="0" title="Hepatorenal syndrome" 
wordcount="5701" timestamp="2011-04-24T14:54:21Z" /><p ns="0" title="Alcoholic 
liver disease" wordcount="1839" timestamp="2011-03-01T11:30:51Z" /><p ns="0" 
title="Colorectal cancer" wordcount="11196" timestamp="2011-04-26T02:16:52Z" 
/><p ns="0" title="Alcohol and cancer" wordcount="12275" 
timestamp="2011-04-15T17:41:05Z" /><p ns="0" title="Hepatocellular carcinoma" 
wordcount="6166" timestamp="2011-04-01T05:14:24Z" /><p ns="0" 
title="Fascioloides magna" wordcount="5967" timestamp="2010-12-26T14:19:59Z" 
/><p ns="0" title="Steatosis" wordcount="970" timestamp="2011-04-03T17:55:14Z" 
/><p ns="0" title="Vinyl chloride" wordcount="3592" 
timestamp="2011-03-04T01:57:19Z" /></search></query><query-continue><search 
sroffset="10" /></query-continue></api>

To fix this issue:

Index: bliki-core/src/main/java/info/bliki/api/XMLSearchParser.java
===================================================================
--- bliki-core/src/main/java/info/bliki/api/XMLSearchParser.java    (revision 3298)
+++ bliki-core/src/main/java/info/bliki/api/XMLSearchParser.java    (working copy)
@@ -17,7 +17,7 @@
    private static final String SNIPPET_ID = "snippet";
    private static final String SROFFSET_ID = "sroffset";
    private static final String TIMESTAMP_ID = "timestamp";
-   private static final String WORDCOUNT_ID = "wordCount";
+   private static final String WORDCOUNT_ID = "wordcount";

    private SearchResult fSearchResult;

Original issue reported on code.google.com by smarqu...@gmail.com on 28 Apr 2011 at 11:06

GoogleCodeExporter commented 8 years ago
Commited with r3299

Thanks for the patch.

Original comment by axelclk@gmail.com on 28 Apr 2011 at 8:13