com.xpn.xwiki.plugin.lucene
Class AbstractDocumentData

java.lang.Object
  extended by com.xpn.xwiki.plugin.lucene.AbstractIndexData
      extended by com.xpn.xwiki.plugin.lucene.AbstractDocumentData
Direct Known Subclasses:
AttachmentData, DocumentData

public abstract class AbstractDocumentData
extends AbstractIndexData

Since:
1.23
Version:
$Id$

Field Summary
protected static float AUTHOR_BOOST
          The importance of the last document author username.
protected static float CONTENT_BOOST
          The importance of the full document content.
protected static float CREATION_DATE_BOOST
          The importance of the document creation date.
protected static float CREATOR_BOOST
          The importance of the document creator username.
protected static float DATE_BOOST
          The importance of the document last modification date.
protected static float FULL_NAME_BOOST
          The importance of the document full name.
protected static float ID_BOOST
          The importance of the document ID.
protected static float LANGUAGE_BOOST
          The importance of the document language.
protected static float NAME_BOOST
          The importance of the document's name.
protected static float SPACE_BOOST
          The importance of the document's space.
protected static float TITLE_BOOST
          The importance of the document title.
protected static float TYPE_BOOST
          The importance of the entity type.
protected static float WIKI_BOOST
          The importance of the document's wiki.
 
