Regain 2.1.0-STABLE API

net.sf.regain.crawler.document
Interface Preparator

All Superinterfaces:
Pluggable
All Known Subinterfaces:
WriteablePreparator
All Known Implementing Classes:
AbstractJacobMsOfficePreparator, AbstractPreparator, DispatcherPreparator, EmptyPreparator, ExternalPreparator, FilenamePreparator, GenericAudioPreparator, HtmlPreparator, IfilterPreparator, JacobMsExcelPreparator, JacobMsPowerPointPreparator, JacobMsWordPreparator, JarPreparator, JavaPreparator, MessagePreparator, MP3Preparator, OpenOfficePreparator, PdfBoxPreparator, PlainTextPreparator, PoiMsOfficePreparator, SimpleRtfPreparator, SwingRtfPreparator, XmlPreparator, ZipPreparator

public interface Preparator
extends Pluggable

Prepares a document for indexing. This is a read-only interface.

This is done by extracting the raw text from a document. In other words the document is stripped from formating information. Specific text parts like a title or a summary may be extracted as well.

The procedure of preparation is the following:

Author:
Til Schneider, www.murfman.de

Field Summary
static int DEFAULT_BUFFER_SIZE
          The default StringBuffer size that should be used for the content buffer.
 
Method Summary
 boolean accepts(RawDocument rawDocument)
          Gets whether the preparator is able to process the given document.
 void cleanUp()
          Gibt alle Ressourcen frei, die für die Informationen über das Dokument reserviert wurden.
 void close()
          Gibt alle Ressourcen frei, die von diesem Präparator genutzt wurden.
 Map<String,String> getAdditionalFields()
          Gets additional fields that should be indexed.
 String getCleanedContent()
          Gibt den von Formatierungsinformation befreiten Inhalt des Dokuments zurück.
 String getCleanedMetaData()
           
 String getHeadlines()
          Gibt die überschriften des Dokuments zurück.
 PathElement[] getPath()
          Gibt den Pfad zurück, über den das Dokument zu erreichen ist.
 int getPriority()
          Gets the priority of the preparator
 String getSummary()
          Gibt eine Zusammenfassung für das Dokument zurück.
 String getTitle()
          Gibt den Titel des Dokuments zurück.
 void prepare(RawDocument rawDocument)
          Prepares a document for indexing.
 void setPriority(int priority)
          Sets the priority of the preparator
 void setUrlRegex(org.apache.regexp.RE urlRegex)
          Sets the regular expression a URL must match to, to be prepared by this preparator.
 
Methods inherited from interface net.sf.regain.crawler.document.Pluggable
init
 

Field Detail

DEFAULT_BUFFER_SIZE

static final int DEFAULT_BUFFER_SIZE
The default StringBuffer size that should be used for the content buffer.

See Also:
Constant Field Values
Method Detail

setUrlRegex

void setUrlRegex(org.apache.regexp.RE urlRegex)
Sets the regular expression a URL must match to, to be prepared by this preparator.

Parameters:
urlRegex - The new URL regex.
See Also:
accepts(RawDocument)

accepts

boolean accepts(RawDocument rawDocument)
Gets whether the preparator is able to process the given document.

Parameters:
rawDocument - The document to check.
Returns:
Whether the preparator is able to process the given document.
See Also:
setUrlRegex(RE)

prepare

void prepare(RawDocument rawDocument)
             throws RegainException
Prepares a document for indexing.

Parameters:
rawDocument - The document to prepare.
Throws:
RegainException - If preparing the document failed.

getTitle

String getTitle()
Gibt den Titel des Dokuments zurück.

Falls kein Titel extrahiert werden konnte, wird null zurückgegeben.

Returns:
Der Titel des Dokuments.

getCleanedContent

String getCleanedContent()
Gibt den von Formatierungsinformation befreiten Inhalt des Dokuments zurück.

Returns:
The cleanedContent

getCleanedMetaData

String getCleanedMetaData()
Returns:
the cleaned meta data

getSummary

String getSummary()
Gibt eine Zusammenfassung für das Dokument zurück.

Falls es keine Zusammenfassung m�glich ist, wird null zurückgegeben.

Returns:
Eine Zusammenfassung für das Dokument zurück.

getHeadlines

String getHeadlines()
Gibt die überschriften des Dokuments zurück.

Es handelt sich dabei nicht um die überschrift des Dokuments selbst, sondern lediglich um Unter-überschriften, die in dem Dokument verwendendet werden. Mit Hilfe dieser überschriften l��t sich eine bessere Relevanz berechnen.

Wenn keine überschriften gefunden wurden, dann wird null zurückgegeben.

Returns:
Die überschriften des Dokuments.

getPath

PathElement[] getPath()
Gibt den Pfad zurück, über den das Dokument zu erreichen ist.

Falls kein Pfad verfügbar ist, wird null zurückgegeben.

Returns:
Der Pfad, über den das Dokument zu erreichen ist.

getAdditionalFields

Map<String,String> getAdditionalFields()
Gets additional fields that should be indexed.

These fields will be indexed and stored.

Returns:
The additional fields or null.

cleanUp

void cleanUp()
Gibt alle Ressourcen frei, die für die Informationen über das Dokument reserviert wurden.

Wird am Ende der Bearbeitung eines Dokuments aufgerufen, also nachdem die Getter abgefragt wurden.


close

void close()
           throws RegainException
Gibt alle Ressourcen frei, die von diesem Präparator genutzt wurden.

Wird ganz am Ende des Crawler-Prozesses aufgerufen, nachdem alle Dokumente bearbeitet wurden.

Throws:
RegainException - Wenn der Präparator nicht geschlossen werden konnte.

getPriority

int getPriority()
Gets the priority of the preparator

Returns:
int the priority

setPriority

void setPriority(int priority)
Sets the priority of the preparator

Parameters:
priority - read from config or default value settings

Regain 2.1.0-STABLE API

Regain 2.1.0-STABLE, Copyright (C) 2004-2010 Til Schneider, www.murfman.de, Thomas Tesche, www.clustersystems.info