Share:
ClickHelp Documentation

Full-Text Search

You can run full-text search queries via ClickHelp API. Unlike the data-changing functions of the API, full-text search operations do not require authentication and can be performed anonymously. They can also be performed from JavaScript using CORS which allows cross-domain requests.

Full-Text Search Functions List

Search the Entire Portal

Runs full-text search in all projects available to the current user. If the user is unauthenticated, only public publications are searched. If the user is authenticated, search is performed in projects and publications the user has access to. You can also apply additional filter to search only the projects and publications listed in the projectUrls parameter.

GET /api/v1/search?q={searchQuery}&count={maxResCount}&isReturnSnippets={isReturnSnippets}&projectUrls={projectUrls} HTTP/1.1

Parameters

FieldTypeDescription
searchQueryString

The full-text search query. May contain double quotes for phrase search and other supported full-text search operators.

countInteger(Optional) Defines the maximum count of top search results to be returned. If this parameter is omitted, top 10 results are returned. If the value is a negative number, all search results are returned regardless of their total count.
isReturnSnippets Integer(Optional) If set to 1 (or any value greater than zero), search results will contain highlighted HTML for topic titles and highlighted content snippets similar to those in Google. That is, whether the ftsTitleHtml and ftsSnippetHtml fields will be populated in search results.
projectUrlsString(Optional) A comma-separated list of project URL identifiers. If specified, only the given projects / publications will be searched. If some of them are not available to the currently authenticated user, they will be excluded from the search list.

Request Example

Below, are examples of CURL command lines you can use in a batch file to get search results for the entire portal.

curl -X GET ^
  --cacert comodo.ca-bundle ^
  https://doc.clickhelp.co/api/v1/search?q=full-text%20search
curl -X GET ^
  --basic ^
  --user administrator:t62dVG0YkqdTHO4G4K7z2jQ8 ^
  --cacert comodo.ca-bundle ^
  https://doc.clickhelp.co/api/v1/search?q=text&count=5&isReturnSnippets=1&projectUrls=clickhelp-documentation,api-manual

Response Fields

FieldTypeDescription
IDString

Topic ID is an alphanumeric topic identifier that becomes a part of the full topic URL in the browser address bar. The topic ID is unique inside one project or publication (e.g. "full-text-search")

fullUrlString

Full topic URL which can be used to open the topic in a web browser.

For example: "https://my-portal.clickhelp.co/articles/some-documentation/full-text-search/"

titleStringThe topic title. 
projectTitleString The title of the project or publication to which the topic belongs. 
projectUrlString The URL identifier of the project or publication to which the topic belongs (e.g. "clickhelp-documentation").
htmlString The HTML content of the topic. This field is populated only when getting a specific single topic via API and is not populated for responses which return multiple topics.
ftsTitleHtmlString The HTML markup of the topic title with a full-text search query matches highlighted. For example, if you search for the "text" keyword, the highlighted topic title can be "Full-Text Search". This field is populated only for full-text search queries executed with the isReturnSnippets parameter greater than zero.
ftsSnippetHtmlString The HTML markup of a topic content snippet with a full-text search query matches highlighted. Similar to text snippets you see for search results in Google. This field is populated only for full-text search queries executed with the isReturnSnippets parameter greater than zero. 

Response Example

{[  
  {  
    "fullUrl":"http://doc.clickhelp.co/articles/clickhelp-documentation/full-text-search",
    "html":null,
    "projectName":"ClickHelp Documentation",
    "projectUrl":"clickhelp-documentation",
    "title":"Full-Text Search",
    "url":"full-text-search",
"ftsTitleHtml":"Full-<strong>Text</strong> Search"
"ftsSnippetHtml":"You can run full-<strong>text</strong> search..." }, { "fullUrl":"http://doc.clickhelp.co/articles/api-manual/getting-topics", "html":null, "projectName":"API Manual", "projectUrl":"api-manual", "title":"Getting Topics", "url":"getting-topics"
"ftsTitleHtml":"Getting Topics"
"ftsSnippetHtml":"...the one you define in topic properties (e.g. full-<strong>text</strong> search)..." } ]}

Response Codes

