ccc.plugins.search.lucene
Class CapturingHandler

java.lang.Object
  extended by ccc.plugins.search.lucene.CapturingHandler

public class CapturingHandler
extends java.lang.Object

Captures the results of a Lucene search into memory.

Author:
Civic Computing Ltd.

Constructor Summary
CapturingHandler(int noOfResultsPerPage, int pageNo)
          Constructor.
 
Method Summary
 java.util.Set<java.util.UUID> getHits()
          Accessor.
 int getTotalResultsCount()
          Accessor.
 void handle(org.apache.lucene.search.IndexSearcher searcher, org.apache.lucene.search.TopDocs docs)
          Process the results of a search.
protected  java.util.UUID lookupResourceId(org.apache.lucene.search.IndexSearcher searcher, int docId)
          Determine the CCC resource id for a search hit.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CapturingHandler

public CapturingHandler(int noOfResultsPerPage,
                        int pageNo)
Constructor.

Parameters:
noOfResultsPerPage - The number of results on a page.
pageNo - The page of results to capture.
Method Detail

handle

public void handle(org.apache.lucene.search.IndexSearcher searcher,
                   org.apache.lucene.search.TopDocs docs)
            throws java.io.IOException
Process the results of a search.

Parameters:
searcher - The lucene index searcher used for the search.
docs - The results from the search.
Throws:
java.io.IOException - If an error occurs accessing the index.

lookupResourceId

protected java.util.UUID lookupResourceId(org.apache.lucene.search.IndexSearcher searcher,
                                          int docId)
                                   throws java.io.IOException
Determine the CCC resource id for a search hit.

Parameters:
searcher - The lucene index searcher.
docId - The lucene document id.
Returns:
The CCC resource id.
Throws:
java.io.IOException - If an error occurs while reading the index.

getHits

public java.util.Set<java.util.UUID> getHits()
Accessor.

Returns:
The current hits for this capturing handler.

getTotalResultsCount

public int getTotalResultsCount()
Accessor.

Returns:
The current number of results found by this capturing handler.


Copyright © 2010. All Rights Reserved.