com.browseengine.bobo.api
Class BoboIndexReader

java.lang.Object
  extended by org.apache.lucene.index.IndexReader
      extended by org.apache.lucene.index.FilterIndexReader
          extended by com.browseengine.bobo.api.BoboIndexReader
All Implemented Interfaces:
Closeable, Cloneable

public class BoboIndexReader
extends org.apache.lucene.index.FilterIndexReader

bobo browse index reader


Nested Class Summary
static class BoboIndexReader.WorkArea
          Work area for loading
 
Nested classes/interfaces inherited from class org.apache.lucene.index.FilterIndexReader
org.apache.lucene.index.FilterIndexReader.FilterTermDocs, org.apache.lucene.index.FilterIndexReader.FilterTermEnum, org.apache.lucene.index.FilterIndexReader.FilterTermPositions
 
Nested classes/interfaces inherited from class org.apache.lucene.index.IndexReader
org.apache.lucene.index.IndexReader.FieldOption
 
Field Summary
protected  Map<String,FacetHandler<?>> _facetHandlerMap
           
protected  Collection<FacetHandler<?>> _facetHandlers
           
protected  Collection<RuntimeFacetHandlerFactory<?,?>> _runtimeFacetHandlerFactories
           
protected  Map<String,RuntimeFacetHandlerFactory<?,?>> _runtimeFacetHandlerFactoryMap
           
protected  org.apache.lucene.index.IndexReader _srcReader
           
protected  int[] _starts
           
protected  BoboIndexReader[] _subReaders
           
protected  BoboIndexReader.WorkArea _workArea
           
 
Fields inherited from class org.apache.lucene.index.FilterIndexReader
in
 
Fields inherited from class org.apache.lucene.index.IndexReader
hasChanges
 
Constructor Summary
protected BoboIndexReader(org.apache.lucene.index.IndexReader reader, Collection<FacetHandler<?>> facetHandlers, Collection<RuntimeFacetHandlerFactory<?,?>> facetHandlerFactories, BoboIndexReader.WorkArea workArea)
           
protected BoboIndexReader(org.apache.lucene.index.IndexReader reader, Collection<FacetHandler<?>> facetHandlers, Collection<RuntimeFacetHandlerFactory<?,?>> facetHandlerFactories, BoboIndexReader.WorkArea workArea, boolean useSubReaders)
           
 
Method Summary
 void clearRuntimeFacetData()
           
 BoboIndexReader copy(org.apache.lucene.index.IndexReader in)
           
 org.apache.lucene.store.Directory directory()
           
protected  void doClose()
           
protected  void doCommit(Map commitUserData)
           
 org.apache.lucene.document.Document document(int docid)
           
protected  void doDelete(int n)
           
 void dumpFields(File outFile)
          Utility method to dump out all fields (name and terms) for a given index.
protected  void facetInit()
           
protected  void facetInit(Set<String> toBeRemoved)
           
 Object getFacetData(String name)
           
 FacetHandler<?> getFacetHandler(String fieldname)
          Gets a facet handler
 Map<String,FacetHandler<?>> getFacetHandlerMap()
          Gets the facet handler map
 Set<String> getFacetNames()
          Gets all the facet field names
 org.apache.lucene.search.Query getFastMatchAllDocsQuery()
          Deprecated. use MatchAllDocsQuery instead.
 org.apache.lucene.index.IndexReader getInnerReader()
           
static BoboIndexReader getInstance(org.apache.lucene.index.IndexReader reader)
          Constructor
static BoboIndexReader getInstance(org.apache.lucene.index.IndexReader reader, BoboIndexReader.WorkArea workArea)
           
static BoboIndexReader getInstance(org.apache.lucene.index.IndexReader reader, Collection<FacetHandler<?>> facetHandlers)
           
static BoboIndexReader getInstance(org.apache.lucene.index.IndexReader reader, Collection<FacetHandler<?>> facetHandlers, Collection<RuntimeFacetHandlerFactory<?,?>> facetHandlerFactories)
          Constructor.
static BoboIndexReader getInstance(org.apache.lucene.index.IndexReader reader, Collection<FacetHandler<?>> facetHandlers, Collection<RuntimeFacetHandlerFactory<?,?>> facetHandlerFactories, BoboIndexReader.WorkArea workArea)
           
static BoboIndexReader getInstanceAsSubReader(org.apache.lucene.index.IndexReader reader)
           
static BoboIndexReader getInstanceAsSubReader(org.apache.lucene.index.IndexReader reader, Collection<FacetHandler<?>> facetHandlers, Collection<RuntimeFacetHandlerFactory<?,?>> facetHandlerFactories)
           
