public class View extends Object
DesignDocument consisting of a
map function and optionally a reduce function.| Constructor and Description |
|---|
View(String name,
String map) |
View(String name,
String map,
String reduce)
Create a new view
|
| Modifier and Type | Method and Description |
|---|---|
QueryResult |
execute(Iterable<Item> items) |
QueryResult |
execute(Iterable<Item> items,
Configuration config)
Executes the view query with the given parameters see
executeRaw(Iterable, Configuration) |
String |
executeRaw(Iterable<Item> items,
Configuration config)
Executes the view query with the given parameters.
|
String |
getMapSource()
Gets the JavaScript source code for the map function
|
String |
getName()
Gets the name of the view
|
String |
getReduceSource()
Gets the JavaScript source code for the reduce function
|
public View(String name, String map) throws ScriptException
ScriptExceptionpublic View(@NotNull
String name,
@NotNull
String map,
@Nullable
String reduce)
throws ScriptException
name - The name of the viewmap - The JavaScript map function as a Stringreduce - The JavaScript reduce function, as a Stringorg.mozilla.javascript.EcmaError - if the map or reduce functions could not be parsedScriptExceptionpublic String getName()
public String getMapSource()
public String getReduceSource()
public QueryResult execute(Iterable<Item> items) throws QueryExecutionException
QueryExecutionExceptionpublic QueryResult execute(Iterable<Item> items, Configuration config) throws QueryExecutionException
executeRaw(Iterable, Configuration)items - The items in the bucket which should be processed via the viewconfig - The configuration for the view, acting as a filter on the items processedQueryExecutionException - If there was an error while processing the optionspublic String executeRaw(Iterable<Item> items, Configuration config) throws QueryExecutionException
items - The items to be indexedconfig - The configuration to use for filtersQueryExecutionException - If a query execution error occursCopyright © 2017. All rights reserved.