manager.js

Summary
manager.js
bbop.golr.managerGeneric BBOP manager for dealing with gross GOlr configuration and management.
Functions
managerContructor for the GOlr query manager
debugTurn on or off the verbose messages.
liteLimit the returns fields (the parameter “fl”) to the ones defined in the set of fields defined in results, label fields if available (i.e.
get_facet_limitGet the limit for a specified facet or the global limit.
set_facet_limitChange the number of facet values returned per call.
set_default_facet_limitPermanently change the default number of facet values returned per call.
reset_facet_limitEither reset the global limit to the original (likely 25) and/or remove the specified filter.
get_results_countGet the current number of results that will be returned.
set_results_countChange the number of result documents returned per call.
reset_results_countReset the number of documents to their original setting, likely 10.
plist_to_property_hashTurn a plist to a hash containing the different properties that can be defined for a query filter.
add_query_filter_as_stringSetter for query filters (‘fq’).
add_query_filterSetter for query filters (‘fq’).
remove_query_filterRemover for query filters (‘fq’), is a plist is specified, it will only remove if all of the listed criteria are met.
reset_query_filtersReset the query filters (‘fq’); but leave sticky filters alone.
get_query_filter_propertiesGet a hash representing a query filter (‘fq’).
get_query_filtersGet a list of hashes representing the query filters (‘fq’).
get_sticky_query_filtersGet a list of hashes representing the current stucky query filters (‘fq’).
filter_list_to_assemble_hashGet all of our query filter variables and try and make something of them that <get_assemble> can understand.
sensible_query_pSimply ask the manager if a free text query (‘q’) makes sense at this point.
last_packet_sentIt is up to the UI to do something interesting with this number.
clearClear all non-sticky query parameters to get back to a more “original” state.
resetManually trigger the “reset” chain of events.
searchTrigger the “search” chain of events.
pageRe-trigger the “search” chain of events, but with the variables set for a different section of the results.
page_firstCurrently a convenience alias for search.
page_previousThis is a wrapper for page and should be preferred over a direct call to page.
page_nextThis is a wrapper for page and should be preferred over a direct call to page.
page_lastTrigger search on last page parameters.
get_page_rowsReturn the number of rows the manager is currently set to.
get_page_startReturn the rows offset the manager is currently set to.
add_query_fieldAdd a new query field to the query.
query_field_setBulk getter/setter for the query fields--the fields that are searched (and by what weight) when using a query (‘q’ or set_query(), i.e.
facetsBulk getter/setter for facets (technically ‘facet.field’).
set_default_querySetter for the default query for the query variable (‘q’).
reset_default_queryReset the default query back to “:”.
set_querySetter for the query variable (‘q’).
set_comfy_queryIf the input is all alphanum or space, the input is tokenized.
set_idA limited setter, removing whatever else is on query.
set_idsLike set_id, a limited setter.
set_targetsLike a more generalized version of set_ids, a limited.
get_queryGetter for the query variable (‘q’).
get_default_queryGetter for what the query variable ‘q’ will be set to on a reset_query.
get_fundamental_queryGetter for what the query variable ‘q’ will be set to on a reset_default_query.
get_queryGetter for the query variable (‘q’).
reset_queryRemove/reset the query variable (‘q’); this set it back to the default query.
set_extraSetter for the internal string variable to be appended to the end of a query.
get_extraGetter for the internal string variable to be appended to the end of a query.
remove_extraRemove/reset the extra bit.
setSet an internal variable for the query.
getGet an internal variable for the query.
unsetUnset (remove) an internal variable for the query.
include_highlightingTurn hilighting on or off (with true or false).
set_personalityWhile we are always contacting the same Solr instance, we sometimes want to have different weights, facets, etc.
get_personalityReturns the current personality, null if none.
get_query_urlGet the current invariant state of the manager returned as a encoded URL string (using encodeURI()).
push_excursionSave the current state of the manager--data and sticky filter information--onto an internal stack.
pop_excursionReturn to a previously pushed state.
get_download_urlGet the current invariant state of the manager returned as a URL string.
get_filter_query_stringGet the current state of the manager, as defined by the current gross filter set--query, sticky filters, and standard filters-- returned as a URL query string (sans the ‘?’
get_state_urlGet the current invariant state of the manager, plus the current personality as a parameter, returned as a URL string.
load_urlMakes a a best attempt to recover the state of a manager from the clues left in a data url.
add_to_batch“Save” the current manager state to run later in serial batch mode.
batch_urlsReturn a pointer to the current batch urls.
next_batch_urlReturn the next data to be processed, removing it from the batch queue in the process.
reset_batchClear the currently queued data batch.
to_stringOutput writer for this object/class.
updateThe user code to select the type of update (and thus the type of callbacks to be called on data return).

bbop.golr.manager

Generic BBOP manager for dealing with gross GOlr configuration and management.  Remember, this is actually a “subclass” of bbop.registry.  The defined events for this registry are: “reset”, “search”, and “error”.

resetfunctions for initializing and resetting
searchfunctions for receiving standard search results
errorfunctions to call when something goes very wrong

Both bbop.golr.response (or clean error data) and the manager itself (this as anchor) should be passed to the callbacks.

TODO/BUG: set_query and set_default_query should both take strings or bbop.logic as arguments.  Those, as well as get_query and get_query should only return bbop.logic.

Summary
Functions
managerContructor for the GOlr query manager
debugTurn on or off the verbose messages.
liteLimit the returns fields (the parameter “fl”) to the ones defined in the set of fields defined in results, label fields if available (i.e.
get_facet_limitGet the limit for a specified facet or the global limit.
set_facet_limitChange the number of facet values returned per call.
set_default_facet_limitPermanently change the default number of facet values returned per call.
reset_facet_limitEither reset the global limit to the original (likely 25) and/or remove the specified filter.
get_results_countGet the current number of results that will be returned.
set_results_countChange the number of result documents returned per call.
reset_results_countReset the number of documents to their original setting, likely 10.
plist_to_property_hashTurn a plist to a hash containing the different properties that can be defined for a query filter.
add_query_filter_as_stringSetter for query filters (‘fq’).
add_query_filterSetter for query filters (‘fq’).
remove_query_filterRemover for query filters (‘fq’), is a plist is specified, it will only remove if all of the listed criteria are met.
reset_query_filtersReset the query filters (‘fq’); but leave sticky filters alone.
get_query_filter_propertiesGet a hash representing a query filter (‘fq’).
get_query_filtersGet a list of hashes representing the query filters (‘fq’).
get_sticky_query_filtersGet a list of hashes representing the current stucky query filters (‘fq’).
filter_list_to_assemble_hashGet all of our query filter variables and try and make something of them that <get_assemble> can understand.
sensible_query_pSimply ask the manager if a free text query (‘q’) makes sense at this point.
last_packet_sentIt is up to the UI to do something interesting with this number.
clearClear all non-sticky query parameters to get back to a more “original” state.
resetManually trigger the “reset” chain of events.
searchTrigger the “search” chain of events.
pageRe-trigger the “search” chain of events, but with the variables set for a different section of the results.
page_firstCurrently a convenience alias for search.
page_previousThis is a wrapper for page and should be preferred over a direct call to page.
page_nextThis is a wrapper for page and should be preferred over a direct call to page.
page_lastTrigger search on last page parameters.
get_page_rowsReturn the number of rows the manager is currently set to.
get_page_startReturn the rows offset the manager is currently set to.
add_query_fieldAdd a new query field to the query.
query_field_setBulk getter/setter for the query fields--the fields that are searched (and by what weight) when using a query (‘q’ or set_query(), i.e.
facetsBulk getter/setter for facets (technically ‘facet.field’).
set_default_querySetter for the default query for the query variable (‘q’).
reset_default_queryReset the default query back to “:”.
set_querySetter for the query variable (‘q’).
set_comfy_queryIf the input is all alphanum or space, the input is tokenized.
set_idA limited setter, removing whatever else is on query.
set_idsLike set_id, a limited setter.
set_targetsLike a more generalized version of set_ids, a limited.
get_queryGetter for the query variable (‘q’).
get_default_queryGetter for what the query variable ‘q’ will be set to on a reset_query.
get_fundamental_queryGetter for what the query variable ‘q’ will be set to on a reset_default_query.
get_queryGetter for the query variable (‘q’).
reset_queryRemove/reset the query variable (‘q’); this set it back to the default query.
set_extraSetter for the internal string variable to be appended to the end of a query.
get_extraGetter for the internal string variable to be appended to the end of a query.
remove_extraRemove/reset the extra bit.
setSet an internal variable for the query.
getGet an internal variable for the query.
unsetUnset (remove) an internal variable for the query.
include_highlightingTurn hilighting on or off (with true or false).
set_personalityWhile we are always contacting the same Solr instance, we sometimes want to have different weights, facets, etc.
get_personalityReturns the current personality, null if none.
get_query_urlGet the current invariant state of the manager returned as a encoded URL string (using encodeURI()).
push_excursionSave the current state of the manager--data and sticky filter information--onto an internal stack.
pop_excursionReturn to a previously pushed state.
get_download_urlGet the current invariant state of the manager returned as a URL string.
get_filter_query_stringGet the current state of the manager, as defined by the current gross filter set--query, sticky filters, and standard filters-- returned as a URL query string (sans the ‘?’
get_state_urlGet the current invariant state of the manager, plus the current personality as a parameter, returned as a URL string.
load_urlMakes a a best attempt to recover the state of a manager from the clues left in a data url.
add_to_batch“Save” the current manager state to run later in serial batch mode.
batch_urlsReturn a pointer to the current batch urls.
next_batch_urlReturn the next data to be processed, removing it from the batch queue in the process.
reset_batchClear the currently queued data batch.
to_stringOutput writer for this object/class.
updateThe user code to select the type of update (and thus the type of callbacks to be called on data return).

Functions

manager

bbop.golr.manager = function (golr_loc,
golr_conf_obj)

Contructor for the GOlr query manager

Arguments

golr_locstring url to GOlr server;
golr_conf_obja bbop.golr.conf object

Returns

golr manager object

See also

bbop.registry

debug

this.debug = function(p)

Turn on or off the verbose messages.  Uses bbop.logger, so they should come out everywhere.

Parameters

p[optional] true or false for debugging

Returns

boolean; the current state of debugging

lite

this.lite = function(use_lite_p)

Limit the returns fields (the parameter “fl”) to the ones defined in the set of fields defined in results, label fields if available (i.e.  “_label”, “_map” when “_label” is multi=valued), and “score” and “id”.

The default is “false”.

Parameters

use_lite_p[optional] true or false, none just returns current

Returns

boolean; the current state of lite-ness

get_facet_limit

this.get_facet_limit = function(field)

Get the limit for a specified facet or the global limit.

Parameters

field[optional] limit for a specific field; otherwise global value

Returns

integer or null

set_facet_limit

this.set_facet_limit = function(arg1,
arg2)

Change the number of facet values returned per call.  The default is likely 25.

Just as in Solr, a -1 argument is how to indicate unlimted facet returns.

This setting does not survive things like <resets_facet_limit>.

Parameters

arg1(integer) set the global limit

Parameters

arg1(string) the name of the field to check
arg2(integer) set the limit for this field

Returns

boolean on whether something was set

set_default_facet_limit

this.set_default_facet_limit = function(lim)

Permanently change the default number of facet values returned per call.  The default’s default is likely 25.

Just as in Solr, a -1 argument is how to indicate unlimted facet returns.

Parameters

lim(integer) set the global default limit

Returns

old default

reset_facet_limit

this.reset_facet_limit = function(field)

Either reset the global limit to the original (likely 25) and/or remove the specified filter.  Sets everything back to the original values or whatever was set by set_default_facet_limit.

Parameters

field[optional] remove limit for a field; otherwise all and global

Returns

boolean on whether something was reset

get_results_count

this.get_results_count = function(field)

Get the current number of results that will be returned.

Parameters

n/a

Returns

integer

set_results_count

this.set_results_count = function(count)

Change the number of result documents returned per call.  The default is likely 10.

Parameters

count(integer) set the global results count

Returns

the count set

reset_results_count

this.reset_results_count = function()

Reset the number of documents to their original setting, likely 10.

Parameters

n/a

Returns

the new count

plist_to_property_hash

this.plist_to_property_hash = function(plist)

Turn a plist to a hash containing the different properties that can be defined for a query filter.  Possible values are: ‘+’ (positive filter), ‘-’ (negative filter), ‘*’ (sticky filter), ‘$’ (transient).  If mutually exclusive properties are defined (e.g. both ‘+’ and ‘-’), the last one will be used.  Or, since that is a call to silliness, let’s say the behavior is undefined.

Parameters

plist[optional] a list of properties to apply to the filter

Returns

A hash version of the plist; otherwise, the default property hash

add_query_filter_as_string

this.add_query_filter_as_string = function(filter_string,
plist)

Setter for query filters (‘fq’).  Acts as a

Parameters

filter_stringfilter (type) string (e.g.  “-type:gene”)
plist[optional] list of properties of the filter

Returns

(TODO) The current query filter hash.

See also

add_query_filter

add_query_filter

this.add_query_filter = function(filter,
value,
plist)

Setter for query filters (‘fq’).

Parameters

filterfilter (type) string
valuefilter value string (or TODO: defined logic hash)
plist[optional] list of properties of the filter

Returns

(TODO) The current query filter hash.

See also

plist_to_property_hash

remove_query_filter

this.remove_query_filter = function(filter,
value,
plist)

Remover for query filters (‘fq’), is a plist is specified, it will only remove if all of the listed criteria are met.

Parameters

filterfilter (type) string
valuefilter value string (TODO: or defined logic hash)
plist[optional] list of properties of the filter

Returns

boolean (on success)

reset_query_filters

this.reset_query_filters = function()

Reset the query filters (‘fq’); but leave sticky filters alone.

Parameters

n/a

Returns

(TODO) The current query filter hash.

get_query_filter_properties

this.get_query_filter_properties = function(filter,
value)

Get a hash representing a query filter (‘fq’).

Parameters

keyfilter string (TODO: or defined logic hash)

Returns

The current query filter hash for key.

get_query_filters

this.get_query_filters = function()

Get a list of hashes representing the query filters (‘fq’).  The return lists look like:

[{'filter': A, 'value': B, 'negative_p': C, 'sticky_p': D}, ...]

Where A and B are strings and C and D are booleans.

Parameters

n/a

Returns

A list of the current query filter hashs.

get_sticky_query_filters

this.get_sticky_query_filters = function()

Get a list of hashes representing the current stucky query filters (‘fq’).  See get_query_filters for a specification of what the return type looks like.

Parameters

n/a

Returns

A list of the current sticky query filter hashs.

See also

get_query_filters

filter_list_to_assemble_hash

this.filter_list_to_assemble_hash = function(flist)

Get all of our query filter variables and try and make something of them that <get_assemble> can understand.

Sticky doesn’t matter here, but negativity does.  However, we can be pretty naive since the hashing should have already taken out mutually exclusive dupes.

The argument is a list of query filter properties, as returned by get_query_filters and get_sticky_query_filters.

Parameters

flista list of query filter properties (see above)

Returns

hash of filter names to value lists

See also

get_query_filters get_sticky_query_filters

sensible_query_p

this.sensible_query_p = function(qfs)

Simply ask the manager if a free text query (‘q’) makes sense at this point.

This currently means that the query text (‘q’) is three (3) or longer and that query fields (‘qf’) are defined.

This is an overridable opinion of the manager.

Parameters

n/a

Returns

boolean

last_packet_sent

this.last_packet_sent = function()

It is up to the UI to do something interesting with this number.

Also remember that this number only rises through calls to update or one of its wrappers.  Calls to get_query_url and the like will not affect this number.

Parameters

n/a

Returns

integer

See also

update

clear

this.clear = function()

Clear all non-sticky query parameters to get back to a more “original” state.

Not to be confused with reset.

Parameters

n/a

Returns

n/a

reset

this.reset = function()

Manually trigger the “reset” chain of events.

This is a curried wrapper for update and should be preferred over a direct call to update.

Note to be confused with clear.

Returns

the query url (with the jQuery callback specific parameters)

See also

update

search

this.search = function()

Trigger the “search” chain of events.  Takes a field-keyed hash of bbop.logics as an argument.

This is a curried wrapper for update and should be preferred over a direct call to update.

Parameters

n/a

Returns

the query url (with the jQuery callback specific parameters)

See also

update

page

this.page = function(rows,
start)

Re-trigger the “search” chain of events, but with the variables set for a different section of the results.

Note that this operates independently of any impossibilites in the results--just how such paging would look and triggering.  Ths UI should handle impossibilities and the like.

This is a wrapper for update and should be preferred over a direct call to update.

Parameters

rowsthe number of rows to return
startthe offset of the rows to return

Returns

the query url (with the jQuery callback specific parameters)

See also

update

page_first

Currently a convenience alias for search.  Think about it--it makes sense.

This is a wrapper for page and should be preferred over a direct call to page.

Parameters

n/a

Returns

n/a

See also

page

page_previous

this.page_previous = function()

This is a wrapper for page and should be preferred over a direct call to page.

Parameters

n/a

Returns

the query url (with the jQuery callback specific parameters)

See also

page

page_next

this.page_next = function()

This is a wrapper for page and should be preferred over a direct call to page.

Parameters

the query url (with the jQuery callback specific parameters)

Returns

n/a

See also

page

page_last

this.page_last = function(total_document_count)

Trigger search on last page parameters.

Since the manager has no idea about what is actually being returned, the real world number of total documents needs to be added as an argument.

This is a wrapper for page and should be preferred over a direct call to page.

Parameters

total_document_countinteger for the total number of docs found

Returns

the query url (with the jQuery callback specific parameters)

See also

page

get_page_rows

this.get_page_rows = function()

Return the number of rows the manager is currently set to.  Useful as an argument to page.

Parameters

n/a

Returns

integer; the number of rows the manager is currently set to

See also

page

get_page_start

this.get_page_start = function()

Return the rows offset the manager is currently set to.  Useful as an argument to page.

Parameters

n/a

Returns

integer; the offset the manager is currently set to

See also

page

add_query_field

this.add_query_field = function(qf,
boost)

Add a new query field to the query.

This does not go through and expand into searchable fields, for that see: query_field_set.

Parameters

qfthe query field to add
boost[optional] defaults to 1.0

Returns

true or false on whether or not it is a new field

See also

query_field_set

query_field_set

this.query_field_set = function(qfs)

Bulk getter/setter for the query fields--the fields that are searched (and by what weight) when using a query (‘q’ or set_query(), i.e. the ‘qf’ field).

This will always use searchable fields if possible, automatically replacing the non-searchable versions (I can’t think of any reason to use non-searchable versions unless you want your searches to not work) if a personality is set.  If no personality is set, it will just use the arguments as-is.

The argument replaces the current set.

The qfs argument should be a hash like

{‘field01’: value01, ...}

Parameters

qfs[optional] query fields to set

Returns

the current query_fields array (e.g.  [“field01^value01”, ...])

facets

this.facets = function(list_or_key)

Bulk getter/setter for facets (technically ‘facet.field’).

Parameters

key[optional] facet to add to the facet list

Parameters

list[optional] list to replace the current list with

Returns

the current facets hash.

set_default_query

this.set_default_query = function(new_default_query)

Setter for the default query for the query variable (‘q’).

Call reset_query if you want to affect query immediately.

Parameters

new_default_querynew default query string (or TODO: bbop.logic)

Returns

the current setting of default query for (‘q’)

reset_default_query

this.reset_default_query = function()

Reset the default query back to “:”.

Call reset_query if you want to affect query immediately.

Parameters

n/a

Returns

the current setting of default query (‘q’)

set_query

this.set_query = function(new_query)

Setter for the query variable (‘q’).

Parameters

new_querynew value for the query string (or TODO: bbop.logic)

Returns

the current setting of query (‘q’)

Also see

set_comfy_query

set_comfy_query

this.set_comfy_query = function(new_query)

A specialized setter for the query variable (‘q’), as follows

If the input is all alphanum or space, the input is tokenized.  If there is one token, if it is at least three characters, gets a wildcard ‘*’; if there are more tokens, the last one gets a wild card.

This might be a more comfortable way to search for most naive (non-power user) interfaces.

Parameters

new_querynew value for the query string (or TODO: bbop.logic)

Returns

the current setting of query (‘q’)

Also see

set_query

set_id

this.set_id = function(new_id)

A limited setter, removing whatever else is on query.  This is for when you want to lock into one (unique) document by id (essentially ‘q=id:”foo”’).  All other query operations behave as they should around it.

Parameters

new_idstring id

Returns

the current setting of query (‘q’)

Also see

set_ids

set_ids

this.set_ids = function(id_list)

Like set_id, a limited setter.  It removes whatever else is on query and replaces it with something like:

gm.set_ids(['GO:1', 'GO:2'])

This is for when you want to lock into a set of documents by id.  All other query operations behave as they should around it.

Parameters

id_lista list of ids to search for

Returns

the current setting of query (‘q’)

Also see

set_ids

set_targets

this.set_targets = function(id_list,
field_list)

Like a more generalized version of set_ids, a limited.  It removes whatever else is on query and replaces it with something like:

gm.set_targets(['GO:1', 'GO:2'], ['field_1', 'field_2'])

This is for when you want to lock into a set of documents by locking onto identifiers in some set of search fields.  All other query operations behave as they should around it.

Parameters

id_lista list of ids to search for
field_lista list of fields ids to search across

Returns

the current setting of query (‘q’)

Also see

set_ids

get_query

this.get_query = function()

Getter for the query variable (‘q’).

Parameters

n/a

Returns

the current setting of extra

get_default_query

this.get_default_query = function()

Getter for what the query variable ‘q’ will be set to on a reset_query.

Parameters

n/a

Returns

the current setting of the default query

get_fundamental_query

this.get_fundamental_query = function()

Getter for what the query variable ‘q’ will be set to on a reset_default_query.

Parameters

n/a

Returns

the current setting of the fundamental default query

get_query

this.get_query = function()

Getter for the query variable (‘q’).

Parameters

n/a

Returns

the current setting of extra

reset_query

this.reset_query = function()

Remove/reset the query variable (‘q’); this set it back to the default query.

Parameters

none

Returns

the current value of query

Also see

set_default_query reset_default_query

set_extra

this.set_extra = function(new_extra)

Setter for the internal string variable to be appended to the end of a query.  For special use cases only (e.g. extend functionality of the API safely).

Parameters

new_extra[optional] new value for the extras string

Returns

the current setting of extra

get_extra

Getter for the internal string variable to be appended to the end of a query.

Parameters

n/a

Returns

the current setting of extra

remove_extra

this.remove_extra = function()

Remove/reset the extra bit.

Parameters

none

Returns

””

set

this.set = function(key,
new_val)

Set an internal variable for the query.  The internal variables are typically things like ‘qt’, ‘indent’, etc.--things that you might set and forget a while.  It does /not/ include highly dynamic variables (like callback and packet) or querying variables like ‘q’ and ‘fq’; for those you need to use the API.

Parameters

keythe name of the parameter to change
new_valwhat you want the new value to be

Returns

n/a

get

this.get = function(key)

Get an internal variable for the query.

See set for the kinds of parameters that can be read.

Parameters

keythe name of the parameter to get

Returns

The found value of the key.

unset

this.unset = function(key)

Unset (remove) an internal variable for the query.  Only usable on certain types of

Only use is you really know what you’re doing.

Parameters

keythe name of the parameter to unset/remove

Returns

boolean; true false on whether the key was found

include_highlighting

this.include_highlighting = function(hilite_p,
html_elt_str)

Turn hilighting on or off (with true or false).

This essentially adds the parameters to the query string to make sure that basic highlighting on the search is returned.

It starts off as false.  The optional html_elt_str argument defaults to:

<em class="hilite">

Parameters

hilite_p[optional] boolean
html_elt_str[serially optional] the HTML element string to use

Returns

either false or the current string being used for the return element

set_personality

this.set_personality = function(personality_id)

While we are always contacting the same Solr instance, we sometimes want to have different weights, facets, etc.  This function allows us to use the pre-set ones defined in the constructor configuration argument.

Currently, this only sets the ‘facet.field’ internal variable.

Parameters

personality_idstring

Returns

Will return false if personality doesn’t exist

get_personality

this.get_personality = function()

Returns the current personality, null if none.

Parameters

n/a

Returns

Returns the current personality as a string, null if none is set

get_query_url

this.get_query_url = function()

Get the current invariant state of the manager returned as a encoded URL string (using encodeURI()).

This means the URL for the current query to the GOlr store, but without extra information about packets, callbacks, and the like.

This is generally appropriate for getting data, but maybe not for things like high-speed autocomplete where races can occur.  For those, you might want to consider update or search.

Parameters

n/a

Returns

URL string

Also see

update, search

push_excursion

this.push_excursion = function()

Save the current state of the manager--data and sticky filter information--onto an internal stack.  Batch information is not stored.

Useful for gettinginto a state, doing something else, then returning to the original state.

Parameters

n/a

Returns

the number of items on the excursion stack

Also see

get_query_url pop_excursion

pop_excursion

this.pop_excursion = function()

Return to a previously pushed state.  Batch items are not recovered.

Parameters

n/a

Returns

boolean on whether a state was recovered

Also see

get_query_url <gpush_excursion>

get_download_url

this.get_download_url = function(field_list,
in_arg_hash)

Get the current invariant state of the manager returned as a URL string.

This differs from get_query_url in that the generated string is intended for text-processing uses rather than computerized searching uses.  The idea where is to create a TSV file for downloading and consumption.

Instead of downloading all of the results, a limited listed set can be downloaded using entity_list, which identifies documents by id.

The optional argument hash looks like

rowsthe number of rows to return; defaults to: 1000
encapsulatorhow to enclose whitespace fields; defaults to: “”
separatorseparator between fields; defaults to: “%09” (tab)
headerwhether or not to show headers; defaults to: “false”
mv_separatorseparator for multi-valued fields; defaults to: “|”
entity_listlist of specific download items in results; default null

With the entity list, keep in mind that null and an empty list are handled in pretty much the same way--they are an indication that we are going after nothing specific, and so all results are game.

Parameters

field_lista list of fields to return
in_arg_hash[optional] additional optional arguments

Returns

URL string

Also see

get_query_url

get_filter_query_string

this.get_filter_query_string = function()

Get the current state of the manager, as defined by the current gross filter set--query, sticky filters, and standard filters-- returned as a URL query string (sans the ‘?’).

This differs from get_query_url and get_state_url in that the generated string is intended for applications that may want just enough information to recover filter state when the personality, and other types of information, are already known.  It is intended to be part of a light RESTy bookmarking mechanism in larger application.

Parameters

n/a

Returns

query string for current filters (sans the ‘?’)

Also see

get_query_url get_state_url

get_state_url

this.get_state_url = function()

Get the current invariant state of the manager, plus the current personality as a parameter, returned as a URL string.

This differs from get_query_url in that the generated string is intended for applications that may want a little more information and hinting over just what the current search is.  This method essentially parameterizes some of the “hidden state” of the manager.

Parameters

n/a

Returns

URL string

Also see

get_query_url

load_url

this.load_url = function(url)

Makes a a best attempt to recover the state of a manager from the clues left in a data url.  This can also (and probably should) be thought of as a “load bookmark” function.  Theoretically, you should even be able to use “bookmarks” from alien installations.

Note that while this recovers enough to get the same data, certain “session”/”preference” type things that are not encoded in the url (e.g. filter stickiness, the contents of batch queues, non-default base queries, etc.) will not be replayed and must be recovered or guessed on an app by app basis..

Warning: this currently only replays a small subset of possible parameters.  Currently: personality, q, fq, ???.  In the future, this should no all non-session information.

Warning: Because there is more to bookmarks than just the major stuff, variants not supplied in the bookmark will be removed.

This returns true if the parameter portions of the new and bookmark urls match.  However, this is often not the case--think shifting personalities, etc.

Parameters

urlA URL string generated by a manager’s get_query_url (or similar)

Returns

boolean

add_to_batch

this.add_to_batch = function()

”Save” the current manager state to run later in serial batch mode.

The actual job of running these batches is left to the implementation of the sub-managers; probably in “run_batch”.

Parameters

n/a

Returns

state url

batch_urls

this.batch_urls = function()

Return a pointer to the current batch urls.

Parameters

n/a

Returns

array

next_batch_url

this.next_batch_url = function()

Return the next data to be processed, removing it from the batch queue in the process.

Parameters

n/a

Returns

state url or null

reset_batch

this.reset_batch = function()

Clear the currently queued data batch.

The actual job of running these batches is left to the implementation of the sub-managers; probably in “run_batch”.

Parameters

n/a

Returns

the number of items cleared

to_string

bbop.golr.manager.prototype.to_string = function ()

Output writer for this object/class.  See the documentation in core.js on <dump> and to_string.

Parameters

n/a

Returns

string

update

bbop.golr.manager.prototype.update = function(callback_type,
rows,
start)

The user code to select the type of update (and thus the type of callbacks to be called on data return).

This mechanism adds a couple of variables over other methods for bookkeeping: packet (incremented every time) and callback_type.

The currently recognized callback types are “reset” (for when you are starting or starting over) and “search” (what you typically want when you get new data) and “error” for when something went wrong.  But only “search” and “reset” manipulate the system.

If rows or start are not set, they will both be reset to their initial values--this is to allow for paging on “current” results and then getting back to the business of searching with as little fuss as possible.  Because of things like this, one should avoid calling this directly whenever possible and prefer simpler functionality of the wrapper methods: search, reset, and page.

Parameters

callback_typecallback type string; ‘search’, ‘reset’ and ‘error’
rows[optional] integer; the number of rows to return
start[serially optional] integer; the offset of the returned rows

Returns

the query url (with the jQuery callback specific parameters)

Also see

get_query_url

bbop.golr.manager = function (golr_loc,
golr_conf_obj)
Contructor for the GOlr query manager
this.debug = function(p)
Turn on or off the verbose messages.
this.lite = function(use_lite_p)
Limit the returns fields (the parameter “fl”) to the ones defined in the set of fields defined in results, label fields if available (i.e.
this.get_facet_limit = function(field)
Get the limit for a specified facet or the global limit.
this.set_facet_limit = function(arg1,
arg2)
Change the number of facet values returned per call.
this.set_default_facet_limit = function(lim)
Permanently change the default number of facet values returned per call.
this.reset_facet_limit = function(field)
Either reset the global limit to the original (likely 25) and/or remove the specified filter.
this.get_results_count = function(field)
Get the current number of results that will be returned.
this.set_results_count = function(count)
Change the number of result documents returned per call.
this.reset_results_count = function()
Reset the number of documents to their original setting, likely 10.
this.plist_to_property_hash = function(plist)
Turn a plist to a hash containing the different properties that can be defined for a query filter.
this.add_query_filter_as_string = function(filter_string,
plist)
Setter for query filters (‘fq’).
this.add_query_filter = function(filter,
value,
plist)
Setter for query filters (‘fq’).
this.remove_query_filter = function(filter,
value,
plist)
Remover for query filters (‘fq’), is a plist is specified, it will only remove if all of the listed criteria are met.
this.reset_query_filters = function()
Reset the query filters (‘fq’); but leave sticky filters alone.
this.get_query_filter_properties = function(filter,
value)
Get a hash representing a query filter (‘fq’).
this.get_query_filters = function()
Get a list of hashes representing the query filters (‘fq’).
this.get_sticky_query_filters = function()
Get a list of hashes representing the current stucky query filters (‘fq’).
this.filter_list_to_assemble_hash = function(flist)
Get all of our query filter variables and try and make something of them that get_assemble can understand.
this.sensible_query_p = function(qfs)
Simply ask the manager if a free text query (‘q’) makes sense at this point.
this.last_packet_sent = function()
It is up to the UI to do something interesting with this number.
this.clear = function()
Clear all non-sticky query parameters to get back to a more “original” state.
this.reset = function()
Manually trigger the “reset” chain of events.
this.search = function()
Trigger the “search” chain of events.
this.page = function(rows,
start)
Re-trigger the “search” chain of events, but with the variables set for a different section of the results.
this.page_previous = function()
This is a wrapper for page and should be preferred over a direct call to page.
this.page_next = function()
This is a wrapper for page and should be preferred over a direct call to page.
this.page_last = function(total_document_count)
Trigger search on last page parameters.
this.get_page_rows = function()
Return the number of rows the manager is currently set to.
this.get_page_start = function()
Return the rows offset the manager is currently set to.
this.add_query_field = function(qf,
boost)
Add a new query field to the query.
this.query_field_set = function(qfs)
Bulk getter/setter for the query fields--the fields that are searched (and by what weight) when using a query (‘q’ or set_query(), i.e.
this.facets = function(list_or_key)
Bulk getter/setter for facets (technically ‘facet.field’).
this.set_default_query = function(new_default_query)
Setter for the default query for the query variable (‘q’).
this.reset_default_query = function()
Reset the default query back to “:”.
this.set_query = function(new_query)
Setter for the query variable (‘q’).
this.set_comfy_query = function(new_query)
If the input is all alphanum or space, the input is tokenized.
this.set_id = function(new_id)
A limited setter, removing whatever else is on query.
this.set_ids = function(id_list)
Like set_id, a limited setter.
this.set_targets = function(id_list,
field_list)
Like a more generalized version of set_ids, a limited.
this.get_query = function()
Getter for the query variable (‘q’).
this.get_default_query = function()
Getter for what the query variable ‘q’ will be set to on a reset_query.
this.reset_query = function()
Remove/reset the query variable (‘q’); this set it back to the default query.
this.get_fundamental_query = function()
Getter for what the query variable ‘q’ will be set to on a reset_default_query.
this.set_extra = function(new_extra)
Setter for the internal string variable to be appended to the end of a query.
this.remove_extra = function()
Remove/reset the extra bit.
this.set = function(key,
new_val)
Set an internal variable for the query.
this.get = function(key)
Get an internal variable for the query.
this.unset = function(key)
Unset (remove) an internal variable for the query.
this.include_highlighting = function(hilite_p,
html_elt_str)
Turn hilighting on or off (with true or false).
this.set_personality = function(personality_id)
While we are always contacting the same Solr instance, we sometimes want to have different weights, facets, etc.
this.get_personality = function()
Returns the current personality, null if none.
this.get_query_url = function()
Get the current invariant state of the manager returned as a encoded URL string (using encodeURI()).
this.push_excursion = function()
Save the current state of the manager--data and sticky filter information--onto an internal stack.
this.pop_excursion = function()
Return to a previously pushed state.
this.get_download_url = function(field_list,
in_arg_hash)
Get the current invariant state of the manager returned as a URL string.
this.get_filter_query_string = function()
Get the current state of the manager, as defined by the current gross filter set--query, sticky filters, and standard filters-- returned as a URL query string (sans the ‘?’
this.get_state_url = function()
Get the current invariant state of the manager, plus the current personality as a parameter, returned as a URL string.
this.load_url = function(url)
Makes a a best attempt to recover the state of a manager from the clues left in a data url.
this.add_to_batch = function()
“Save” the current manager state to run later in serial batch mode.
this.batch_urls = function()
Return a pointer to the current batch urls.
this.next_batch_url = function()
Return the next data to be processed, removing it from the batch queue in the process.
this.reset_batch = function()
Clear the currently queued data batch.
bbop.golr.manager.prototype.to_string = function ()
Output writer for this object/class.
bbop.golr.manager.prototype.update = function(callback_type,
rows,
start)
The user code to select the type of update (and thus the type of callbacks to be called on data return).
BBOP generic lightweight listener/callback registry system.
Generic BBOP handler for dealing with the gross parsing of responses from a GOlr server (whereas golr_conf deals with the reported configuration).
BBOP object to try and take some of the pain out of managing the boolean logic that seems to show up periodically.
BBOP JS logger object.
Close