All API functions may return error codes listed in the Error Handling topic. Below, are the operation-specific meanings of some response codes:

  • 200 (OK)
    Returned if the information was retrieved successfully.
    Response body contains the data.

Search in a Specific Project

Runs full-text search in a specific project. If the user is unauthenticated, only public publications can be searched. If the user is authenticated, search can be performed in any project or publication the user has access to.

GET /api/v1/projects/{url}/articles?q={searchQuery}&count={maxResCount}&isReturnSnippets={isReturnSnippets} HTTP/1.1

Parameters

FieldTypeDescription
searchQueryString

The full-text search query. May contain double quotes for phrase search and other supported full-text search operators.

countInteger(Optional) Defines the maximum count of top search results to be returned. If this parameter is omitted, top 10 results are returned. If the value is a negative number, all search results are returned regardless of their total count.
isReturnSnippets Integer(Optional) If set to 1 (or any value greater than zero), search results will contain highlighted HTML for topic titles and highlighted content snippets similar to those in Google. That is, whether the ftsTitleHtml and ftsSnippetHtml fields will be populated in search results.

Request Example

Below, are examples of CURL command lines you can use in a batch file to get search results for the entire portal.

curl -X GET ^
  --cacert comodo.ca-bundle ^
  https://doc.clickhelp.co/api/v1/projects/clickhelp-documentation/articles?q=full-text%20search
curl -X GET ^
  --basic ^
  --user administrator:t62dVG0YkqdTHO4G4K7z2jQ8 ^
  --cacert comodo.ca-bundle ^
  https://doc.clickhelp.co/api/v1/projects/clickhelp-documentation/articles?q=full-text%20search&count=5&isReturnSnippets=1

Response Fields

FieldTypeDescription
IDString

Topic ID is an alphanumeric topic identifier that becomes a part of the full topic URL in the browser address bar. The topic ID is unique inside one project or publication (e.g. "full-text-search")

fullUrlString

Full topic URL which can be used to open the topic in a web browser.

For example: "https://my-portal.clickhelp.co/articles/some-documentation/full-text-search/"

titleStringThe topic title. 
projectTitleString The title of the project or publication to which the topic belongs. 
projectUrlString The URL identifier of the project or publication to which the topic belongs (e.g. "clickhelp-documentation").
htmlString The HTML content of the topic. This field is populated only when getting a specific single topic via API and is not populated for responses which return multiple topics.
ftsTitleHtmlString The HTML markup of the topic title with a full-text search query matches highlighted. For example, if you search for the "text" keyword, the highlighted topic title can be "Full-Text Search". This field is populated only for full-text search queries executed with the isReturnSnippets parameter greater than zero.
ftsSnippetHtmlString The HTML markup of a topic content snippet with a full-text search query matches highlighted. Similar to text snippets you see for search results in Google. This field is populated only for full-text search queries executed with the isReturnSnippets parameter greater than zero. 

Response Example

{[  
  {  
    "fullUrl":"http://doc.clickhelp.co/articles/clickhelp-documentation/full-text-search",
    "html":null,
    "projectName":"ClickHelp Documentation",
    "projectUrl":"clickhelp-documentation",
    "title":"Full-Text Search",
    "url":"full-text-search"
"ftsTitleHtml":"Full-<strong>Text</strong> Search"
"ftsSnippetHtml":"You can run full-<strong>text</strong> search..." }, { "fullUrl":"http://doc.clickhelp.co/articles/clickhelp-documentation/getting-topics", "html":null, "projectName":"ClickHelp Documentation", "projectUrl":"clickhelp-documentation", "title":"Getting Topics", "url":"getting-topics"
"ftsTitleHtml":"Getting Topics"
"ftsSnippetHtml":"...the one you define in topic properties (e.g. full-<strong>text</strong> search)..." } ]}

Response Codes

All API functions may return error codes listed in the Error Handling topic. Below, are the operation-specific meanings of some response codes:

  • 200 (OK)
    Returned if the information was retrieved successfully.
    Response body contains the data.
  • 403
    The user does not have the permission to access the project or publication.
  • 404
    There is no project or publication with the given URL.