org.apache.commons.scaffold.lucene
Class SearchUtils

java.lang.Object
  extended by org.apache.commons.scaffold.lucene.SearchUtils

public class SearchUtils
extends Object

General purpose utility methods related to Hits

Version:
$Revision: 155464 $ $Date: 2005-02-26 13:26:54 +0000 (Sat, 26 Feb 2005) $
Author:
Craig R. McClanahan, Ted Husted

Constructor Summary
SearchUtils()
           
 
Method Summary
static Collection getCollection(Object target, org.apache.lucene.search.Hits hits)
          Return a ArrayList of hits by looping and calling populate.
static void populate(Object bean, org.apache.lucene.document.Document document)
          Populate the properties of the specified JavaBean from the specified Lucene document, based on matching each parameter name against the corresponding JavaBeans "property setter" methods in the bean's class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SearchUtils

public SearchUtils()
Method Detail

populate

public static void populate(Object bean,
                            org.apache.lucene.document.Document document)
                     throws PopulateException
Populate the properties of the specified JavaBean from the specified Lucene document, based on matching each parameter name against the corresponding JavaBeans "property setter" methods in the bean's class. See BeanUtils.CopyProperites for more about automatic conversion between types.

Parameters:
bean - The JavaBean whose properties are to be set
document - The Lucene document whose parameters are to be used to populate bean properties
Throws:
PopulateException - if an exception is thrown while setting property values

getCollection

public static Collection getCollection(Object target,
                                       org.apache.lucene.search.Hits hits)
                                throws PopulateException
Return a ArrayList of hits by looping and calling populate. No assumptions are made about fields in document. Each is processed with a separate call to populate. Whatever fields in each document that match the target bean will be transferred.

Parameters:
hits - The Hits whose documents are to be used to populate bean properties
target - An instance of the bean to populate
Throws:
PopulateException - if an exception is thrown while setting property values, populating the bean, or accessing the Hits


Copyright © 2001-2010 The Apache Software Foundation. All Rights Reserved.