static BoboIndexReader getInstanceAsSubReader(org.apache.lucene.index.IndexReader reader, Collection<FacetHandler<?>> facetHandlers, Collection<RuntimeFacetHandlerFactory<?,?>> facetHandlerFactories, BoboIndexReader.WorkArea workArea)
           
 Object getRuntimeFacetData(String name)
           
 Map<String,RuntimeFacetHandlerFactory<?,?>> getRuntimeFacetHandlerFactoryMap()
           
 org.apache.lucene.index.IndexReader[] getSequentialSubReaders()
           
 long getVersion()
           
protected  void initialize(Collection<FacetHandler<?>> facetHandlers)
           
 Object putFacetData(String name, Object data)
           
 Object putRuntimeFacetData(String name, Object data)
           
 org.apache.lucene.index.IndexReader reopen()
           
 org.apache.lucene.index.IndexReader reopen(boolean openReadOnly)
           
 void rewrap(org.apache.lucene.index.IndexReader in)
           
protected  void setFacetHandlers(Collection<FacetHandler<?>> facetHandlers)
           
 
Methods inherited from class org.apache.lucene.index.FilterIndexReader
docFreq, document, doSetNorm, doUndeleteAll, getDeletesCacheKey, getFieldCacheKey, getFieldNames, getTermFreqVector, getTermFreqVector, getTermFreqVector, getTermFreqVectors, hasDeletions, hasNorms, isCurrent, isDeleted, isOptimized, maxDoc, norms, norms, numDocs, termDocs, termDocs, termPositions, terms, terms
 
Methods inherited from class org.apache.lucene.index.IndexReader
acquireWriteLock, clone, clone, close, commit, commit, decRef, deleteDocument, deleteDocuments, ensureOpen, flush, flush, getCommitUserData, getCommitUserData, getCurrentVersion, getIndexCommit, getRefCount, getTermInfosIndexDivisor, getUniqueTermCount, incRef, indexExists, lastModified, listCommits, main, numDeletedDocs, open, open, open, open, open, open, open, reopen, setNorm, setNorm, termPositions, undeleteAll
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

_facetHandlerMap

protected Map<String,FacetHandler<?>> _facetHandlerMap

_facetHandlers

protected Collection<FacetHandler<?>> _facetHandlers

_runtimeFacetHandlerFactories

protected Collection<RuntimeFacetHandlerFactory<?,?>> _runtimeFacetHandlerFactories

_runtimeFacetHandlerFactoryMap

protected Map<String,RuntimeFacetHandlerFactory<?,?>> _runtimeFacetHandlerFactoryMap

_workArea

protected BoboIndexReader.WorkArea _workArea

_srcReader

protected org.apache.lucene.index.IndexReader _srcReader

_subReaders

protected BoboIndexReader[] _subReaders

_starts

protected int[] _starts
Constructor Detail

BoboIndexReader

protected BoboIndexReader(org.apache.lucene.index.IndexReader reader,
                          Collection<FacetHandler<?>> facetHandlers,
                          Collection<RuntimeFacetHandlerFactory<?,?>> facetHandlerFactories,
                          BoboIndexReader.WorkArea workArea)
                   throws IOException
Parameters:
reader -
facetHandlers -
facetHandlerFactories -
workArea -
Throws:
IOException

BoboIndexReader

protected BoboIndexReader(org.apache.lucene.index.IndexReader reader,
                          Collection<FacetHandler<?>> facetHandlers,
                          Collection<RuntimeFacetHandlerFactory<?,?>> facetHandlerFactories,
                          BoboIndexReader.WorkArea workArea,
                          boolean useSubReaders)
                   throws IOException
Parameters:
reader -
facetHandlers -
facetHandlerFactories -
workArea -
useSubReaders - true => we create a MultiReader of all the leaf sub-readers as the inner reader. false => we use the given reader as the inner reader.
Throws:
IOException
Method Detail

getInstance

public static BoboIndexReader getInstance(org.apache.lucene.index.IndexReader reader)
                                   throws IOException
Constructor

Parameters:
reader - Index reader
Throws:
IOException

getInstance

public static BoboIndexReader getInstance(org.apache.lucene.index.IndexReader reader,
                                          BoboIndexReader.WorkArea workArea)
                                   throws IOException
Throws:
IOException

getInstance

public static BoboIndexReader getInstance(org.apache.lucene.index.IndexReader reader,
                                          Collection<FacetHandler<?>> facetHandlers,
                                          Collection<RuntimeFacetHandlerFactory<?,?>> facetHandlerFactories)
                                   throws IOException
Constructor.

Parameters:
reader - index reader
facetHandlers - List of facet handlers
Throws:
IOException

getInstance

public static BoboIndexReader getInstance(org.apache.lucene.index.IndexReader reader,
                                          Collection<FacetHandler<?>> facetHandlers)
                                   throws IOException
Throws:
IOException

getInstance

public static BoboIndexReader getInstance(org.apache.lucene.index.IndexReader reader,
                                          Collection<FacetHandler<?>> facetHandlers,
                                          Collection<RuntimeFacetHandlerFactory<?,?>> facetHandlerFactories,
                                          BoboIndexReader.WorkArea workArea)
                                   throws IOException
