com.browseengine.bobo.api
Class BoboSubBrowser

java.lang.Object
  extended by org.apache.lucene.search.Searcher
      extended by org.apache.lucene.search.IndexSearcher
          extended by com.browseengine.bobo.search.BoboSearcher2
              extended by com.browseengine.bobo.api.BoboSubBrowser
All Implemented Interfaces:
Browsable, Closeable, org.apache.lucene.search.Searchable

public class BoboSubBrowser
extends BoboSearcher2
implements Browsable, Closeable

This class implements the browsing functionality.


Field Summary
 
Fields inherited from class com.browseengine.bobo.search.BoboSearcher2
_docStarts, _facetCollectors, _subReaders
 
Fields inherited from class org.apache.lucene.search.IndexSearcher
docStarts, subReaders
 
Constructor Summary
BoboSubBrowser(BoboIndexReader reader)
          Constructor.
 
Method Summary
 BrowseResult browse(BrowseRequest req)
          browses the index.
 void browse(BrowseRequest req, org.apache.lucene.search.Collector collector, Map<String,FacetAccessible> facetMap)
          browses the index.
 void browse(BrowseRequest req, org.apache.lucene.search.Collector collector, Map<String,FacetAccessible> facetMap, int start)
           
 void browse(BrowseRequest req, org.apache.lucene.search.Weight weight, org.apache.lucene.search.Collector collector, Map<String,FacetAccessible> facetMap, int start)
           
 void close()
           
 org.apache.lucene.document.Document doc(int docid)
           
 FacetHandler<?> getFacetHandler(String name)
          Gets a defined facet handler
 Map<String,FacetHandler<?>> getFacetHandlerMap()
           
 Set<String> getFacetNames()
          Gets a set of facet names
 String[] getFieldVal(int docid, String fieldname)
          Returns the field data for a given doc.
 BoboIndexReader getIndexReader()
           
 Object[] getRawFieldVal(int docid, String fieldname)
           
 Map<String,FacetHandler<?>> getRuntimeFacetHandlerMap()
           
 SortCollector getSortCollector(org.apache.lucene.search.SortField[] sort, org.apache.lucene.search.Query q, int offset, int count, boolean fetchStoredFields, boolean forceScoring, String groupBy)
           
 int numDocs()
           
 void setFacetHandler(FacetHandler<?> facetHandler)
          Sets runtime facet handler.
 
Methods inherited from class com.browseengine.bobo.search.BoboSearcher2
createFacetValidator, search, search, setFacetHitCollectorList
 
Methods inherited from class org.apache.lucene.search.IndexSearcher
doc, docFreq, explain, gatherSubReaders, maxDoc, rewrite, search, search, search, setDefaultFieldSortScoring
 
Methods inherited from class org.apache.lucene.search.Searcher
createWeight, docFreqs, explain, getSimilarity, search, search, search, search, search, setSimilarity
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.browseengine.bobo.api.Browsable
explain, getSimilarity, setSimilarity
 
Methods inherited from interface org.apache.lucene.search.Searchable
doc, docFreq, docFreqs, explain, maxDoc, rewrite, search, search, search
 

Constructor Detail

BoboSubBrowser

public BoboSubBrowser(BoboIndexReader reader)
Constructor.

Parameters:
reader - A bobo reader instance
Method Detail

getIndexReader

public BoboIndexReader getIndexReader()
Overrides:
getIndexReader in class org.apache.lucene.search.IndexSearcher

getRawFieldVal

public Object[] getRawFieldVal(int docid,
                               String fieldname)
                        throws IOException
Specified by:
getRawFieldVal in interface Browsable
Throws:
IOException

setFacetHandler

public void setFacetHandler(FacetHandler<?> facetHandler)
                     throws IOException
Sets runtime facet handler. If has the same name as a preload handler, for the duration of this browser, this one will be used.

Specified by:
setFacetHandler in interface Browsable
Parameters:
facetHandler - Runtime facet handler
Throws:
IOException

getFacetHandler

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

Specified by:
getFacetHandler in interface Browsable
Parameters:
name - facet name
Returns:
a facet handler

getFacetHandlerMap

public Map<String,FacetHandler<?>> getFacetHandlerMap()
Specified by:
getFacetHandlerMap in interface Browsable

getFacetNames

public Set<String> getFacetNames()
Gets a set of facet names

Specified by:
getFacetNames in interface Browsable
Returns:
set of facet names

browse

public void browse(BrowseRequest req,
                   org.apache.lucene.search.Collector collector,
                   Map<String,FacetAccessible> facetMap)
            throws BrowseException
browses the index.

Specified by:
browse in interface Browsable
Parameters:
req - browse request
collector - collector for the hits
facetMap - map to gather facet data
Throws:
BrowseException

browse

public void browse(BrowseRequest req,
                   org.apache.lucene.search.Collector collector,
                   Map<String,FacetAccessible> facetMap,
                   int start)
            throws BrowseException
Specified by:
browse in interface Browsable
Throws:
BrowseException

browse

public void browse(BrowseRequest req,
                   org.apache.lucene.search.Weight weight,
                   org.apache.lucene.search.Collector collector,
                   Map<String,FacetAccessible> facetMap,
                   int start)
            throws BrowseException
Specified by:
browse in interface Browsable
Throws:
BrowseException

getSortCollector

public SortCollector getSortCollector(org.apache.lucene.search.SortField[] sort,
                                      org.apache.lucene.search.Query q,
                                      int offset,
                                      int count,
                                      boolean fetchStoredFields,
                                      boolean forceScoring,
                                      String groupBy)
Specified by:
getSortCollector in interface Browsable

browse

public BrowseResult browse(BrowseRequest req)
                    throws BrowseException
browses the index.

Specified by:
browse in interface Browsable
Parameters:
req - browse request
Returns:
browse result
Throws:
BrowseException

getRuntimeFacetHandlerMap

public Map<String,FacetHandler<?>> getRuntimeFacetHandlerMap()

numDocs

public int numDocs()
Specified by:
numDocs in interface Browsable

doc

public org.apache.lucene.document.Document doc(int docid)
                                        throws org.apache.lucene.index.CorruptIndexException,
                                               IOException
Specified by:
doc in interface org.apache.lucene.search.Searchable
Overrides:
doc in class org.apache.lucene.search.IndexSearcher
Throws:
org.apache.lucene.index.CorruptIndexException
IOException

getFieldVal

public String[] getFieldVal(int docid,
                            String fieldname)
                     throws IOException
Returns the field data for a given doc.

Specified by:
getFieldVal in interface Browsable
Parameters:
docid - doc
fieldname - name of the field
Returns:
field data
Throws:
IOException

close

public void close()
           throws IOException
Specified by:
close in interface Closeable
Specified by:
close in interface org.apache.lucene.search.Searchable
Overrides:
close in class org.apache.lucene.search.IndexSearcher
Throws:
IOException


Copyright © 2011. All Rights Reserved.