Skip to main content

This version of the product is no longer supported, and this documentation is no longer updated regularly. See the latest version of this content.Opens in a new tab

DocAPI.v1.Search

This class, which supports DocAPI.v1.REST, provides an API to perform searches and return matches from the DocBook database. The methods in this class can return either an instance of %Library.DynamicObject or a JSON string. The returned object has the following properties:

Method Inventory

Parameters

parameter CACHEAGEINDAYS = 14;
parameter DEFAULTOPERATOR = AND;
parameter DEFAULTRANK = 10000;
parameter DEFAULTSEARCHTYPE = 2;
parameter TOPICSPERPAGE = 20;

Methods

classmethod CacheIt(searchKey As %String, pageNumber As %Integer, verbose As %Boolean = 0)
This method is responsible for putting the results into order by rank (in the ppg ^||topicsbyorder).
classmethod CacheKEYs(searchKey As %String, keys As %String = "", getSummary As %Boolean = 0)
classmethod GetFromIndex(searchKey As %String = "") as %Library.DynamicObject
See if the given phrase is in the index global (^DocBook.Index). This method returns a %Library.DynamicObject that contains the results, if any. This object can have the following properties:
  • resultCount - number of times the search phrase was found in the index global.
  • hits - an array of objects, each of which represents a hit found in the index global. Each of these objects has the following properties: type (the DocBook type of the hit), key (the DocBook ID of the hit), URL (uses the key of the hit), text (the text of the hit), and locator (see elsewhere for information on locator). The hits property is omitted if there are no hits.
classmethod GetResults(tPhrase="the", tProduct="", tBookId="", tTags="", tSearchType=..#DEFAULTSEARCHTYPE, tOperator=..#DEFAULTOPERATOR, pageNumber As %Integer = 1) as %Library.DynamicObject
This is the method that the REST API will call.
classmethod GetSQLResultsFromCache(tSearchKey As %String = "", pageNumber As %Integer = 1) as %Library.DynamicObject
Returns an object that contains information about hits found via an SQL query. This object can have the following properties:
  • resultCount - number of hits that were found (note that the query is limited to the top 1000, so this will always be less than that).
  • topicCount - number of topics in which these hits were found. A topic is a chapter, appendix, or other parallel unit that is displayed as a page.
  • pageNumber - an integer, indicating which page of *results* are contained here. We return only 20 topics in any page of results.
  • topics - an array of objects, each of which represents a topic in which results were found. Each of these objects has the following properties:
    • key - indicates the DocBookId of the topic.
    • locator - an array of objects, each of which corresponds to a higher heading level (for the topic we found). This array goes down to the sect3 level (if applicable). The first item in the array identifies the book or article. The second item identifies the chapter, appendix, or other unit at that level. The next item identifies the heading level below that, etc. Each object in this array has two properties: key (the DocBookId of that item) and title.
    • hits - an array of objects, each of which represents a hit within this topic. In this array, each object has the properties type (the DocBook type of the hit), URL (the key of the hit), and text (the text of the hit).
  • query - the actual SQL query that was used for this portion of the search.
  • searchTime - the time spent performing this search, in seconds.
  • classmethod HaveMatchingTag(blockid As %String, tag As %String) as %Boolean
    Returns true if the given block is tagged with the given tag.
    classmethod MatchAllParms(blockid, queryProduct As %String = "", queryBook As %String = "", queryTag As %String = "")
    Check to see if the given blockid matches the rest of the query parameters
    classmethod ProcessIndex(searchKey As %String = "")
    classmethod RunQueryForProcessIndex(blockid, pBookId, pProductId)
    classmethod StartsWith(string As %String, fragment As %String, caseSensitive As %Boolean = 0) as %Boolean
    Returns true if string starts with the given fragment.

    Inherited Members

    Inherited Methods

    FeedbackOpens in a new tab