Throws:
IOException

getInstanceAsSubReader

public static BoboIndexReader getInstanceAsSubReader(org.apache.lucene.index.IndexReader reader)
                                              throws IOException
Throws:
IOException

getInstanceAsSubReader

public static BoboIndexReader getInstanceAsSubReader(org.apache.lucene.index.IndexReader reader,
                                                     Collection<FacetHandler<?>> facetHandlers,
                                                     Collection<RuntimeFacetHandlerFactory<?,?>> facetHandlerFactories)
                                              throws IOException
Throws:
IOException

getInstanceAsSubReader

public static BoboIndexReader getInstanceAsSubReader(org.apache.lucene.index.IndexReader reader,
                                                     Collection<FacetHandler<?>> facetHandlers,
                                                     Collection<RuntimeFacetHandlerFactory<?,?>> facetHandlerFactories,
                                                     BoboIndexReader.WorkArea workArea)
                                              throws IOException
Throws:
IOException

getVersion

public long getVersion()
Overrides:
getVersion in class org.apache.lucene.index.FilterIndexReader

getInnerReader

public org.apache.lucene.index.IndexReader getInnerReader()

reopen

public org.apache.lucene.index.IndexReader reopen()
                                           throws org.apache.lucene.index.CorruptIndexException,
                                                  IOException
Overrides:
reopen in class org.apache.lucene.index.IndexReader
Throws:
org.apache.lucene.index.CorruptIndexException
IOException

reopen

public org.apache.lucene.index.IndexReader reopen(boolean openReadOnly)
                                           throws org.apache.lucene.index.CorruptIndexException,
                                                  IOException
Overrides:
reopen in class org.apache.lucene.index.IndexReader
Throws:
org.apache.lucene.index.CorruptIndexException
IOException

getFacetData

public Object getFacetData(String name)

putFacetData

public Object putFacetData(String name,
                           Object data)

getRuntimeFacetData

public Object getRuntimeFacetData(String name)

putRuntimeFacetData

public Object putRuntimeFacetData(String name,
                                  Object data)

clearRuntimeFacetData

public void clearRuntimeFacetData()

doClose

protected void doClose()
                throws IOException
Overrides:
doClose in class org.apache.lucene.index.FilterIndexReader
Throws:
IOException

doCommit

protected void doCommit(Map commitUserData)
                 throws IOException
Overrides:
doCommit in class org.apache.lucene.index.FilterIndexReader
Throws:
IOException

doDelete

protected void doDelete(int n)
                 throws org.apache.lucene.index.CorruptIndexException,
                        IOException
Overrides:
doDelete in class org.apache.lucene.index.FilterIndexReader
Throws:
org.apache.lucene.index.CorruptIndexException
IOException

directory

public org.apache.lucene.store.Directory directory()
Overrides:
directory in class org.apache.lucene.index.FilterIndexReader

initialize

protected void initialize(Collection<FacetHandler<?>> facetHandlers)
                   throws IOException
Throws:
IOException

facetInit

protected void facetInit()
                  throws IOException
Throws:
IOException

facetInit

protected void facetInit(Set<String> toBeRemoved)
                  throws IOException
Throws:
IOException

setFacetHandlers

protected void setFacetHandlers(Collection<FacetHandler<?>> facetHandlers)

getFastMatchAllDocsQuery

public org.apache.lucene.search.Query getFastMatchAllDocsQuery()
Deprecated. use MatchAllDocsQuery instead.

Returns:
query that matches all docs in the index

dumpFields

public void dumpFields(File outFile)
                throws IOException
Utility method to dump out all fields (name and terms) for a given index.

Parameters:
outFile - File to dump to.
Throws:
IOException

getFacetNames

public Set<String> getFacetNames()
Gets all the facet field names

Returns:
Set of facet field names

getFacetHandler

public FacetHandler<?> getFacetHandler(String fieldname)
Gets a facet handler

Parameters:
fieldname - name
Returns:
facet handler

getSequentialSubReaders

public org.apache.lucene.index.IndexReader[] getSequentialSubReaders()
Overrides:
getSequentialSubReaders in class org.apache.lucene.index.FilterIndexReader

getFacetHandlerMap

public Map<String,FacetHandler<?>> getFacetHandlerMap()
Gets the facet handler map

Returns:
facet handler map

getRuntimeFacetHandlerFactoryMap

public Map<String,RuntimeFacetHandlerFactory<?,?>> getRuntimeFacetHandlerFactoryMap()
Returns:
the map of RuntimeFacetHandlerFactories

rewrap

public void rewrap(org.apache.lucene.index.IndexReader in)

document

public org.apache.lucene.document.Document document(int docid)
                                             throws IOException
Overrides:
document in class org.apache.lucene.index.IndexReader
Throws:
IOException

copy

public BoboIndexReader copy(org.apache.lucene.index.IndexReader in)


Copyright © 2011. All Rights Reserved.