response.js

Summary
response.js
bbop.golr.responseGeneric BBOP handler for dealing with the gross parsing of responses from a GOlr server (whereas <golr_conf> deals with the reported configuration).
Functions
responseContructor for a GOlr query response object.
rawreturns a pointer to the initial response object
successSimple return verification of sane response from server.
callback_typeReturn the callback type if it was specified in the query, otherwise return null.
parametersGet the parameter chunk--variable stuff we put in.
parameterGet the parameter chunk--variable stuff we put in.
row_stepReturns the number of rows requested (integer).
total_documentsReturn the total number of documents found.
start_documentReturns the start document for this response as an integer.
end_documentReturns the end document for this response as an integer.
packetReturn the packet number of the current response.
paging_pWhether or not paging is necessary with the given results set.
paging_previous_pWhether or paging backwards is an option right now.
paging_next_pWhether or paging forwards is an option right now.
documentsReturns an array of raw and unprocessed document hashes.
get_docReturns a specified document.
get_doc_fieldReturns the value(s) of the requested fields.
get_doc_field_hlReturns the highlighted value(s) of the requested fields.
facet_field_listReturn a count sorted array of the response’s facet fields.
facet_fieldReturn a count-sorted array of a facet field’s response.
facet_countsFor a given facet field, return a hash of that field’s items and their counts.
queryReturn the raw query parameter “q”.
query_filtersA sensible handling of the not-so-great format of “fq” returned by Solr (fq can be irritating single value or irritating array, along with things like “-” in front of values).

bbop.golr.response

Generic BBOP handler for dealing with the gross parsing of responses from a GOlr server (whereas <golr_conf> deals with the reported configuration).  This is not intended to do anything like modeling the data in the store (<golr_manager>), but rather to deal with things like checking for success, what paging would look like, what parameters were passed, etc.

Summary
Functions
responseContructor for a GOlr query response object.
rawreturns a pointer to the initial response object
successSimple return verification of sane response from server.
callback_typeReturn the callback type if it was specified in the query, otherwise return null.
parametersGet the parameter chunk--variable stuff we put in.
parameterGet the parameter chunk--variable stuff we put in.
row_stepReturns the number of rows requested (integer).
total_documentsReturn the total number of documents found.
start_documentReturns the start document for this response as an integer.
end_documentReturns the end document for this response as an integer.
packetReturn the packet number of the current response.
paging_pWhether or not paging is necessary with the given results set.
paging_previous_pWhether or paging backwards is an option right now.
paging_next_pWhether or paging forwards is an option right now.
documentsReturns an array of raw and unprocessed document hashes.
get_docReturns a specified document.
get_doc_fieldReturns the value(s) of the requested fields.
get_doc_field_hlReturns the highlighted value(s) of the requested fields.
facet_field_listReturn a count sorted array of the response’s facet fields.
facet_fieldReturn a count-sorted array of a facet field’s response.
facet_countsFor a given facet field, return a hash of that field’s items and their counts.
queryReturn the raw query parameter “q”.
query_filtersA sensible handling of the not-so-great format of “fq” returned by Solr (fq can be irritating single value or irritating array, along with things like “-” in front of values).

Functions

response

bbop.golr.response = function(json_data)

Contructor for a GOlr query response object.

The constructor argument is an object, not a string.

Arguments

json_datathe JSON data (as object) returned from a request

Returns

golr response object

raw

bbop.golr.response.prototype.raw = function()

returns a pointer to the initial response object

Arguments

n/a

Returns

object

success

bbop.golr.response.prototype.success = function()

Simple return verification of sane response from server.

Success caches its return value.

Arguments

n/a

Returns

boolean

callback_type

bbop.golr.response.prototype.callback_type = function()

Return the callback type if it was specified in the query, otherwise return null.  For example “reset” and “response”.

Arguments

n/a

Returns

string (or null)

parameters

bbop.golr.response.prototype.parameters = function()

Get the parameter chunk--variable stuff we put in.

Pretty general, specialized functions are better.

Arguments

n/a

Returns

hash

parameter

bbop.golr.response.prototype.parameter = function(key)

Get the parameter chunk--variable stuff we put in.

Pretty general, specialized functions are better.

Arguments

n/a key - string id for the wanted parameter

Returns

hash, string, whatever is there at that key (otherwise null)

row_step

bbop.golr.response.prototype.row_step = function()

Returns the number of rows requested (integer).

Arguments

n/a

Returns

integer

total_documents

bbop.golr.response.prototype.total_documents = function()

Return the total number of documents found.

Arguments

n/a

Returns

integer

start_document

bbop.golr.response.prototype.start_document = function()

Returns the start document for this response as an integer.

Arguments

n/a

Returns

integer

end_document

bbop.golr.response.prototype.end_document = function()

Returns the end document for this response as an integer.

Arguments

n/a

Returns

integer

packet

bbop.golr.response.prototype.packet = function()

Return the packet number of the current response.

Arguments

n/a

Returns

integer or null (no packet defined)

paging_p

