de::aitools::aq::invertedindex::core::Searcher< V extends Value > Class Reference

List of all members.

Public Member Functions

void close ()
boolean contains (String key)
Postlist.Head getHead (String key)
Properties getProperties ()
Postlist< V > search (String key)
Postlist< V > search (String key, int num)
Postlist< V > search (String key, int begin, int num)

Static Public Member Functions

static< VextendsValue >
Searcher< V > 
open (Class< V > clazz, Configuration config)

Protected Member Functions

void finalize () throws Throwable

Static Package Functions

 [static initializer]

Private Member Functions

 Searcher (Pointer nativeSearcher, Class< V > clazz, Properties props)
native void searcher_close (Pointer raw_searcher)
native boolean searcher_search_head (Pointer raw_searcher, String key, Postlist.Head head)
native Pointer searcher_search_postlist (Pointer raw_searcher, String key, int begin, int num, Postlist.Head header)

Static Private Member Functions

static native Pointer searcher_open (int type_id, ConfigurationImpl config, PropertiesImpl props)

Private Attributes

Pointer nativeSearcher
Properties props
Class< V > clazz

Detailed Description

A class to search an inverted index instance.

Author:
martin.trenkmann@uni-weimar.de
Version:
Id
Searcher.java,v 1.3 2011/04/18 19:57:36 trenkman Exp

Definition at line 20 of file Searcher.java.


Constructor & Destructor Documentation

de::aitools::aq::invertedindex::core::Searcher< V extends Value >::Searcher ( Pointer  nativeSearcher,
Class< V >  clazz,
Properties  props 
) [inline, private]

Initializes this searcher instance with a JNA Pointer, that references the native equivalent, the class object of the index' value type, and the index' properties.

Definition at line 58 of file Searcher.java.


Member Function Documentation

de::aitools::aq::invertedindex::core::Searcher< V extends Value >::[static initializer] (  )  [inline, static, package]
void de::aitools::aq::invertedindex::core::Searcher< V extends Value >::close (  )  [inline]

Closes the searcher. Call this method in some cleanup code to cleanly shutdown and to delete the native searcher. The searcher is then not usable anymore.

Definition at line 70 of file Searcher.java.

boolean de::aitools::aq::invertedindex::core::Searcher< V extends Value >::contains ( String  key  )  [inline]

Convenience method to check, if the index contains some mapping for the given key. Do not use this method, if you are going to lookup the Postlist, if such a mapping exists. For that reasons try to directly search the postlist and skip if empty.

Parameters:
key the key to check for, if some mapping exist
Returns:
true if some mapping for the given key exist, false otherwise
See also:
getHead(String)
search(String)
search(String, int)
search(String, int, int)

Definition at line 89 of file Searcher.java.

void de::aitools::aq::invertedindex::core::Searcher< V extends Value >::finalize (  )  throws Throwable [inline, protected]

Definition at line 94 of file Searcher.java.

Postlist.Head de::aitools::aq::invertedindex::core::Searcher< V extends Value >::getHead ( String  key  )  [inline]

Convenience method to search the Head of some Postlist if only interested in that meta-data. Do not use this method, if you are going to lookup the entire postlist afterwards. For that reasons try to directly search the postlist and skip if empty.

Parameters:
key the key of the postlist to lookup the head for
Returns:
the Head or
 null 
if the key is unknown
See also:
search(String)
search(String, int)
search(String, int, int)

Definition at line 112 of file Searcher.java.

Properties de::aitools::aq::invertedindex::core::Searcher< V extends Value >::getProperties (  )  [inline]

Returns the Properties of the underlying index.

Returns:
the Properties of this index

Definition at line 125 of file Searcher.java.

static <VextendsValue> Searcher<V> de::aitools::aq::invertedindex::core::Searcher< V extends Value >::open ( Class< V >  clazz,
Configuration  config 
) [inline, static]

Opens and returns an index instance located in Configuration#getIndexDirectory(). The instantiation of the native equivalent will fail, if the the given class of the index' value type does not match the type of the index on disk.

Parameters:
<V> the value type, which is some derivative of Value.
clazz the class object of the index' value type
config the configuration of the index to load. Only parameters Configuration#getIndexDirectory() and Configuration#getMaxMemoryUsage() will be evaluated.
Returns:
a ready to use index searcher

Definition at line 42 of file Searcher.java.

References de::aitools::aq::invertedindex::core::Properties::impl, and de::aitools::aq::invertedindex::core::Configuration::impl.

Postlist<V> de::aitools::aq::invertedindex::core::Searcher< V extends Value >::search ( String  key,
int  begin,
int  num 
) [inline]

Returns a iterable Postlist for the given key. The postlist will be loaded from the index specified by begin with at most the num following elements from that position. The corresponding range is [begin, begin + num). If begin is not a valid index the returned postlist will be empty.

Parameters:
key the key to search the inverted index for
begin the index of the first postlist element to load
num the maximal number of postlist elements to load
Returns:
a Postlist instance, or
 null 
for unknown keys
See also:
search(String)
search(String, int)

Definition at line 174 of file Searcher.java.

Postlist<V> de::aitools::aq::invertedindex::core::Searcher< V extends Value >::search ( String  key,
int  num 
) [inline]

Returns a iterable Postlist for the given key. The postlist will be truncated at the end to contain at most the first num elements. The corresponding range is [0, num). Use this method to efficiently lookup the wanted top-k entries.

Parameters:
key the key to search the inverted index for
num the maximal number of postlist elements to load
Returns:
a Postlist instance, or
 null 
for unknown keys
See also:
search(String)
search(String, int, int)

Definition at line 155 of file Searcher.java.

Postlist<V> de::aitools::aq::invertedindex::core::Searcher< V extends Value >::search ( String  key  )  [inline]

Returns a iterable Postlist for the given key.

Parameters:
key the key to search the inverted index for
Returns:
a Postlist instance, or
 null 
for unknown keys
See also:
search(String, int)
search(String, int, int)

Definition at line 138 of file Searcher.java.

native void de::aitools::aq::invertedindex::core::Searcher< V extends Value >::searcher_close ( Pointer  raw_searcher  )  [private]
static native Pointer de::aitools::aq::invertedindex::core::Searcher< V extends Value >::searcher_open ( int  type_id,
ConfigurationImpl  config,
PropertiesImpl  props 
) [static, private]
native boolean de::aitools::aq::invertedindex::core::Searcher< V extends Value >::searcher_search_head ( Pointer  raw_searcher,
String  key,
Postlist.Head  head 
) [private]
native Pointer de::aitools::aq::invertedindex::core::Searcher< V extends Value >::searcher_search_postlist ( Pointer  raw_searcher,
String  key,
int  begin,
int  num,
Postlist.Head  header 
) [private]

Member Data Documentation

Class<V> de::aitools::aq::invertedindex::core::Searcher< V extends Value >::clazz [private]

Definition at line 186 of file Searcher.java.

Pointer de::aitools::aq::invertedindex::core::Searcher< V extends Value >::nativeSearcher [private]

Definition at line 184 of file Searcher.java.

Properties de::aitools::aq::invertedindex::core::Searcher< V extends Value >::props [private]

Definition at line 185 of file Searcher.java.


The documentation for this class was generated from the following file:
Generated on Wed May 30 15:07:46 2012 by  doxygen 1.6.3