Search API: GroupedQuery Method

Follow

 

Description

Executes a grouped search query. Returns a deferred object.

This assumes that you have set up categories/facets for search and have set a selector in the Search Settings that instructs the Agility crawler how to index the page. A selector is usually set to inspect a Meta tag value. For example, you may want to categorize pages like BlogVideo, or News. Then, you would use this method to return your results grouped by your category.

Parameters:

  • query
    • The search term.  Uses simple Lucerne syntax.
  • languageCode
    • The language you want to return results from.  This is the current language of the site by default.  LanguageCode is interpreted from search results using the language meta tag, or from the agility_attributes meta tag that is generated by default in all Agility pages.
    • This must be an exact match.
  • category
    • If your site has the "category" selector setup in the search settings, you can limit results to a particular category string.  
    • This must be an exact match.
  • domain
    • If you have specified multiple domains for your search index, you can filter by the domain here.
    • This must be an exact match.
  • top
    • The number of results to return.
  • skip
    • The number of results to skip.  Useful in showing paged results.

Callbacks

  • success (response)
    • The search completed successfully.
    • The response parameter is an Object with the following properties:
      • Count: the number of results in total.
      • FromNumber: the starting index (1 based) of the first result returned.
      • ToNumber: the starting index (1 based) of the last result returned.
      • Query: the query string that was passed in.
      • Results: the array of search results.  Each search result contains the following properties:
        • Title: the title of the result.  In an HTML page, this is parsed from the Open Graph title or Meta title.
        • LanguageCode: the language code of the result.  In an HTML page, this is parsed from the Meta language or the agility_attributes meta tag.
        • Category: the category of the result.  In an HTML page, this is parsed from the Meta selector specified in your Agility Search Settings.
        • Description: the description of the result.  In an HTML page, this is parsed from the Meta description.
        • Highlight: the highlighted area (delineated with <em> tags) where the search query was found in the searched text.
        • ImageUrl: the Open Graph Image URL from the result.
        • Score - the relativity score.  This is how results are sorted.  This score can be manipulated by "boosting" a page from the Indexed Pages list in the Agility Content Manager.
  • error(message)
    • Indicates that an error occurred, with the relative error message as a parameter.
  • always
    • Indicates that the HTTP request to the search server has completed.

Example

 

0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.