Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot read property 'query' of undefined #72

Closed
Laul0 opened this issue Dec 29, 2018 · 14 comments

Comments

@Laul0
Copy link

commented Dec 29, 2018

Hi,

I'm occurring an error with the JS script but this error is "random".
Sometime, I have to refresh several times the page or the search input sometimes it works directly.
I didn't debug entirely, lack of time, so I provide a screenshot line 3428 and more informations if necessary.

screenshot 2018-12-29 at 19 37 14

Thx

@Windyo

This comment has been minimized.

Copy link
Collaborator

commented Dec 29, 2018

@Windyo

This comment has been minimized.

Copy link
Collaborator

commented Jan 3, 2019

Hey, just a quick notification that I'll go ahead and close this next week if there's no update by then.

@Laul0

This comment has been minimized.

Copy link
Author

commented Jan 3, 2019

This issue still true !
I'm trying to understand what I can do to fix it but for the moment with no success 😢

@melissamcewen

This comment has been minimized.

Copy link

commented Jan 21, 2019

I have this issue in Chrome but not Firefox...and some users say it works in Chrome.

@Nikitozz13

This comment has been minimized.

Copy link

commented Feb 8, 2019

I have encountered the same issue but without "random" - it's permanent issue so I can't retrieve results

@TheBinaryGuy

This comment has been minimized.

Copy link

commented Mar 23, 2019

Hey, any update on this?

@kdyzm

This comment has been minimized.

Copy link

commented May 6, 2019

Is this the same problem?
image
image

@TheBinaryGuy

This comment has been minimized.

Copy link

commented May 6, 2019

Yeah, I think so.

@Laul0

This comment has been minimized.

Copy link
Author

commented May 6, 2019

Hi @kdyzm, ensure that your first error have not an impact with the ghostHunter.
If you can fix your first error and the second one persist, then yes, you have certainly the same error

@jpmacor

This comment has been minimized.

Copy link

commented May 9, 2019

I'm getting a null error in firefox, but a 401 unauthorized in Chrome on the v2 API for ghost:
image
The null error is tracing to the same line as the first post here. This is the 401 on a get request in chrome:
image

Oddly the results return fine in Chrome for me, but in no version of Firefox (tested on iPhone as well). The JS does update div elements in Firefox when I empty the search string and have 0 results. I have SAYT enabled, so that 401 in chrome is only when i click in the search field, as I start typing I get no errors, and the results are displayed properly.

@Laul0

This comment has been minimized.

Copy link
Author

commented May 23, 2019

Hi, I think I found a solution 🙂🎉🥳

Currently, the solution that I'll show you works on my side for Chrome, Safari and Firefox (you can check yourself here: http://blog.lsonline.fr/search/)

Because the indexing is not executed before the search, I forced the indexation by adding manually:

var searchPage = $('#search-field-page').ghostHunter({
    onPageLoad: true,
    ...

Even if into the documentation is mentioned that should be performed automatically (maybe a bug?)

When set true, posts are checked and indexed when a page is loaded. Early versions of ghostHunter default behavior was to initiate indexing when focus fell in the search field, to reduce the time required for initial page loads.
With caching and other changes, this is no longer needed, and this option can safely be set to true always.

Default value is true.

And, to avoid my visitors to search before the end of the indexation, I used the suggestion from the documentation:

indexing_start: function() {
    $('.search-field')
        .prop('disabled', true)
        .addClass('yellow-bg')
        .prop('placeholder', 'Indexing, please wait');
},
indexing_end: function() {
    $('.search-field')
        .prop('placeholder', 'Search …')
        .removeClass('yellow-bg')
        .prop('disabled', false);
}

Hoping that will help you 🙂

@kdyzm

This comment has been minimized.

Copy link

commented May 29, 2019

Hi, I think I found a solution 🥳

Currently, the solution that I'll show you works on my side for Chrome, Safari and Firefox (you can check yourself here: http://blog.lsonline.fr/search/)

Because the indexing is not executed before the search, I forced the indexation by adding manually:

var searchPage = $('#search-field-page').ghostHunter({
    onPageLoad: true,
    ...

Even if into the documentation is mentioned that should be performed automatically (maybe a bug?)

When set true, posts are checked and indexed when a page is loaded. Early versions of ghostHunter default behavior was to initiate indexing when focus fell in the search field, to reduce the time required for initial page loads.
With caching and other changes, this is no longer needed, and this option can safely be set to true always.
Default value is true.

And, to avoid my visitors to search before the end of the indexation, I used the suggestion from the documentation:

indexing_start: function() {
    $('.search-field')
        .prop('disabled', true)
        .addClass('yellow-bg')
        .prop('placeholder', 'Indexing, please wait');
},
indexing_end: function() {
    $('.search-field')
        .prop('placeholder', 'Search …')
        .removeClass('yellow-bg')
        .prop('disabled', false);
}

Hoping that will help you

What is your ghost version? I used docker to deploy, the ghost version number is 2.20.1, and I have been reporting "ghost is not defind". I don't know how to solve it. Do you have any way to solve it?
My website is http://blog.kdyzm.cn

@Laul0

This comment has been minimized.

Copy link
Author

commented May 30, 2019

Currently, I am using 2.22.3.

I didn't change ghostHuner since several previous versions. I'm using docker to deploy my blog too.

I looked on your site but I didn't find your search page to try it I saw that you have a 404 error with valine.min.js.

@kdyzm

This comment has been minimized.

Copy link

commented May 30, 2019

Currently, I am using 2.22.3.

I didn't change ghostHuner since several previous versions. I'm using docker to deploy my blog too.

I looked on your site but I didn't find your search page to try it I saw that you have a 404 error with valine.min.js.

Thank you for your help, everything has changed after upgrading ghost hunters.there is new code merged to master branch today, it works for me...But it seems that Chinese search is not supported.

@Laul0 Laul0 closed this Jun 22, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
7 participants
You can’t perform that action at this time.