Docfx: Search button functionality across the site

Created on 24 Apr 2018  路  13Comments  路  Source: dotnet/docfx

DocFX Version Used: 2.21.1.1

Template used: custom template

Steps to Reproduce:

  • script in docfx.js?

Expected Behavior:
Search button should return and highlight all matching words from the entire site.

Actual Behavior:
Search button doesn't return any result, no other message is displayed

Area-Template

Most helpful comment

@Still34 @cbenea Have you enabled ExtractSearchIndex in docfx.json? Here's a sample.

All 13 comments

Is there a file named index.json generated by DocFX? I got a 404 while accessing your webiste with this URL:http://developer.temenos.com/index.json.

For other examples, like documentation site for DocFX, the index.json could be accessed via http://dotnet.github.io/docfx/index.json.

I'd like to chime in on this issue as well - our docfx does generate index.json; however, the search always returns nothing. Our documentation preview. This was working several revisions before.

Hi!
I searched for index.json but indeed it seems I don't have it.
What should I do?
I really appreciate your help to solve this. Thank you!

@Still34 @cbenea Have you enabled ExtractSearchIndex in docfx.json? Here's a sample.

No, but no changes after enabling it.

I enabled it now and it works for me. Thank you very much!

@Still34 From docfx.json, you haven't enabled ExtractSearchIndex.

@qinezh As mentioned earlier, I have enabled it on my local repo, and it still does not work even after force rebuilding.

Image

@Still34 Have you try build your documents with default template? I find there is an error in JS when rendering the page, whose source is from your custom template. The error may affect other JS, which search feature relies on.

Uncaught SyntaxError: Identifier 'baseUrl' has already been declared
at styleswitcher.js:1

@superyyrrzz Yes, the search stopped working before the recent theme switcher implementation.

@Still34 Could you try fixing the error in the switcher then see if the search will work?

@superyyrrzz Found the reason. DocFX ships with an older version of jQuery with docfx.vendor.js, and our theme references a newer version so DocFX got confused.

@Still34 Looks like the root cause of the issue has been identified. Do you need more help from DocFX side?

@superyyrrzz as FYI

Was this page helpful?
0 / 5 - 0 ratings