de.pangaea.metadataportal.search
Class SearchResultList

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractList<SearchResultItem>
          extended by de.pangaea.metadataportal.search.SearchResultList
All Implemented Interfaces:
Iterable<SearchResultItem>, Collection<SearchResultItem>, List<SearchResultItem>

public class SearchResultList
extends AbstractList<SearchResultItem>

This class holds search result items. It is implemented with the List interface to make it usable like any other Java list (iterators,...).

Be warned: Iterating over this list is very slow. When trying to iterate over all search results use a search method of SearchService that notifies you on each result item using a SearchResultCollector instance.

Author:
Uwe Schindler

Field Summary
 
Fields inherited from class java.util.AbstractList
modCount
 
Constructor Summary
protected SearchResultList(LuceneCache.Session session, FieldSelector fields)
          For internal use only!
 
Method Summary
 SearchResultItem get(int index)
          Gets search result at the supplied index.
 long getQueryTime()
          Gets the duration of the query in milliseconds.
 SearchResultItem getResult(int index)
          Gets search result at the supplied index.
 int getResultCount()
          Returns the number of search results.
 int size()
          Returns the number of search results.
 
Methods inherited from class java.util.AbstractList
add, add, addAll, clear, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, removeRange, set, subList
 
Methods inherited from class java.util.AbstractCollection
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.List
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray
 

Constructor Detail

SearchResultList

protected SearchResultList(LuceneCache.Session session,
                           FieldSelector fields)
For internal use only!

Method Detail

get

public SearchResultItem get(int index)
Gets search result at the supplied index.

Specified by:
get in interface List<SearchResultItem>
Specified by:
get in class AbstractList<SearchResultItem>
Throws:
RuntimeException - wrapping an IOException. This is needed because the generic List interface does not allow us to throw exceptions.
See Also:
getResult(int)

size

public int size()
Returns the number of search results.

Specified by:
size in interface Collection<SearchResultItem>
Specified by:
size in interface List<SearchResultItem>
Specified by:
size in class AbstractCollection<SearchResultItem>
Throws:
RuntimeException - wrapping an IOException. This is needed because the generic List interface does not allow us to throw exceptions.

getResult

public SearchResultItem getResult(int index)
                           throws IOException
Gets search result at the supplied index. Use this method in not List-specific code because you can catch the IOException.

Throws:
IOException

getResultCount

public int getResultCount()
                   throws IOException
Returns the number of search results. Use this method in not List-specific code because you can catch the IOException.

Throws:
IOException

getQueryTime

public long getQueryTime()
                  throws IOException
Gets the duration of the query in milliseconds.

Throws:
IOException


Copyright ©2007-2013 panFMP Developers c/o Uwe Schindler