Code Examples‎ > ‎HV2 API Explore‎ > ‎

Search

The Search page demonstrates how to search a catalog. Type in a search query and click Search. Search results are displayed below. As you click each topic result item, the right side displays the rendered topic as well topic object data.




Search

Search code is also very straight forward.

Here GetSearchResults()  returns a list of topics. 

String query = "StringBuilder";  
HelpFilter filter = null;      // adv filtering not required (we want all search results)
int pageSize = 50;             // number of items per page to return
int pageNumber = 1;            // which page of results to return 
int _totalAvailableHits = 0;   // total number of hits returned 

ITopicCollection topics = _catalogRead.GetSearchResults(_catalog, query, filter, SearchOptions.None, pageSize, pageNumber, out _totalAvailableHits);

And again we can iterate through the returned topic list (see details for ITopicCollection and Topic in TOC page help).

These Search options can be OR'd together if required.

SearchOptions.None no options.
SearchOptions.OrSearchOverride changes search terms "x y", normally interpreted "x AND y",  to "x OR y".
SearchOptions.SearchTermHighlight adds highlighting html tags to search result text.


More Search Options

Note that special search prefixes (as it's not clear from the demo) can be concatenated and prefix any search term.

So when searching for "String AND Lock" this is also valid: "code:c#:keyword:String AND title:Lock".



Comments