/*
 * 
 * ===================================================================
 *
 * Copyright (c) 2005 Jens Krämer, All rights reserved.
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details, published at
 * http://www.gnu.org/copyleft/gpl.html or in gpl.txt in the
 * root folder of this distribution.
 *
 * Created on 25.01.2005
 *
 */

package com.xpn.xwiki.plugin.lucene;

import com.xpn.xwiki.XWikiContext;
import com.xpn.xwiki.doc.XWikiDocument;

/**
 * Holds all data but the content of a wiki page to be indexed. The content is
 * retrieved at indexing time, which should save us some memory especially when
 * rebuilding an index for a big wiki.
 * @author <a href="mailto:jk@jkraemer.net">Jens Krämer </a>
 */
public class DocumentData extends IndexData {
    public DocumentData (final XWikiDocument doc, final XWikiContext context)
    {
        super (doc, context);
        setAuthor (doc.getAuthor ());
        setCreator (doc.getCreator ());
        setModificationDate (doc.getDate ());
        setCreationDate (doc.getCreationDate ());
    }

    /**
     * @see net.jkraemer.xwiki.plugins.lucene.IndexData#getType()
     */
    public String getType ()
    {
        return LucenePlugin.DOCTYPE_WIKIPAGE;
    }

    /**
     * @return a string containing the result of
     *         {@link IndexData#getFullText(XWikiDocument, XWikiContext, String)}
     *         plus the full text content of this document (in the given
     *         language)
     */
    public String getFullText (XWikiDocument doc, XWikiContext context)
    {
        return new StringBuffer (super.getFullText (doc, context)).append (" ").append (doc.getContent ())
                .toString ();
    }

}

@@ -1208,16 +1208,17 @@
 xData %7B%0A
+%0A
     publ
@@ -1232,17 +1232,16 @@
 mentData
- 
 (final X
@@ -1305,17 +1305,16 @@
    super
- 
 (doc, co
@@ -1338,17 +1338,16 @@
 etAuthor
- 
 (doc.get
@@ -1352,17 +1352,16 @@
 etAuthor
- 
 ());%0A   
@@ -1375,17 +1375,16 @@
 tCreator
- 
 (doc.get
@@ -1390,17 +1390,16 @@
 tCreator
- 
 ());%0A   
@@ -1414,33 +1414,32 @@
 ModificationDate
- 
 (doc.getDate ())
@@ -1430,25 +1430,24 @@
 (doc.getDate
- 
 ());%0A       
@@ -1462,17 +1462,16 @@
 tionDate
- 
 (doc.get
@@ -1482,17 +1482,16 @@
 tionDate
- 
 ());%0A   
@@ -1518,42 +1518,8 @@
 see 
-net.jkraemer.xwiki.plugins.lucene.
 Inde
@@ -1731,16 +1731,34 @@
 ullText(
+com.xpn.xwiki.doc.
 XWikiDoc
@@ -1764,16 +1764,30 @@
 cument, 
+com.xpn.xwiki.
 XWikiCon
@@ -1794,16 +1794,8 @@
 text
-, String
 )%7D%0A 
@@ -1928,17 +1928,16 @@
 FullText
- 
 (XWikiDo
@@ -1984,22 +1984,35 @@
         
-return
+StringBuffer text =
  new Str
@@ -2020,17 +2020,16 @@
 ngBuffer
- 
 (super.g
@@ -2038,17 +2038,16 @@
 FullText
- 
 (doc, co
@@ -2057,29 +2057,55 @@
 xt))
+;%0A        text
 .append
- 
 (%22 %22)
+;%0A        text
 .append
- 
 (doc
@@ -2119,12 +2119,13 @@
 tent
- 
 ())
+;%0A
 %0A   
@@ -2129,24 +2129,27 @@
         
-        
+return text
 .toStrin
@@ -2149,17 +2149,16 @@
 toString
- 
 ();%0A    
@@ -2159,11 +2159,10 @@
 ;%0A    %7D%0A
-%0A
 %7D%0A

Clean up and fixed javadoc errors