public class BruteSearch extends UpdatableSearcher
distanceMeasure
Constructor and Description |
---|
BruteSearch(DistanceMeasure distanceMeasure) |
Modifier and Type | Method and Description |
---|---|
void |
add(Vector vector)
Add a new Vector to the Searcher that will be checked when getting
the nearest neighbors.
|
void |
clear() |
Iterator<Vector> |
iterator() |
boolean |
remove(Vector query,
double epsilon) |
List<List<WeightedThing<Vector>>> |
search(Iterable<WeightedVector> queries,
int limit,
int numThreads)
Searches with a list full of queries in a threaded fashion.
|
List<WeightedThing<Vector>> |
search(Vector query,
int limit)
Scans the list of reference vectors one at a time for @limit neighbors of
the query vector.
|
WeightedThing<Vector> |
searchFirst(Vector query,
boolean differentThanQuery)
Returns the closest vector to the query.
|
int |
size()
Returns the number of WeightedVectors being searched for nearest neighbors.
|
addAll, addAllMatrixSlices, addAllMatrixSlicesAsWeightedVectors, getCandidateQueue, getDistanceMeasure, search, searchFirst
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEach, spliterator
public BruteSearch(DistanceMeasure distanceMeasure)
public void add(Vector vector)
Searcher
public int size()
Searcher
public List<WeightedThing<Vector>> search(Vector query, int limit)
public WeightedThing<Vector> searchFirst(Vector query, boolean differentThanQuery)
searchFirst
in class Searcher
query
- the vector to search fordifferentThanQuery
- if true, returns the closest vector different than the query (this
only matters if the query is among the searched vectors), otherwise,
returns the closest vector to the query (even the same vector).public List<List<WeightedThing<Vector>>> search(Iterable<WeightedVector> queries, int limit, int numThreads) throws InterruptedException
queries
- The queries to search for.limit
- The number of results to return.numThreads
- Number of threads to use in searching.InterruptedException
public boolean remove(Vector query, double epsilon)
remove
in class UpdatableSearcher
public void clear()
clear
in class UpdatableSearcher
Copyright © 2008–2017 The Apache Software Foundation. All rights reserved.