Search.Builder Class
A builder for constructing Search instances.
Rather than having to manually construct the options and instantiating a Search directly, this builder may be used.
var search = new Search.Builder()
.withIndexName(myIndex)
.withQuery(myQuery)
.withNumRows(10)
.withCallback(myCallback)
.build();
Constructor
Search.Builder
()
Item Index
Methods
convertDocuments
-
convert
Convert values in documents returned by Solr to corresponding Javascript types.
Parameters:
-
convert
BooleanSolr document values to JS types.
withCallback
-
callback
Set the callback to be executed when the operation completes.
Parameters:
-
callback
FunctionThe callback to execute when the comman completes.
-
err
Stringan error message. Will be null if no error.
-
response
Objectthe response from Riak (Solr)
-
numFound
NumberThe number of documents found. -
maxScore
NumberThe max score value. -
docs
ObjectArray of documents returned from Solr.
-
-
withDefaultField
-
fieldName
Use the provided field as the default. Overrides the “default_field” setting in the schema file.
Parameters:
-
fieldName
Stringthe name of the field.
withDefaultOperation
-
op
Set the default operation. Allowed settings are either “and” or “or”. Overrides the “default_op” setting in the schema file.
Parameters:
-
op
StringA string containing either "and" or "or".
withFilterQuery
-
filterQuery
Filters the search by an additional query scoped to inline fields.
Parameters:
-
filterQuery
Stringthe filter query.
withIndexName
-
indexName
Set the index name used for this search.
Parameters:
-
indexName
Stringthe name of the yokozuna index
withNumRows
-
maxRows
Specify the maximum number of results to return. Riak defaults to 10 if this is not set.
Parameters:
-
maxRows
Numberthe maximum number of results to return.
withPresort
-
presort
Sorts all of the results by bucket key, or the search score, before the given rows are chosen. This is useful when paginating to ensure the results are returned in a consistent order.
Parameters:
-
presort
Stringa string containing either "key" or "score".
withQuery
-
queryString
Set the Solr query string. All distributed Solr queries are supported, which actually includes most of the single-node Solr queries.
Parameters:
-
queryString
Stringthe query
withReturnFields
-
fields
Only return the provided fields. Filters the results to only contain the provided fields.
Parameters:
-
fields
Stringan array of field names.
withSortField
-
sortField
Sort the results on the specified field name. Default is “none”, which causes the results to be sorted in descending order by score.
Parameters:
-
sortField
Stringthe fieldname to sort the results on.
withStart
-
start
Specify the starting result of the query. Useful for pagination. The default is 0.
Parameters:
-
start
Numberthe index of the starting result.