com.xpn.xwiki.plugin.lucene
Class AttachmentData

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

public class AttachmentData
extends AbstractDocumentData

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$

Field Summary
 
Fields inherited from class com.xpn.xwiki.plugin.lucene.AbstractDocumentData
AUTHOR_BOOST, CONTENT_BOOST, CREATION_DATE_BOOST, CREATOR_BOOST, DATE_BOOST, FULL_NAME_BOOST, ID_BOOST, LANGUAGE_BOOST, NAME_BOOST, SPACE_BOOST, TITLE_BOOST, TYPE_BOOST, WIKI_BOOST
 
Constructor Summary
AttachmentData(com.xpn.xwiki.doc.XWikiAttachment attachment, com.xpn.xwiki.XWikiContext context, boolean deleted)
           
AttachmentData(com.xpn.xwiki.doc.XWikiDocument document, String filename, com.xpn.xwiki.XWikiContext context, boolean deleted)
           
 
Method Summary
 void addDataToLuceneDocument(org.apache.lucene.document.Document luceneDoc, com.xpn.xwiki.XWikiContext context)
          Adds this documents data to a lucene Document instance for indexing.
 String getFilename()
           
protected  void getFullText(StringBuilder sb, com.xpn.xwiki.doc.XWikiDocument doc, com.xpn.xwiki.XWikiContext context)
          
 String getId()
          overridden to append the filename
 int getSize()
           
 void setFilename(String filename)
           
 void setSize(int size)
           
 
Methods inherited from class com.xpn.xwiki.plugin.lucene.AbstractDocumentData
addDocumentDataToLuceneDocument, addFieldToDocument, getCreationDate, getCreator, getDocumentFullName, getDocumentName, getDocumentReference, getDocumentSpace, getDocumentTitle, getFullName, getFullText, getLanguage, getTerm, getVersion, getWiki, setAuthor, setCreationDate, setCreator, setDocumentTitle, setLanguage, setModificationDate, setVersion, toString
 
Methods inherited from class com.xpn.xwiki.plugin.lucene.AbstractIndexData
getEntityName, getEntityReference, getType, isDeleted, setDeleted, setEntityReference
 
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.XWikiAttachment attachment,
                      com.xpn.xwiki.XWikiContext context,
                      boolean deleted)

AttachmentData

public AttachmentData(com.xpn.xwiki.doc.XWikiDocument document,
                      String filename,
                      com.xpn.xwiki.XWikiContext context,
                      boolean deleted)
Method Detail

addDataToLuceneDocument

public void addDataToLuceneDocument(org.apache.lucene.document.Document luceneDoc,
                                    com.xpn.xwiki.XWikiContext context)
                             throws com.xpn.xwiki.XWikiException
Description copied from class: AbstractDocumentData
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 AbstractDocumentData
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.
Throws:
com.xpn.xwiki.XWikiException

setSize

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

getSize

public int getSize()
Returns:
The size to set.

getFilename

public String getFilename()
Returns:
Returns the filename.

setFilename

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

getId

public String getId()
overridden to append the filename

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

getFullText

protected void getFullText(StringBuilder sb,
                           com.xpn.xwiki.doc.XWikiDocument doc,
                           com.xpn.xwiki.XWikiContext context)

Return a string containing the result of AbstractIndexData.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.

Overrides:
getFullText in class AbstractDocumentData
See Also:
AbstractIndexData.getFullText(java.lang.StringBuilder, com.xpn.xwiki.doc.XWikiDocument, com.xpn.xwiki.XWikiContext)


Copyright © 2004-2011 XWiki. All Rights Reserved.