Class MetaIndexBuilder

  • All Implemented Interfaces:
    java.io.Closeable, java.lang.AutoCloseable
    Direct Known Subclasses:
    BaseMetaIndexBuilder, MemoryMetaIndex

    public abstract class MetaIndexBuilder
    extends java.lang.Object
    implements java.io.Closeable
    Abstract class for writing document metadata to a disk index. Metadata means textual data associated with a document, e.g. an external document identifier (e.g. docnos), a URL, or the title or abstracts of a document.

    Lookups in the resulting MetaIndex are supported in two manners - either by docid, or for specified key types, by value. In the latter scenario, metadata values are assumed to be unique.

    Typical usage during indexing:

     MetaIndexBuilder metaBuilder = ...
     while(collection.nextDocument())
     {
            Document d = collection.getDocument();
      metaBuilder.writeDocumentEntry(d.getAllProperties());
     }
     
    Since:
    3.0
    Author:
    Craig Macdonald
    • Method Summary

      All Methods Static Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      static MetaIndexBuilder create​(java.lang.String metaBuilderName, IndexOnDisk index, java.lang.String[] forwardMetaKeys, int[] metaKeyLengths, java.lang.String[] reverseMetaKeys)
      Factory method - create a MetaIndexBuilder from a given name
      abstract void writeDocumentEntry​(java.lang.String[] data)
      Write out metadata for current document.
      abstract void writeDocumentEntry​(java.util.Map<java.lang.String,​java.lang.String> data)
      Write out metadata for current document, extracted from specified map Typically, the MetaIndexBuilder will know which keys from data that it is interested in.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.io.Closeable

        close
    • Constructor Detail

      • MetaIndexBuilder

        public MetaIndexBuilder()
    • Method Detail

      • writeDocumentEntry

        public abstract void writeDocumentEntry​(java.util.Map<java.lang.String,​java.lang.String> data)
                                         throws java.io.IOException
        Write out metadata for current document, extracted from specified map Typically, the MetaIndexBuilder will know which keys from data that it is interested in.
        Throws:
        java.io.IOException
      • writeDocumentEntry

        public abstract void writeDocumentEntry​(java.lang.String[] data)
                                         throws java.io.IOException
        Write out metadata for current document. Values for all keys are specified.
        Throws:
        java.io.IOException
      • create

        public static MetaIndexBuilder create​(java.lang.String metaBuilderName,
                                              IndexOnDisk index,
                                              java.lang.String[] forwardMetaKeys,
                                              int[] metaKeyLengths,
                                              java.lang.String[] reverseMetaKeys)
        Factory method - create a MetaIndexBuilder from a given name