wt.index
Interface IndexAccessor

All Known Implementing Classes:
IndexAccessorConnection.IndexAccessorInner

public interface IndexAccessor

This is the interface that writes out a text stream to a indexed search collection.


An IndexAccessor is created by the following code

IndexAccessor iacc = null;
IndexAccessorConnection iaccConn = null;

iaccConn = IndexAccessorConnectionFactory.createAccessor( getIndex( ) );

iaccConn.openConnection();

iacc = iaccConn.getIndexAccessor();

Do not instantiate this class directly



Supported API: true

Extendable: false

See Also:
IndexDelegate, wt.index.IndexAccessorFactory

Method Summary
 boolean abortIndex()
          internal
*

Supported API: false
 void beginDocument()
          Mark the beginning of an individual document
Call this method immediately after calling writeHeader
Example:
iacc = iaccConn.getIndexAccessor();
iacc.writeHeader( );
iacc.beginIndex( );


Supported API: true
 void beginIndex()
          Mark the beginning of the indexing stream
Call this method immediately after calling writeHeader
Example:
iacc = iaccConn.getIndexAccessor();
iacc.writeHeader( );
iacc.beginIndex( );


Supported API: true
 void endDocument()
          Mark the end of an individual document
Call this method after you are through calling writeItem and writeLob



Supported API: true
 void endIndex()
          Mark the end of the indexing stream
Call this method after you have called the final endDocument



Supported API: true
 boolean writeField(String field_name, String value)
          Write the value to store in field field_name.
 boolean writeFile(String name)
          internal for testing
*

Supported API: false
 void writeHeader()
          Write out the header information to the indexing stream
Call this method immediately after getting the IndexAccessor from the
IndexAccessorConnection
Example:
iacc = iaccConn.getIndexAccessor();
iacc.writeHeader( );
iacc.beginIndex( );


Supported API: true
 boolean writeItem(String name, String value)
          Write the text in value out to the indexing stream and map it to the
field and/or zone that corresponds to the value of name in your formats.cfg
file.
 String writeLob(InputStream lob_stream, String contentFileName, String appOID, long fileSize, boolean isZip)
          Write the text of the stream passed to a indexing stream.
 boolean writeMetaData(String data)
          Write the value to store in field field_name.
 boolean writeTokenFormat(String line)
          internal
*

Supported API: false
 boolean writeType(String name)
          Write the type of the object out to the indexing stream.
 

Method Detail

writeType

public boolean writeType(String name)
Write the type of the object out to the indexing stream. This needs to be done
immediately after the IndexAccessor is initialized. Note that this
type must be defined in the formats.cfg file for your collections (see Application
Developer's Guide for more details on formats.cfg).
Example:
iacc = iaccConn.getIndexAccessor();
iacc.writeHeader( );
iacc.beginIndex( );
iacc.writeType( "WindchillBusinessObject" ); // this maps to a type defined in formats.cfg


Supported API: true


writeFile

public boolean writeFile(String name)
internal for testing
*

Supported API: false


writeField

public boolean writeField(String field_name,
                          String value)
Write the value to store in field field_name. This field must exist in the library that the object is being indexed to.

Supported API: true


writeMetaData

public boolean writeMetaData(String data)
Write the value to store in field field_name. This field must exist in the library that the object is being indexed to.

Supported API: true


writeItem

public boolean writeItem(String name,
                         String value)
Write the text in value out to the indexing stream and map it to the
field and/or zone that corresponds to the value of name in your formats.cfg
file. This method can be called after the writeType method is called and
before endIndex is called

Example:
// note that the strings "identity" and "customerSite" need to map to an
// item or an alias in your formats.cfg file. see above.
iacc.writeItem( "identity", cr.getIdentity( ) );
iacc.writeItem( "customerSite", cr.getSite ( ).getDisplay( locale ) );

Note that if you write multiple times to the same name within a single
indexing stream you need to manually space the items or the search results will
respond as if all these items are strung together

Example:
iacc.writeItem( "MetaData", cr.getIdentity( ) );
iacc.writeItem( "MetaData", " " + cr.getSite ( ).getDisplay( locale ) );



Supported API: true


writeLob

public String writeLob(InputStream lob_stream,
                       String contentFileName,
                       String appOID,
                       long fileSize,
                       boolean isZip)
Write the text of the stream passed to a indexing stream. You should first verify the
type is Indexable. It would only be relevant to use this method on those classes that
are ContentHolders. This method can be called after the writeType method is called and
before endIndex is called

Example:
// note that the strings "identity" and "customerSite" need to map to an
// item or an alias in your formats.cfg file. see above.
ApplicationData appData = null;
...
if ( ContentServerHelper.service.indexable( appData ) ) {
InputStream contentStream = ContentServerHelper.service.findContentStream( appData );
if ( ( contentStream != null ) && ( contentStream.available( ) != 0 ) )
iacc.writeLob( new DataInputStream( contentStream ) );
}



Supported API: true

See Also:
ContentHolder, ApplicationData, ContentServiceSvr

writeTokenFormat

public boolean writeTokenFormat(String line)
internal
*

Supported API: false


abortIndex

public boolean abortIndex()
internal
*

Supported API: false


writeHeader

public void writeHeader()
                 throws IndexingException
Write out the header information to the indexing stream
Call this method immediately after getting the IndexAccessor from the
IndexAccessorConnection
Example:
iacc = iaccConn.getIndexAccessor();
iacc.writeHeader( );
iacc.beginIndex( );


Supported API: true

Throws:
IndexingException

beginIndex

public void beginIndex()
                throws IndexingException
Mark the beginning of the indexing stream
Call this method immediately after calling writeHeader
Example:
iacc = iaccConn.getIndexAccessor();
iacc.writeHeader( );
iacc.beginIndex( );


Supported API: true

Throws:
IndexingException

endIndex

public void endIndex()
              throws IndexingException
Mark the end of the indexing stream
Call this method after you have called the final endDocument



Supported API: true

Throws:
IndexingException

beginDocument

public void beginDocument()
                   throws IndexingException
Mark the beginning of an individual document
Call this method immediately after calling writeHeader
Example:
iacc = iaccConn.getIndexAccessor();
iacc.writeHeader( );
iacc.beginIndex( );


Supported API: true

Throws:
IndexingException

endDocument

public void endDocument()
                 throws IndexingException
Mark the end of an individual document
Call this method after you are through calling writeItem and writeLob



Supported API: true

Throws:
IndexingException