WikipediaModel.java

import java.util.Date;

import org.apache.solr.client.solrj.SolrServer;
import org.apache.solr.common.SolrInputDocument;

public class WikipediaModel {

    String title;
    String titleAnnotation;
    String id;
    String text;
    int textCount;
    Date lastModified;

    public void save(SolrServer server) throws Exception {
        server.add(getDocument());
    }

    public SolrInputDocument getDocument() {
        SolrInputDocument doc = new SolrInputDocument();
        doc.addField("id", this.id);
        doc.addField("title", this.title);
        doc.addField("title_annotation", this.titleAnnotation);
        doc.addField("text", this.text);
        doc.addField("text_count", this.text.length());
        doc.addField("last_modified", this.lastModified);
        return doc;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getTitleAnnotation() {
        return titleAnnotation;
    }

    public void setTitleAnnotation(String titleAnnotation) {
        this.titleAnnotation = titleAnnotation;
    }

    public String getText() {
        return text;
    }

    public void setText(String text) {
        this.text = text;
    }

    public Date getLastModified() {
        return lastModified;
    }

    public void setLastModified(Date lastModified) {
        this.lastModified = lastModified;
    }

    public String toString() {
        return this.id + "," + this.title + "," + this.titleAnnotation + "," + this.lastModified;
    }
}

/*
 *           DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
 *                   Version 2, December 2004
 *
 * Copyright (C) 2011 mwSoft
 *  
 * Everyone is permitted to copy and distribute verbatim or modified
 * copies of this license document, and changing it is allowed as long
 * as the name is changed.
 *    
 *            DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
 *   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
 *
 *  0. You just DO WHAT THE FUCK YOU WANT TO.
 */