Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  • SearchManager.Instance.Canonicalise() reduces a search string to the form to which the search text has been reduced.  This process will do things like remove plurals, accents, reduce to lower case etc.
  • SearchSpec is a class which describes what kind of search is needed.  The most important field is GeneralSearch which is the canonicalised search string.
  • The AddGeneralSearchField lets you include another field against those against which the GeneralSearch string is matched.  You can also set a number which is a 'boost' by which the score of that matches (if there is one) is multiplied, making matches to that field more important.  Here for instance, a match to the Title receives a boost of 4 as a match to a title is more important than a match to body text.
  • Because this example is running in a context with multiple versions, before running the search the current version is set to the public version via VersionManager.Instance.PushState().  Because the search module only indexes the public version(s) of content items, this ensures that the search results comes back with these versions. See how to override the current version for more information on this.
  • The returned search results are a List<SearchResultItem>.  SearchResultItem simply includes the id of the content item (.VersionedId) and the search score (.Score).

...