LogoLogo
  • LEARN
    • Overview
    • Capabilities
      • Rich and Diverse Assets
      • Organised Collections
      • Asset Lifecycle Management
      • Powerful Discovery
      • Phygital Discovery
      • Observability
    • Technical Architecture
    • Product & Developer Guide
      • Content Service
        • Content APIs
          • Features
          • Architecture
          • Code Structure
          • Schemas
          • APIs
          • Jobs
            • Content publish
            • Asset enrichment
            • Audit event generator
            • Video stream generator
          • FAQs
            • Upload Content
        • Media APIs
          • Features
          • Architecture
          • Schemas
          • APIs
          • Jobs
            • Asset enrichment
            • Audit event generator
          • FAQs
        • Channel APIs
          • Architecture
          • Schema
          • APIs
          • Configuration
          • FAQs
        • License APIs
          • Architecture
          • Schema
          • APIs
          • Configuration
          • FAQs
        • Collection APIs
          • Features
          • Architecture
          • Schemas
          • APIs
          • Jobs
            • Content publish
            • Post publish processor
            • Audit event generator
          • FAQs
      • Search Service
        • Architecture
        • Code Structure
          • Configuration
        • APIs
        • Jobs
          • Search indexer
          • Audit history indexer
        • FAQs
      • Taxonomy Service (Taxonomy & Tagging)
        • Framework APIs
          • Architecture
          • Code Structure
            • Configuration
          • Schemas
          • APIs
          • Jobs
            • Audit event generator
          • FAQs
            • Create Framework
            • Add Content to Framework
        • Object Category APIs
          • Architecture
          • Code Structure
          • Schemas
          • APIs
          • Jobs
            • Audit event generator
          • Configuration
          • FAQs
      • DIAL Service
        • Architecture
        • APIs
        • Jobs
        • Configuration
        • FAQs
          • Link DIAL Code to a Book
      • Player
        • V1
          • Features
          • Architecture
          • Players
            • ECML Player - v1
              • Quiz
              • Create Content
            • Video Player v1
            • Epub Player - v1
            • PDF Player - v1
            • HTML-h5p Player - v1
          • Content import and preview folder creation
          • FAQs
        • V2
          • PDF Player
            • Features
            • Architecture
            • Configuration
            • FAQ's
          • Epub Player
            • Features
            • Architecture
            • Configuration
            • FAQ's
          • Video Player
            • Features
            • Architecture
            • Configuration
            • FAQ's
        • Telemetry Events
          • Offline Telemetry
          • Generate API keys
      • Editors
        • Architecture
        • Interactive Editor
          • Features
            • Content Editor
            • Adding Question Set
            • Concept Selector
            • Add Image
            • Add Video
            • Adding Math Function
            • Limited Publishing and Sharing
        • File Upload Editor
          • Features
          • FAQ's
            • Content Upload
        • Collection Editor - V1
        • Collection Editor - V2
          • Features
          • Architecture
          • APIs
          • FAQ's
        • How to contribute as a JS plugin
          • How do I think about a plugin?
          • Interactive Editor Plugin Guide
          • Using SDK to create and test the plugin
      • Other Knowlg Jobs
        • Configuration
        • FAQs
      • Other
        • Data Migration
        • Schema strucure
    • Product Roadmap
  • ENGAGE
    • Discuss
    • Contribute to SB Knowlg
  • USE
    • Overview
    • System requirements
    • Installation guide
      • Players
        • V1
          • How to setup
        • V2
          • Epub Player
          • Video Player
          • Pdf Player
      • Editors
        • Interactive Editor
        • File Upload Editor
        • Collection Editor - V1
        • Collection Editor - V2
        • Plugins
      • Services
        • Content Service
          • Configuration
        • Search Service
        • Taxonomy Service (Taxonomy & Tagging)
        • DIAL Service
        • Knowlg Jobs
    • Deployment
    • Release notes
      • Release - 6.2.0 (Ongoing)
      • Release - 6.1.0 (latest)
      • Release - 6.0.0
      • Release - 5.7.0
      • Release - 5.6.0
      • Release - 5.5.0
      • Release - 5.4.0
      • Release - 5.3.0
      • Release - 5.2.0
      • Release - 5.1.0
      • Release - 5.0.0
      • Release - 4.10.0
      • Release - 4.8.0
    • Breaking Changes
    • Deprecations
      • Release-5.2.0
      • Release-5.1.0
    • Release
    • USE
      • Infra Requirements
    • Additional Reading
      • Content Service Environment Variables
      • Import External Content
  • Archived
    • Powerful Discovery
      • Usecase
      • Sample data
