Basically, it works like this:
- Make your REST call to get search results from SharePoint
- Create an instance of the S43.SearchResultParser object:
- Take the parameter returned from SharePoint (In the image its oneSample ) and pass it to the parseResults method in the SPRESTSearchParser object, as shown in the second line in the above image
- The return value from that method call is a JSON object which contains an array of SearchResult objects. Each SearchResult object is simply a representation of a single result from SharePoint that is easier to work with than the raw results. It looks like this in the Chrome dev tools:
Each property from the result set is available directly on the SearchResult object within the array by name – much easier than remembering the position of each property in the result set.
- Right now the following properties are available from the PrimaryQueryResult.RelevantResults collection:
Accessing the results now looks like this:
In the future, I’d like to clean this up and expand it to make use of additional result sets and other search capabilities. Feel free to fork the code and adapt to meet your needs. If you do something interesting, please submit a pull request to allow others to take advantage of it as well.