Search inside project version
  • 27 Aug 2022
  • 2 Minutes to read
  • Contributors
  • Dark
    Light

Search inside project version

  • Dark
    Light

GET /projectversions/{id}/{langcode} 

Searches for a phrase inside project version in a given language


Header

ParameterTypeDescription
api_tokenstringYou can get the REST API from Settings > Advanced > API tokens.

Route Parameters

ParameterRequiredTypeDescription
idYesstringThe ID of the project version
langCodeYesstringLanguageCode for multilingual (Default value is en)
pageNonumberSpecify the page to retrieve. Page numbers are zero-based. So, to retrieve the 10th page, you need to set the page as 9. The default value is 0.
hitsPerPageNonumberNumber of records/results to be fetched per page. The default value is 10.


Query Parameters

ParameterRequiredTypeDescription
searchQueryNostringThe phrase to search across all articles in the project version for the given language


Sample Response

{
    "data": {
        "hits": [
            {
                "title": "Why did we build Document360?",
                "content": "Thank you very much for signing up for Document360.",
                "isHidden": true,
                "tags": "123",
                "slug": "hello-why-doc360",
                "version": 7,
                "articleId": "4f52cd46-ca5c-4dc2-8ae1-16030e0ba168",
                "categoryId": "bf973e0b-583d-4ad4-9ae1-c713d7a18181",
                "isCategoryHidden": false,
                "order": 1,
                "isDraft": false,
                "exclude": false,
                "objectID": "c9c97758-bd24-43b0-a916-d45d7b9b6d18",
                "_snippetResult": {
                    "content": {
                        "value": "Thank you very much for signing up for Document360.\nDocument360 is born out of our own frustrations in writing product <em>documentation</em> for our other products for the past 5+ years. We initially started the hunt to find a suitable alternative product in the market to strengthen our product <em>documentation.</em>\nAfter",
                        "matchLevel": "partial"
                    }
                },
                "_highlightResult": {
                    "title": {
                        "value": "Why did we build Document360?",
                        "matchLevel": "none",
                        "matchedWords": []
                    }
                }
            }
        ],
        "nbHits": 6,
        "page": 0,
        "nbPages": 1,
        "hitsPerPage": 20,
        "processingTimeMS": 1,
        "exhaustiveNbHits": true,
        "query": "api documentation",
        "params": "query=api+documentation"
    },
    "extension_data": null,
    "context": null,
    "success": true,
    "errors": [],
    "warnings": [],
    "information": []
}


Response Data

ParameterTypeDescription
hitsobject[]The results of the search
nbHitsnumberThe number of hits matched by the query.
pagenumberIndex of the current page (zero-based).
nbPagesnumberThe number of returned pages. The calculation is based on the total number of hits (nbHits) divided by the number of hits per page (hitsPerPage), rounded up to the nearest integer.
hitsPerPagenumberThe maximum number of hits returned per page.
processingTimeMSnumberThe time the server took to process the request(in milliseconds). This does not include network time.
exhaustiveNbHitsbooleanWhether the nbHits is exhaustive (true) or approximate (false). An approximation is done when the query takes more than 50ms(millisecond) to be processed (this can happen when using complex filters on millions of records).
querystringAn echo of the query text.
paramsstringA URL-encoded string of all search parameters.

Response > hits

Hits object is a response coming from Algolia APIs, below you will find some information about the values, you can read more on their documentation

ParameterTypeDescription
titlestringArticle title
contentstringArticle HTML content
isHiddenbooleanIndicates if the article is visible on the site
tagsstring[]Custom article tags
slugstringThe slug of the article
versionstringThe version number that is currently published
articleIdstringThe ID of the article
categoryIdstringThe ID of the category
isCategoryHiddenbooleanIndicates if category is visible on the site
ordernumberThe position inside the parent category
isDraftbooleanIndicates if the article is marked as a draft
excludebooleanIndicates if the article is excluded from search results on user website
objectIdstringalgolia search object ID
snipetResultobjectMarkup text with occurrences highlighted.
highlightResultobjectHighlighted attributes

Hits > snippetResult

ParameterTypeDescription
valuestringMarkup text with occurrences highlighted.
matchLevelstringIndicates how well the attribute matched the search query. Can be: none, partial, full

Hits > highlightResult

ParameterTypeDescription
valuestringMarkup text with occurrences highlighted.
matchLevelstringIndicates how well the attribute matched the search query. Can be: none, partial, full
matchedWordsstring[]List of words from the query that matched the object.

Was this article helpful?

What's Next