Powered by GitBook
On this page
  • Samples of how to use filter operators in composite search API?
  • What are the different modes that can be passed in search request?
  • What is 'softConstraints' in search request?
  • Is 'Fuzzy Search' enabled in search API?

Was this helpful?

Edit on GitHub
  1. LEARN
  2. Product & Developer Guide
  3. Search Service

FAQs

This page addresses frequently asked questions about Composite Search API.

Samples of how to use filter operators in composite search API?

Sample 1 - Find all node types that contain specific search term (content, words, assets)

{ "request": { "query":"elephant", "limit":10 } }

Sample 2 - Find only TextBook

{ "request": {"filters":{"primaryCategory":"Digital Textbook"}, "limit":10 } }

Sample 3 - Find "Explanation Content" less than 1MB

{ "request": {"filters":{"primaryCategory":"Explanation Content", "size": {"<=" : "1000000"}}, "limit":10 } }

Sample 4 - Find resources whose 'name' starts with "A" (e.g. for alphabetic navigation)

{ "request": { "filters": { "primaryCategory":"Explanation Content", "name": { "startsWith": "A" } } } }

Sample 5 - Find resources without 'appIcon'

{ "request": { "filters": { "primaryCategory":"Explanation Content" }, "not_exists":["appIcon"] } }

Sample 6 - Find resources with 'appIcon'

{ "request": { "filters": { "primaryCategory":"Explanation Content"}, "exists":["appIcon"] } }

Sample 7 - Find resources and aggregate results by 'language' and 'subject'

{ "request": { "filters": { "primaryCategory":"Explanation Content"}, "facets":["language","subject"] } }

Sample 8 - Find resources and sort results by name ascending and size desc

{ "request": { "filters": { "primaryCategory":"Explanation Content"}, "sort_by":{"name":"asc", "size":"desc"} } }

Sample 9 - Get first 10 results

{ "request": { "filters": { "primaryCategory":"Explanation Content"}, "sort_by":{"name":"asc", "size":"desc"}, "offset": 0, "limit": 10 } }

Sample 10 - Get 4th page of results. Results from 30 - 40 index.

{ "request": { "filters": { "primaryCategory":"Explanation Content"}, "sort_by":{"name":"asc", "size":"desc"}, "offset": 30, "limit": 10 } }

Sample 11 - Get the fields specified.

{ "request": { "filters": { "primaryCategory":"Explanation Content"}, "exists":["appIcon"], "fields":["name","description","identifier","mimeType","createdOn"] } }

Sample 12 - Search for content with soft constraints

{ "request": { "filters": { "objectType": ["Content"], "primaryCategory": ["Explanation Content"], "gradeLevel" : ["Grade 1"], "ageGroup" : ["5-6"], "status": ["Live"] }, "mode" : ["soft"], "softConstraints": {"ageGroup" : 2, "gradeLevel" : 3 } } }

Sample 13 - Find "Explanation Content" created between a time range

{ "request": { "filters": { "primaryCategory":"Explanation Content", "createdOn": {">=":"2020-07-28T01:27:16.559+0000", "<":"2021-10-28T01:27:16.559+0000"} }, "sort_by":{"name":"asc"}, "offset": 0, "limit": 10 } }

Sample 14 - Find published Textbooks to which a content is linked to

{ "request": { "filters": { "primaryCategory":"Digital Textbook", "leafNodes": {"contains": "do_Id___content"} }, "sort_by":{"name":"asc"} } }

What are the different modes that can be passed in search request?

There are 2 modes in search. 'soft' and 'collection' mode. By default, mode is 'soft' in a search request if the same is not specified. When the mode is specified as 'collection', then the search result will contain 'collections' block which will have the metadata of collections of the collection units that is part of the search result

Example:

curl --location --request POST 'https://dev.sunbirded.org//api/content/v1/search' \
--header 'Content-Type: application/json' \
--data-raw '{
    "request": {
        "filters": {
            "status":["Live"],
            "visibility": ["Default","Parent"],
            "dialcodes":["BBU2JE"]
        },
        "mode": "Collection"
    }
}'


