Giter VIP home page Giter VIP logo

Comments (16)

christian-fei avatar christian-fei commented on May 25, 2024 4

@lengerfulluse I think it's because of an invalid JSON,

callback(err, null)

Try to validate it here: http://jsonlint.com/

from simple-jekyll-search.

lengerfulluse avatar lengerfulluse commented on May 25, 2024

I got the similar error about can't found the search.json. My search json just put in the path root. Could you please help to check it?
simple_jekyll_search-error

from simple-jekyll-search.

christian-fei avatar christian-fei commented on May 25, 2024

Thanks for reporting, and sorry for the inconvenience :(

Could you please post the code how you initialize the library?

from simple-jekyll-search.

daviddarnes avatar daviddarnes commented on May 25, 2024

If this is related to the initialising the plugin then I might have had the same issue basekit/docs.basekit.com#89

from simple-jekyll-search.

nakoo avatar nakoo commented on May 25, 2024

@christian-fei: Here you go. =)

SimpleJekyllSearch({
searchInput: document.getElementById('input'),
resultsContainer: document.getElementById('results'),
dataSource: '/search.json'
})

from simple-jekyll-search.

christian-fei avatar christian-fei commented on May 25, 2024

Ah i see, it seems you're missing the 'json' field (instead of dataSource).
I did a terrible job at versioning this time, will do better in the future.

https://github.com/christian-fei/Simple-Jekyll-Search#json-stringjson-required

Please let me know if it works, and sorry for the waste of time

from simple-jekyll-search.

nakoo avatar nakoo commented on May 25, 2024

@christian-fei: Oh, I didn't notice that. It works! Thanks =)

from simple-jekyll-search.

daviddarnes avatar daviddarnes commented on May 25, 2024

@christian-fei that'll explain why my version breaks when I update. Could this be documented somewhere for people who upgrade their version of the package?

from simple-jekyll-search.

lengerfulluse avatar lengerfulluse commented on May 25, 2024

@christian-fei would you please help to take a look my code? It just keep with the error of 'failed to get JSON'(as the the screenshot state above).
Here is my javascript code:

<script src="/dest/jekyll-search.js" type="text/javascript"></script>
<script type="text/javascript">
  SimpleJekyllSearch({
    searchInput: document.getElementById('search'),
    resultsContainer: document.getElementById('results-container'),
    json: '/search.json',
    searchResultTemplate: '<li><a href="{url}" title="{desc}">{title}</a></li>',
    noResultsText: 'No results found',
    limit: 10,
    fuzzy: false,
    exclude: ['Welcome']
  })
</script>

and my css code is as following:

       <div class="nav-search">
            <span class="search-input"><input type="text" id="search" placeholder="Article..." /></span>
            <span class="icon"><i class="fa fa-search"></i></span>
            <ul id="results-container"></ul>
        </div>

Thanks in advance!

from simple-jekyll-search.

nakoo avatar nakoo commented on May 25, 2024

@lengerfulluse: Did you add simple_search_filter.rb file to _plugins folder?
https://github.com/christian-fei/Simple-Jekyll-Search#if-search-isnt-working-due-to-invalid-json
also check in json file whether to have set up 'remove_chars'.
I think the problem is occurred for the setting of full-text search.

from simple-jekyll-search.

lengerfulluse avatar lengerfulluse commented on May 25, 2024

Wow, It did was caused by the setting of full-text search, which caused a invalid JSON.
Cool! Thanks @nakoo and @christian-fei !

from simple-jekyll-search.

lengerfulluse avatar lengerfulluse commented on May 25, 2024

Sorry guys, I just found that it only work in localhost( i run jekyll s , and search plugin can work well on localhost:4000). Unfortunately thing is that once i put the code into online(http://t.hengwei.me), it still got the same error of failed to get /search.json. Do you have ever met the similar problems? Thanks in advance!

from simple-jekyll-search.

stramargio avatar stramargio commented on May 25, 2024

First of all, thanks in advance for your code!

Here the problem still remains...
JSON is well formatted, the path is in the right place, but it still got the same error:

Uncaught Error: SimpleJekyllSearch --- failed to get JSON (/search.json)

Here the way I initialize the plugin:

SimpleJekyllSearch({
  searchInput: document.getElementById('search-input'),
  resultsContainer: document.getElementById('results-container'),
  json: '/search.json'
});

And this is the well-formatted json... Any idea?

from simple-jekyll-search.

una avatar una commented on May 25, 2024

I was getting the same problem, @kentoo -- adding the plugin to strip characters solved it for me (it turns out I had some @ in a tag (for @import) and it was creating invalid json

from simple-jekyll-search.

stramargio avatar stramargio commented on May 25, 2024

It's true! Thanks a lot.

from simple-jekyll-search.

christian-fei avatar christian-fei commented on May 25, 2024

Thanks @una !

from simple-jekyll-search.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.