com.xpn.xwiki.plugin.lucene
Class AttachmentData

java.lang.Object
  extended by com.xpn.xwiki.plugin.lucene.IndexData
      extended by com.xpn.xwiki.plugin.lucene.AttachmentData

public class AttachmentData
extends IndexData

Holds all data but the content of an attachment 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.

Version:
$Id: $

Constructor Summary
AttachmentData(com.xpn.xwiki.doc.XWikiDocument document, com.xpn.xwiki.doc.XWikiAttachment attachment, com.xpn.xwiki.XWikiContext context)
           
 
Method Summary
 void addDataToLuceneDocument(org.apache.lucene.document.Document luceneDoc, com.xpn.xwiki.doc.XWikiDocument doc, com.xpn.xwiki.XWikiContext context)
          Adds this documents data to a lucene Document instance for indexing.
 java.lang.String getFilename()
           
 java.lang.String getFullText(com.xpn.xwiki.doc.XWikiDocument doc, com.xpn.xwiki.XWikiContext context)
           
 java.lang.String getId()
          overridden to append the filename
 java.lang.String getType()
           
 void setFilename(java.lang.String filename)
           
 void setSize(int size)
           
 
Methods inherited from class com.xpn.xwiki.plugin.lucene.IndexData
buildQuery, getCreationDate, getCreator, getDocumentFullName, getDocumentName, getDocumentTitle, getDocumentWeb, getFullName, getLanguage, getWiki, setAuthor, setCreationDate, setCreator, setDocumentFullName, setDocumentName, setDocumentTitle, setDocumentWeb, setFullName, setLanguage, setModificationDate, setWiki, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AttachmentData

public AttachmentData(com.xpn.xwiki.doc.XWikiDocument document,
                      com.xpn.xwiki.doc.XWikiAttachment attachment,
                      com.xpn.xwiki.XWikiContext context)
Parameters:
attachment -
context -
Method Detail

addDataToLuceneDocument

public void addDataToLuceneDocument(org.apache.lucene.document.Document luceneDoc,
                                    com.xpn.xwiki.doc.XWikiDocument doc,
                                    com.xpn.xwiki.XWikiContext context)
Description copied from class: IndexData
Adds this documents data to a lucene Document instance for indexing.

Short introduction to Lucene field types

Which type of Lucene field is used determines what Lucene does with data and how we can use it for searching and showing search results:

Overrides:
addDataToLuceneDocument in class IndexData
Parameters:
luceneDoc - if not null, this controls which translated version of the content will be indexed. If null, the content in the default language will be used.

setSize

public void setSize(int size)
Parameters:
size - The size to set.

getType

public java.lang.String getType()
Specified by:
getType in class IndexData
See Also:
IndexData.getType()

getFilename

public java.lang.String getFilename()
Returns:
Returns the filename.

setFilename

public void setFilename(java.lang.String filename)
Parameters:
filename - The filename to set.

getId

public java.lang.String getId()
overridden to append the filename

Overrides:
getId in class IndexData
Returns:
string unique to this document across all languages and virtual wikis
See Also:
IndexData.getId()

getFullText

public java.lang.String getFullText(com.xpn.xwiki.doc.XWikiDocument doc,
                                    com.xpn.xwiki.XWikiContext context)
Overrides:
getFullText in class IndexData
Returns:
a string containing the result of IndexData.getFullText(com.xpn.xwiki.doc.XWikiDocument, com.xpn.xwiki.XWikiContext) plus the full text content of this attachment, as far as it could be extracted.


Copyright © 2004-2009 XWiki. All Rights Reserved.