bbop.golr.response.prototype.paging_p = function()

Whether or not paging is necessary with the given results set.

Arguments

n/a

Returns

boolean

paging_previous_p

bbop.golr.response.prototype.paging_previous_p = function()

Whether or paging backwards is an option right now.

Arguments

n/a

Returns

boolean

paging_next_p

bbop.golr.response.prototype.paging_next_p = function()

Whether or paging forwards is an option right now.

Arguments

n/a

Returns

boolean

documents

bbop.golr.response.prototype.documents = function()

Returns an array of raw and unprocessed document hashes.

Arguments

n/a

Returns

hash

get_doc

bbop.golr.response.prototype.get_doc = function(doc_id)

Returns a specified document.

Arguments

doc_iddocument identifier either an id (first) or place in the array

Returns

document hash or null

get_doc_field

bbop.golr.response.prototype.get_doc_field = function(doc_id,
field_id)

Returns the value(s) of the requested fields.

Arguments

doc_iddocument identifier either an id (first) or place in the array
field_idthe identifier of the field we’re trying to pull

Returns

value or list of values

get_doc_field_hl

bbop.golr.response.prototype.get_doc_field_hl = function(doc_id,
field_id)

Returns the highlighted value(s) of the requested fields.

WARNING: This function is a work in progress and may not return multi-valued fields properly.  If you find an issues, please let the developers know.  This is currently returning

Arguments

doc_iddocument id
field_idthe identifier of the field we’re trying to pull

Returns

string or list of highlight, or null if nothing was found

facet_field_list

bbop.golr.response.prototype.facet_field_list = function()

Return a count sorted array of the response’s facet fields.

Arguments

n/a

Returns

list of strings

facet_field

bbop.golr.response.prototype.facet_field = function(facet_name)

Return a count-sorted array of a facet field’s response.

[["foo", 60], ...]

Arguments

n/a facet_name - name of the facet to examine

Returns

list of nested lists

facet_counts

bbop.golr.response.prototype.facet_counts = function()

For a given facet field, return a hash of that field’s items and their counts.

Arguments

n/a

Returns

hash of facets to their integer counts

query

bbop.golr.response.prototype.query = function()

Return the raw query parameter “q”.

Arguments

n/a

Returns

string or null

query_filters

bbop.golr.response.prototype.query_filters = function()

A sensible handling of the not-so-great format of “fq” returned by Solr (fq can be irritating single value or irritating array, along with things like “-” in front of values).  Since plus and minus filters are mutually exclusive, we have a return format like:

{field1: {filter1: (true|false), ...}, ...}

Where the true|false value represents a positive (true) or negative (false) filter.

Parameters

n/a

Returns

a hash of keyed hashes

bbop.golr.response = function(json_data)
Contructor for a GOlr query response object.
bbop.golr.response.prototype.raw = function()
returns a pointer to the initial response object
bbop.golr.response.prototype.success = function()
Simple return verification of sane response from server.
bbop.golr.response.prototype.callback_type = function()
Return the callback type if it was specified in the query, otherwise return null.
bbop.golr.response.prototype.parameters = function()
Get the parameter chunk--variable stuff we put in.
bbop.golr.response.prototype.parameter = function(key)
Get the parameter chunk--variable stuff we put in.
bbop.golr.response.prototype.row_step = function()
Returns the number of rows requested (integer).
bbop.golr.response.prototype.total_documents = function()
Return the total number of documents found.
bbop.golr.response.prototype.start_document = function()
Returns the start document for this response as an integer.
bbop.golr.response.prototype.end_document = function()
Returns the end document for this response as an integer.
bbop.golr.response.prototype.packet = function()
Return the packet number of the current response.
bbop.golr.response.prototype.paging_p = function()
Whether or not paging is necessary with the given results set.
bbop.golr.response.prototype.paging_previous_p = function()
Whether or paging backwards is an option right now.
bbop.golr.response.prototype.paging_next_p = function()
Whether or paging forwards is an option right now.
bbop.golr.response.prototype.documents = function()
Returns an array of raw and unprocessed document hashes.
bbop.golr.response.prototype.get_doc = function(doc_id)
Returns a specified document.
bbop.golr.response.prototype.get_doc_field = function(doc_id,
field_id)
Returns the value(s) of the requested fields.
bbop.golr.response.prototype.get_doc_field_hl = function(doc_id,
field_id)
Returns the highlighted value(s) of the requested fields.
bbop.golr.response.prototype.facet_field_list = function()
Return a count sorted array of the response’s facet fields.
bbop.golr.response.prototype.facet_field = function(facet_name)
Return a count-sorted array of a facet field’s response.
bbop.golr.response.prototype.facet_counts = function()
For a given facet field, return a hash of that field’s items and their counts.
bbop.golr.response.prototype.query = function()
Return the raw query parameter “q”.
bbop.golr.response.prototype.query_filters = function()
A sensible handling of the not-so-great format of “fq” returned by Solr (fq can be irritating single value or irritating array, along with things like “-” in front of values).
Close