com.xpn.xwiki.plugin.lucene
Class IndexData
java.lang.Object
com.xpn.xwiki.plugin.lucene.IndexData
- Direct Known Subclasses:
- AttachmentData, DocumentData, ObjectData
public abstract class IndexData
- extends java.lang.Object
- Version:
- $Id: $
|
Constructor Summary |
IndexData(com.xpn.xwiki.doc.XWikiDocument doc,
com.xpn.xwiki.XWikiContext context)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
IndexData
public IndexData(com.xpn.xwiki.doc.XWikiDocument doc,
com.xpn.xwiki.XWikiContext context)
addDataToLuceneDocument
public 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.
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:
- Keyword fields don't get tokenized, but are
searchable and stored in the index. This is perfect for fields you want to search in programmatically (like ids
and such), and date fields. Since all user-entered queries are tokenized, letting the user search these fields
makes almost no sense, except of queries for date fields, where tokenization is useless.
- the stored text
fields are used for short texts which should be searchable by the user, and stored in the index for
reconstruction. Perfect for document names, titles, abstracts.
- the unstored field takes the biggest part
of the content - the full text. It is tokenized and indexed, but not stored in the index. This makes sense, since
when the user wants to see the full content, he clicks the link to vie the full version of a document, which is
then delivered by xwiki.
- 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.
buildQuery
public org.apache.lucene.search.Query buildQuery()
- Builds a Lucene query matching only the document this instance represents. This is used for removing old versions
of a document from the index before adding a new one.
- Returns:
- a query matching the field DOCUMENT_ID to the value of #getId()
getId
public java.lang.String getId()
- Returns:
- string unique to this document across all languages and virtual wikis
getFullText
public java.lang.String getFullText(com.xpn.xwiki.doc.XWikiDocument doc,
com.xpn.xwiki.XWikiContext context)
- Returns:
- String of documentName, documentWeb, author and creator
getType
public abstract java.lang.String getType()
toString
public java.lang.String toString()
- Overrides:
toString in class java.lang.Object
setAuthor
public void setAuthor(java.lang.String author)
- Parameters:
author - The author to set.
setDocumentTitle
public void setDocumentTitle(java.lang.String documentTitle)
- Parameters:
documentTitle - the document title
setDocumentName
public void setDocumentName(java.lang.String documentName)
- Parameters:
documentName - The documentName to set.
setDocumentWeb
public void setDocumentWeb(java.lang.String documentWeb)
- Parameters:
documentWeb - The documentWeb to set.
setDocumentFullName
public void setDocumentFullName(java.lang.String documentFullName)
- Parameters:
documentFullName - The documentFullName to set.
setModificationDate
public void setModificationDate(java.util.Date modificationDate)
- Parameters:
modificationDate - The modificationDate to set.
getDocumentTitle
public java.lang.String getDocumentTitle()
getDocumentName
public java.lang.String getDocumentName()
getDocumentWeb
public java.lang.String getDocumentWeb()
getDocumentFullName
public java.lang.String getDocumentFullName()
getWiki
public java.lang.String getWiki()
setWiki
public void setWiki(java.lang.String wiki)
getCreationDate
public java.util.Date getCreationDate()
setCreationDate
public void setCreationDate(java.util.Date creationDate)
getCreator
public java.lang.String getCreator()
setCreator
public void setCreator(java.lang.String creator)
getFullName
public java.lang.String getFullName()
setFullName
public void setFullName(java.lang.String fullName)
getLanguage
public java.lang.String getLanguage()
setLanguage
public void setLanguage(java.lang.String lang)
Copyright © 2004-2009 XWiki. All Rights Reserved.