response.js | |
bbop. | Generic BBOP handler for dealing with the gross parsing of responses from a GOlr server (whereas <golr_conf> deals with the reported configuration). |
Functions | |
response | Contructor for a GOlr query response object. |
raw | returns a pointer to the initial response object |
success | Simple return verification of sane response from server. |
callback_type | Return the callback type if it was specified in the query, otherwise return null. |
parameters | Get the parameter chunk--variable stuff we put in. |
parameter | Get the parameter chunk--variable stuff we put in. |
row_step | Returns the number of rows requested (integer). |
total_documents | Return the total number of documents found. |
start_document | Returns the start document for this response as an integer. |
end_document | Returns the end document for this response as an integer. |
packet | Return the packet number of the current response. |
paging_p | Whether or not paging is necessary with the given results set. |
paging_previous_p | Whether or paging backwards is an option right now. |
paging_next_p | Whether or paging forwards is an option right now. |
documents | Returns an array of raw and unprocessed document hashes. |
get_doc | Returns a specified document, in its raw hash form. |
get_doc_field | Returns the value(s) of the requested fields. |
get_doc_label | Tries to return a label for a document, field, and id combination. |
get_doc_highlight | Returns the highlighted value(s) of the requested fields. |
facet_field_list | Return a count sorted array of the response’s facet fields. |
facet_field | Return a count-sorted array of a facet field’s response. |
facet_counts | For a given facet field, return a hash of that field’s items and their counts. |
query | Return the raw query parameter “q”. |
query_filters | 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). |
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.
Functions | |
response | Contructor for a GOlr query response object. |
raw | returns a pointer to the initial response object |
success | Simple return verification of sane response from server. |
callback_type | Return the callback type if it was specified in the query, otherwise return null. |
parameters | Get the parameter chunk--variable stuff we put in. |
parameter | Get the parameter chunk--variable stuff we put in. |
row_step | Returns the number of rows requested (integer). |
total_documents | Return the total number of documents found. |
start_document | Returns the start document for this response as an integer. |
end_document | Returns the end document for this response as an integer. |
packet | Return the packet number of the current response. |
paging_p | Whether or not paging is necessary with the given results set. |
paging_previous_p | Whether or paging backwards is an option right now. |
paging_next_p | Whether or paging forwards is an option right now. |
documents | Returns an array of raw and unprocessed document hashes. |
get_doc | Returns a specified document, in its raw hash form. |
get_doc_field | Returns the value(s) of the requested fields. |
get_doc_label | Tries to return a label for a document, field, and id combination. |
get_doc_highlight | Returns the highlighted value(s) of the requested fields. |
facet_field_list | Return a count sorted array of the response’s facet fields. |
facet_field | Return a count-sorted array of a facet field’s response. |
facet_counts | For a given facet field, return a hash of that field’s items and their counts. |
query | Return the raw query parameter “q”. |
query_filters | 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). |
bbop.golr.response.prototype.get_doc_field = function( doc_id, field_id )
Returns the value(s) of the requested fields.
Remember that determining whether the returned value is a string or a list is left as an exercise for the reader when using this function.
doc_id | document identifier either an id (first) or place in the array |
field_id | the identifier of the field we’re trying to pull |
value or list of values
bbop.golr.response.prototype.get_doc_label = function( doc_id, field_id, item_id )
Tries to return a label for a document, field, and id combination.
WARNING: This function could be potentially slow on large datasets.
doc_id | document identifier either an id (first) or place in the array |
field_id | the identifier of the field we’re trying to pull |
item_id | [optional] the item identifier that we’re trying to resolve; if the field in question is a string or a single-valued list (as opposed to a multi-values list), this argument is not necessary, but it wouldn’t hurt either |
null (not found) or string
bbop.golr.response.prototype.get_doc_highlight = function( doc_id, field_id, item )
Returns the highlighted value(s) of the requested fields.
WARNING: This function is a work in progress and will not return multi-valued fields, just the first match it finds.
WARNING: This function could be potentially slow on large datasets.
doc_id | document id |
field_id | the identifier of the field we’re trying to pull |
item | the item that we’re looking for the highlighted HTML for |
string of highlight or null if nothing was found
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.
n/a
a hash of keyed hashes
Contructor for a GOlr query response object.
bbop.golr.response = function( json_data )
returns a pointer to the initial response object
bbop.golr.response.prototype.raw = function()
Simple return verification of sane response from server.
bbop.golr.response.prototype.success = function()
Return the callback type if it was specified in the query, otherwise return null.
bbop.golr.response.prototype.callback_type = function()
Get the parameter chunk--variable stuff we put in.
bbop.golr.response.prototype.parameters = function()
Get the parameter chunk--variable stuff we put in.
bbop.golr.response.prototype.parameter = function( key )
Returns the number of rows requested (integer).
bbop.golr.response.prototype.row_step = function()
Return the total number of documents found.
bbop.golr.response.prototype.total_documents = function()
Returns the start document for this response as an integer.
bbop.golr.response.prototype.start_document = function()
Returns the end document for this response as an integer.
bbop.golr.response.prototype.end_document = function()
Return the packet number of the current response.
bbop.golr.response.prototype.packet = function()
Whether or not paging is necessary with the given results set.
bbop.golr.response.prototype.paging_p = function()
Whether or paging backwards is an option right now.
bbop.golr.response.prototype.paging_previous_p = function()
Whether or paging forwards is an option right now.
bbop.golr.response.prototype.paging_next_p = function()
Returns an array of raw and unprocessed document hashes.
bbop.golr.response.prototype.documents = function()
Returns a specified document, in its raw hash form.
bbop.golr.response.prototype.get_doc = function( doc_id )
Returns the value(s) of the requested fields.
bbop.golr.response.prototype.get_doc_field = function( doc_id, field_id )
Tries to return a label for a document, field, and id combination.
bbop.golr.response.prototype.get_doc_label = function( doc_id, field_id, item_id )
Returns the highlighted value(s) of the requested fields.
bbop.golr.response.prototype.get_doc_highlight = function( doc_id, field_id, item )
Return a count sorted array of the response’s facet fields.
bbop.golr.response.prototype.facet_field_list = function()
Return a count-sorted array of a facet field’s response.
bbop.golr.response.prototype.facet_field = function( facet_name )
For a given facet field, return a hash of that field’s items and their counts.
bbop.golr.response.prototype.facet_counts = function()
Return the raw query parameter “q”.
bbop.golr.response.prototype.query = 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).
bbop.golr.response.prototype.query_filters = function()