Constructor Summary
AbstractDocumentData(String type, com.xpn.xwiki.doc.XWikiDocument doc, 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.
 void addDocumentDataToLuceneDocument(org.apache.lucene.document.Document luceneDoc, com.xpn.xwiki.doc.XWikiDocument doc, com.xpn.xwiki.XWikiContext context)
           
protected static void addFieldToDocument(String fieldName, String value, org.apache.lucene.document.Field.Store howToStore, org.apache.lucene.document.Field.Index howToIndex, float boost, org.apache.lucene.document.Document luceneDoc)
          Indexes data into a Lucene field and adds it to the specified Lucene document.
 Date getCreationDate()
           
 String getCreator()
           
 String getDocumentFullName()
           
 String getDocumentName()
           
 org.xwiki.model.reference.DocumentReference getDocumentReference()
           
 String getDocumentSpace()
           
 String getDocumentTitle()
           
 String getFullName()
           
protected  void getFullText(StringBuilder sb, com.xpn.xwiki.doc.XWikiDocument doc, com.xpn.xwiki.XWikiContext context)
           
 String getFullText(com.xpn.xwiki.doc.XWikiDocument doc, com.xpn.xwiki.XWikiContext context)
           
 String getId()
           
 String getLanguage()
           
 org.apache.lucene.index.Term getTerm()
           
 String getVersion()
           
 String getWiki()
           
 void setAuthor(String author)
           
 void setCreationDate(Date creationDate)
           
 void setCreator(String creator)
           
 void setDocumentTitle(String documentTitle)
           
 void setLanguage(String lang)
           
 void setModificationDate(Date modificationDate)
           
 void setVersion(String version)
           
 String 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
 

Field Detail

ID_BOOST

protected static final float ID_BOOST
The importance of the document ID.

See Also:
Constant Field Values

LANGUAGE_BOOST

protected static final float LANGUAGE_BOOST
The importance of the document language.

See Also:
Constant Field Values

TYPE_BOOST

protected static final float TYPE_BOOST
The importance of the entity type.

See Also:
Constant Field Values

WIKI_BOOST

protected static final float WIKI_BOOST
The importance of the document's wiki.

See Also:
Constant Field Values

SPACE_BOOST

protected static final float SPACE_BOOST
The importance of the document's space.

See Also:
Constant Field Values

NAME_BOOST

protected static final float NAME_BOOST
The importance of the document's name.

See Also:
Constant Field Values

FULL_NAME_BOOST

protected static final float FULL_NAME_BOOST
The importance of the document full name.

See Also:
Constant Field Values

TITLE_BOOST

protected static final float TITLE_BOOST
The importance of the document title.

See Also:
Constant Field Values

CONTENT_BOOST

protected static final float CONTENT_BOOST
The importance of the full document content.

See Also:
Constant Field Values

CREATOR_BOOST

protected static final float CREATOR_BOOST
The importance of the document creator username.

See Also:
Constant Field Values

AUTHOR_BOOST

protected static final float AUTHOR_BOOST
The importance of the last document author username.

See Also:
Constant Field Values

CREATION_DATE_BOOST

protected static final float CREATION_DATE_BOOST
The importance of the document creation date.

See Also:
Constant Field Values

DATE_BOOST

protected static final float DATE_BOOST
The importance of the document last modification date.

See Also:
Constant Field Values
Constructor Detail

AbstractDocumentData

public AbstractDocumentData(String type,
                            com.xpn.xwiki.doc.XWikiDocument doc,
                            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
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 AbstractIndexData
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

addDocumentDataToLuceneDocument

public void addDocumentDataToLuceneDocument(org.apache.lucene.document.Document luceneDoc,
                                            com.xpn.xwiki.doc.XWikiDocument doc,
                                            com.xpn.xwiki.XWikiContext context)

getId

public String getId()
Specified by:
getId in class AbstractIndexData
Returns:
string unique to this document across all languages and virtual wikis

getTerm

public org.apache.lucene.index.Term getTerm()
Overrides:
getTerm in class AbstractIndexData

getFullText

public String getFullText(com.xpn.xwiki.doc.XWikiDocument doc,
                          com.xpn.xwiki.XWikiContext context)
Overrides:
getFullText in class AbstractIndexData
Returns:
String of documentName, documentWeb, author and creator

getFullText

protected void getFullText(StringBuilder sb,
                           com.xpn.xwiki.doc.XWikiDocument doc,
                           com.xpn.xwiki.XWikiContext context)
Specified by:
getFullText in class AbstractIndexData

setAuthor

public void setAuthor(String author)
Parameters:
author - The author to set.

setVersion

public void setVersion(String version)
Parameters:
version - the version of the document

setDocumentTitle

public void setDocumentTitle(String documentTitle)
Parameters:
documentTitle - the document title

setModificationDate

public void setModificationDate(Date modificationDate)
Parameters:
modificationDate - The modificationDate to set.

getDocumentTitle

public String getDocumentTitle()

getDocumentReference

public org.xwiki.model.reference.DocumentReference getDocumentReference()

getDocumentName

public String getDocumentName()
Overrides:
getDocumentName in class AbstractIndexData

getDocumentSpace

public String getDocumentSpace()
Overrides:
getDocumentSpace in class AbstractIndexData

getWiki

public String getWiki()
Overrides:
getWiki in class AbstractIndexData

getDocumentFullName

public String getDocumentFullName()
Overrides:
getDocumentFullName in class AbstractIndexData

getVersion

public String getVersion()

getCreationDate

public Date getCreationDate()

setCreationDate

public void setCreationDate(Date creationDate)

getCreator

public String getCreator()

setCreator

public void setCreator(String creator)

getFullName

public String getFullName()
Overrides:
getFullName in class AbstractIndexData

getLanguage

public String getLanguage()

setLanguage

public void setLanguage(String lang)

toString

public String toString()
Overrides:
toString in class AbstractIndexData

addFieldToDocument

protected static void addFieldToDocument(String fieldName,
                                         String value,
                                         org.apache.lucene.document.Field.Store howToStore,
                                         org.apache.lucene.document.Field.Index howToIndex,
                                         float boost,
                                         org.apache.lucene.document.Document luceneDoc)
Indexes data into a Lucene field and adds it to the specified Lucene document.

Parameters:
fieldName - the target field name under which to index this data
value - the data to index
howToStore - whether or not to store this field
howToIndex - how to index the data: analyzed or not
boost - how much to weight hits on this field in search results
luceneDoc - the Lucene document to which the resulting field should be added


Copyright © 2004-2011 XWiki. All Rights Reserved.