Opened 10 years ago

Closed 10 years ago

#7 closed enhancement (fixed)

Add advanced search functionality to data layer

Reported by: david Owned by: dstillman
Priority: major Milestone: 1.0 Beta 1
Component: data layer Version: 1.0
Keywords: Cc:

Description (last modified by dstillman)

Support searching on multiple conditions and allow for later addition of saved searches

Change History (5)

comment:1 Changed 10 years ago by dstillman

  • Component changed from ingester to data layer
  • Owner changed from somebody to dstillman
  • Status changed from new to assigned

comment:2 Changed 10 years ago by dstillman

  • Description modified (diff)

comment:3 Changed 10 years ago by dstillman

  • Summary changed from advanced search to Add advanced search functionality to data layer

comment:4 Changed 10 years ago by dstillman

  • Milestone set to 1.0 Alpha 2
  • Version set to 1.0

comment:5 Changed 10 years ago by dstillman

  • Resolution set to fixed
  • Status changed from assigned to closed

(In [431]) Closes #7, Add advanced search functionality to data layer

Implemented advanced/saved search architecture -- to use, you create a new search with var search = new Scholar.Search(), add conditions to it with addCondition(condition, operator, value), and run it with search(). The standard conditions with their respective operators can be retrieved with Scholar.SearchConditions.getStandardConditions(). Others are for special search flags and can be specified as follows (condition, operator, value):

'context', null, collectionIDToSearchWithin
'recursive', 'true'|'false' (as strings!--defaults to false if not specified, though, so should probably just be removed if not wanted), null
'joinMode', 'any'|'all', null

For standard conditions, currently only 'title' and the itemData fields are supported -- more coming soon.

Localized strings created for the standard search operators

API:

search.setName(name) -- must be called before save() on new searches
search.load(savedSearchID)
search.save() -- saves search to DB and returns a savedSearchID
search.addCondition(condition, operator, value)
search.updateCondition(searchConditionID, condition, operator, value)
search.removeCondition(searchConditionID)
search.getSearchCondition(searchConditionID) -- returns a specific search condition used in the search
search.getSearchConditions() -- returns search conditions used in the search
search.search() -- runs search and returns an array of item ids for results
search.getSQL() -- will be used by Dan for search-within-search

Scholar.Searches.getAll() -- returns an array of saved searches with 'id' and 'name', in alphabetical order
Scholar.Searches.erase(savedSearchID) -- deletes a given saved search from the DB

Scholar.SearchConditions.get(condition) -- get condition data (operators, etc.)
Scholar.SearchConditions.getStandardConditions() -- retrieve conditions for use in drop-down menu (as opposed to special search flags)
Scholar.SearchConditions.hasOperator() -- used by Dan for error-checking

Note: See TracTickets for help on using tickets.