I am sorry, something wrong with gmail attachment function:(
And here is my nutch rss generator:
-----------------------------------------------------------------------------------------
package churchillobjects.rss4j.generator;
import java.util.Enumeration;
import org.w3c.dom.Element;
import churchillobjects.rss4j.NutchSearchChannel;
import churchillobjects.rss4j.NutchSearchChannelItem;
import churchillobjects.rss4j.OpenSearchChannel;
import churchillobjects.rss4j.RssChannel;
import churchillobjects.rss4j.RssDocument;
/**
* @author jack.tang
*
*/
public class NutchRssGeneratorImpl100 extends OpenSearchGeneratorImpl100 {
NutchRssGeneratorImpl100() throws RssGenerationException{
super();
}
private static final String XMLNS_NUTCH =
"http://www.nutch.org/opensearchrss/1.0/";
private static final String NUTCH_NAMESAPCE = "nutch";
/**
* Starts a new nutch (extends OpenSearch 1.0) document. The
RssDocument object is needed to determine
* what extensions are necessary to include in the root element.
* @param data
*/
protected void createRssDocument(RssDocument data){
super.createRssDocument(data);
rootElement.setAttribute("xmlns:" + NUTCH_NAMESAPCE,
XMLNS_NUTCH);
}
/**
* Creates a channel element, digging down from that point in the
object hierarchy
* and invoking the other handlers.
* @param channel
* @throws RssGenerationException
*/
protected void handleChannel(RssChannel channel) throws
RssGenerationException{
Element channelElement = doc.createElement("channel");
rootElement.appendChild(channelElement);
handleChannelTitle(channel, channelElement);
handleChannelLink(channel, channelElement);
handleChannelDescription(channel, channelElement);
handleChannelOptionalElements(channel, channelElement);
handleChannelOpenSearchElements((OpenSearchChannel)channel,
channelElement);
handleChannelNutchElements((NutchSearchChannel)channel,channelElement);
handleItems((NutchSearchChannel)channel, channelElement);
}
protected void handleItems(NutchSearchChannel channel, Element
channelElement) throws RssGenerationException{
if(channel.getItemCount()==0){
throw new RssGenerationException("Each channel must
have at least one item");
}
Enumeration enum = channel.items();
while(enum.hasMoreElements()){
NutchSearchChannelItem item =
(NutchSearchChannelItem)enum.nextElement();
if(item!=null){
Element itemElement = doc.createElement("item");
//itemElement.setAttribute("rdf:about",
item.getItemLink());
handleItemTitle(item, itemElement);
handleItemLink(item, itemElement);
handleItemDescription(item, itemElement);
handleChannelNutchItem(item, itemElement);
channelElement.appendChild(itemElement);
}
}
}
protected void handleChannelNutchItem(NutchSearchChannelItem channel,
Element itemElement)
throws RssGenerationException{
String cache = channel.getCache();
validateValueOptional(cache,"Nutch cache", Integer.MAX_VALUE);
add(itemElement, XMLNS_NUTCH,NUTCH_NAMESAPCE+":cache", cache);
String explain = channel.getExplain();
validateValueOptional(explain,"Nutch
explain",Integer.MAX_VALUE);
add(itemElement,
XMLNS_NUTCH,NUTCH_NAMESAPCE+":explain",explain);
String anchors = channel.getAnchors();
validateValueOptional(anchors,"Nutch
anchors",Integer.MAX_VALUE);
add(itemElement, XMLNS_NUTCH,NUTCH_NAMESAPCE+":anchors",
anchors);
String moreFromSite = channel.getMoreFromSite();
validateValueOptional(moreFromSite,"Nutch
moreFromSite",Integer.MAX_VALUE);
add(itemElement, XMLNS_NUTCH,NUTCH_NAMESAPCE+":moreFromSite",
moreFromSite);
}
protected void handleChannelNutchElements(NutchSearchChannel channel,
Element channelElement)
throws RssGenerationException{
int itemsPerSite = channel.getItemsPerSite();
validateValueRequired(itemsPerSite,"Nutch itemsPerSite", -1,
Integer.MAX_VALUE);
add(channelElement, XMLNS_NUTCH,NUTCH_NAMESAPCE+":itemsPerSite",
String.valueOf(itemsPerSite));
}
}
/Jack
On 4/19/05, Jack Tang <[EMAIL PROTECTED]> wrote:
> ---------- Forwarded message ----------
> From: Jack Tang <[EMAIL PROTECTED]>
> Date: Apr 19, 2005 11:06 AM
> Subject: Re: [jira] Commented: (NUTCH-39) pagination in search result
> To: [email protected]
>
> Hi Doug
>
> I attached my nutch rss search (extends rss4j). I think some great
> ideas behind the small project.
>
> RSS4J: http://www.churchillobjects.com/c/13005.html
>
> /Jack
>
> On 4/19/05, Doug Cutting <[EMAIL PROTECTED]> wrote:
> > Dawid Weiss wrote:
> > > Andrzej suggested that I add clustered results to the XML RSS feed; in
> > > order to do so I'd have to modify the servlet slightly -- my question
> > > is: what's the best way do to it? Should I alter the servlet, or rather
> > > write (subclass?) it and put the code that uses the clustering plugin
> > > and outputs the results in there?
> >
> > Good question. Let's first try it as a subclass and see how that goes.
> >
> > We'll need to add a number of protected methods. For example, the
> > addNode methods should become protected, as well as something like a
> > generateChannel(query,hits,..) and generateItem(hit,details,...). If
> > you'd like me to first restructure things this way that'd be fine,
> > although it may still need some adjustment when you go to subclass it.
> >
> > Cheers,
> >
> > Doug
> >
>
>
>
-------------------------------------------------------
This SF.Net email is sponsored by: New Crystal Reports XI.
Version 11 adds new functionality designed to reduce time involved in
creating, integrating, and deploying reporting solutions. Free runtime info,
new features, or free trial, at: http://www.businessobjects.com/devxi/728
_______________________________________________
Nutch-developers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nutch-developers