package org.carrot2.source.boss.data;

import org.apache.commons.lang.StringEscapeUtils;
import org.apache.commons.lang.StringUtils;
import org.simpleframework.xml.Element;
import org.simpleframework.xml.Root;
import org.simpleframework.xml.load.Commit;

/**
 * A single Web search result.
 */
@Root(name = "result", strict = false)
public final class WebResult
{
    @Element(name = "abstract", required = false)
    public String summary;

    @Element(required = false)
    public String date;
    
    @Element(name = "dispurl", required = false)
    public String displayURL;
    
    @Element(name = "clickurl", required = false)
    public String clickURL;

    @Element(name = "size", required = false)
    public Long size;

    @Element(required = false)
    public String title;

    @Element(required = false)
    public String url;

    /**
     * On commit, unescape HTML fields.
     */
    @Commit
    @SuppressWarnings("unused")
    private void unescape()   
    {
        summary = unescape(summary);
        title = unescape(title);
    }

    /*
     * 
     */
    private static String unescape(String value)
    {
        if (value == null || StringUtils.isEmpty(value))
            return value;

        return StringEscapeUtils.unescapeHtml(value);
    }
}
@@ -96,35 +96,28 @@
 ort org.
-apache.commons.lang
+carrot2.util
 .StringU
@@ -1029,24 +1029,21 @@
 mmary = 
-unescape
+clean
 (summary
@@ -1062,24 +1062,21 @@
 title = 
-unescape
+clean
 (title);
@@ -1138,24 +1138,21 @@
  String 
-unescape
+clean
 (String 
@@ -1195,16 +1195,40 @@
 null %7C%7C 
+org.apache.commons.lang.
 StringUt
@@ -1292,16 +1292,43 @@
  return 
+StringUtils.removeHtmlTags(
 StringEs
@@ -1356,16 +1356,17 @@
 l(value)
+)
 ;%0D%0A    %7D

De-HTML snippet/title.