What is Docsearch type

Hi, I’m looking at the ‘type’ fields in docsearch and I have a couple of questions

  1. What are legit values for type?
  2. How is type used?
  3. In Docsearch insta-search widget does type interact with highlighted/snippits ?
  4. Is there a website with the canonical implementation of type?

Putting together my own content extractor for docusuarus-search with algolia, and I want to make sure I get this right.

@eosnetwork Can you give some context? What do you mean by “I’m looking at the ‘type’ fields in docsearch”? In the code, in the UI? Can you share a reference URL?

Using Docusarus, and the Algolia plugin referenced in these documents here → https://docsearch.algolia.com/ . The search widget uses a convention for the record format in the index. For example search expects a language as a field in the records, and uses language as part of every query.

One of the expected fields is ‘type’. I have set it to the deepest hierarchy of data in the document. So if the document has only an H1 tag and no H2… tags ‘type’ = ‘lvl1’. If the the document has H1, H2, H3 documents I set type to ‘type’ = ‘lvl3’.

I am indexing my own documents. The record format is clearly spelled out in the Docsearch documentation. The acceptable and expected values for the fields in those records isn’t there. At least I can’t find it. If the values are incorrect search doesn’t work. For example if language has a value of ‘english’ nothing would be returned.

@eosnetwork From what I see, every heading (lvl0-6) and paragraph of content has its own record in the index. Your understanding of type is correct.

  • (for paragraphs of content) type: "content" and you should expect content not to be null.
  • (for headings) type: "lvl0-6" and content: null
1 Like

Interesting, I made one record per document. That explains why the snippets/highlights are off. Thanks for the help.