Response:
"result": {
        "collections": [
            {
                "identifier": "do_31277376449209958415961",
                "subject": [
                    "Mathematics"
                ],
                "childNodes": [
                    "do_31277376466550784015998"
                ],
                "mimeType": "application/vnd.ekstep.content-collection",
                "medium": [
                    "English"
                ],
                "objectType": "Collection",
                "gradeLevel": [
                    "Class 9"
                ],
                "appIcon": "https://ntpproductionall.blob.core.windows.net/ntp-content-production/content/do_31277376449209958415961/artifact/9-maths_1527603481839.thumb.jpg",
                "size": 2660278,
                "name": "B566_STD_9_MATHS_EM_FULL",
                "contentType": "TextBook",
                "board": "State (Tamil Nadu)",
                "resourceType": "Book"
            }
        ],
        "count": 1,
        "content": [
            {
                "parent": "do_31277376466550784016000",
                "code": "do_31277376466550784015998",
                "purpose": "HS",
                "channel": "01235953109336064029450",
                "downloadUrl": "https://ntpproductionall.blob.core.windows.net/ntp-content-production/ecar_files/do_31277376449209958415961/b566_std_9_maths_em_full_1602760532721_do_31277376449209958415961_7.0_spine.ecar",
                "description": "B566U2P63HS",
                "mimeType": "application/vnd.ekstep.content-collection",
                "variants": {
                    "online": {
                        "ecarUrl": "https://ntpproductionall.blob.core.windows.net/ntp-content-production/ecar_files/do_31277376449209958415961/b566_std_9_maths_em_full_1602760535048_do_31277376449209958415961_7.0_online.ecar",
                        "size": 178355
                    },
                    "spine": {
                        "ecarUrl": "https://ntpproductionall.blob.core.windows.net/ntp-content-production/ecar_files/do_31277376449209958415961/b566_std_9_maths_em_full_1602760532721_do_31277376449209958415961_7.0_spine.ecar",
                        "size": 2660278
                    }
                },
                "leafNodes": [
                    "do_31283041754486374417786",
                    "do_31283041255128268819778"
                ],
                "createdOn": "2019-05-31T10:10:44.520+0000",
                "objectType": "Content",
                "primaryCategory": "Textbook Unit",
                "children": [
                    "do_31283041255128268819778",
                    "do_31283041754486374417786"
                ],
                "lastUpdatedOn": "2020-10-15T11:15:24.872+0000",
                "contentType": "TextBookUnit",
                "dialcodeRequired": "Yes",
                "identifier": "do_31277376466550784015998",
                "lastStatusChangedOn": "2019-05-31T10:10:44.520+0000",
                "audience": [
                    "Student"
                ],
                "visibility": "Parent",
                "index": 5,
                "languageCode": [],
                "graph_id": "domain",
                "nodeType": "DATA_NODE",
                "pkgVersion": 7,
                "versionKey": "1559297444520",
                "framework": "tn_k-12_5",
                "dialcodes": [
                    "BBU2JE"
                ],
                "depth": 2,
                "lastPublishedOn": "2020-10-15T11:15:30.038+0000",
                "compatibilityLevel": 1,
                "leafNodesCount": 2,
                "name": "2.6.2 Laws of Radicals",
                "status": "Live",
                "node_id": 0
            }
        ],
        "collectionsCount": 1
    }

In the above example 'Response',

"collections" block gives the information of the TextBook that contains the 'TextBookUnit' to which DIAL Code is tagged to. "identifier" - id of the TextBook, "name" - name of the TextBook, "board" - board value to which TextBook is tagged to. similarly, "medium", "gradeLevel" (Class) and "subject" values.

"content" block gives the information of the TextBook Unit DIAL Code is tagged to. "identifier" - id of the TextBook Unit, "name" - name of the TextBook Unit, "topic" - topics/concepts to which Unit is tagged with.

What is 'softConstraints' in search request?

'softConstraints' is used to fetch results from ElasticSearch by boosting the relevance of a document based on a particular value of a field.

Is 'Fuzzy Search' enabled in search API?

No. Fuzzy search has not been implemented in the search API.

PreviousAudit history indexerNextTaxonomy Service (Taxonomy & Tagging)

Last updated 2 years ago

Was this helpful?