|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.aitools.aq.invertedindex.core.Searcher<V>
public class Searcher<V extends Value>
A class to search an inverted index instance.
Method Summary | ||
---|---|---|
void |
close()
Closes the searcher. |
|
boolean |
contains(java.lang.String key)
Convenience method to check, if the index contains some mapping for the given key. |
|
Postlist.Head |
getHead(java.lang.String key)
Convenience method to search the Postlist.Head of some Postlist
if only interested in that meta-data. |
|
Properties |
getProperties()
Returns the Properties of the underlying index. |
|
static
|
open(java.lang.Class<V> clazz,
Configuration config)
Opens and returns an index instance located in Configuration.getIndexDirectory() . |
|
Postlist<V> |
search(java.lang.String key)
Returns a iterable Postlist for the given key. |
|
Postlist<V> |
search(java.lang.String key,
int num)
Returns a iterable Postlist for the given key. |
|
Postlist<V> |
search(java.lang.String key,
int begin,
int num)
Returns a iterable Postlist for the given key. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
public static <V extends Value> Searcher<V> open(java.lang.Class<V> clazz, Configuration config)
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.
V
- the value type, which is some derivative of Value
.clazz
- the class object of the index' value typeconfig
- the configuration of the index to load. Only parameters
Configuration.getIndexDirectory()
and
Configuration.getMaxMemoryUsage()
will be evaluated.
public void close()
public boolean contains(java.lang.String key)
Postlist
, if such a mapping exists. For that reasons try to
directly search the postlist and skip if empty.
key
- the key to check for, if some mapping exist
getHead(String)
,
search(String)
,
search(String, int)
,
search(String, int, int)
public Postlist.Head getHead(java.lang.String key)
Postlist.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.
key
- the key of the postlist to lookup the head for
Postlist.Head
or null
if the key is unknownsearch(String)
,
search(String, int)
,
search(String, int, int)
public Properties getProperties()
Properties
of the underlying index.
Properties
of this indexpublic Postlist<V> search(java.lang.String key)
Postlist
for the given key.
key
- the key to search the inverted index for
Postlist
instance, or null
for unknown keyssearch(String, int)
,
search(String, int, int)
public Postlist<V> search(java.lang.String key, int num)
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.
key
- the key to search the inverted index fornum
- the maximal number of postlist elements to load
Postlist
instance, or null
for unknown keyssearch(String)
,
search(String, int, int)
public Postlist<V> search(java.lang.String key, int begin, int num)
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.
key
- the key to search the inverted index forbegin
- the index of the first postlist element to loadnum
- the maximal number of postlist elements to load
Postlist
instance, or null
for unknown keyssearch(String)
,
search(String, int)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |