• Resolved Fibro Jedi

    (@fibrojedi)


    Heya,

    So I’m trying (again) to get RelevanSSI working and am failing again.

    When I try to build the index the following JavaScript error is generated.

    12:10:33.040 Truncating index. admin_scripts_free.js:19:11
    12:10:33.807 Uncaught SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data
        <anonymous> URL/relevanssi/lib/admin_scripts_free.js:22
        jQuery 7
            c
            fireWith
            l
            o
            send
            ajax
            i
        <anonymous> URL/relevanssi/lib/admin_scripts_free.js:21
        jQuery 9
        <anonymous> URL/relevanssi/lib/admin_scripts_free.js:2
        jQuery 13
    admin_scripts_free.js:22:29

    I’ve replaced the path to the plugin folder with URL here, that’s not part of the error.

    I’ve done a cache clear server-side, hard clear etc. But the error returned. I’ve had to deactivate it while we figure it out as it makes the normal search return no results when the index is empty.

    Thanks!

Viewing 10 replies - 16 through 25 (of 25 total)
  • Plugin Author Mikko Saari

    (@msaari)

    You can debug this further by modifying the file /lib/admin_scripts_free.js in Relevanssi. Before each line with JSON.parse(response) in it add

    console.log(response)

    This will print out the response to the console. Perhaps that’ll help.

    Thread Starter Fibro Jedi

    (@fibrojedi)

    Okay thanks, I will try that soonish then and see if I can’t find it. Thanks for the tip ??

    Thread Starter Fibro Jedi

    (@fibrojedi)

    Sorry for the inordinately long delay – life’s been a bit crazy.

    So I did the above and the console.log above added

    <html><head></head><body>true</body></html>

    The full console error message are

    13:03:29.026 Uncaught SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data
        <anonymous> https://site/relevanssi/lib/admin_scripts_free.js:23
        jQuery 7
            c
            fireWith
            l
            o
            send
            ajax
            i
        <anonymous> https://site/relevanssi/lib/admin_scripts_free.js:21
        jQuery 9
            dispatch
            handle
            add
            Ee
            each
            each
            Ee
            on
            n
        <anonymous> https://site/relevanssi/lib/admin_scripts_free.js:2
        jQuery 13
    admin_scripts_free.js:23:29
        <anonymous> hhttps://site/relevanssi/lib/admin_scripts_free.js:23
        jQuery 7
            c
            fireWith
            l
            o
            (Async: EventHandlerNonNull)
        send
            ajax
            i
        <anonymous> https://site/relevanssi/lib/admin_scripts_free.js:21
        jQuery 9
            dispatch
            handle
            (Async: EventListener.handleEvent)
        add
            Ee
            each
            each
            Ee
            on
            n
        <anonymous> https://site/relevanssi/lib/admin_scripts_free.js:2
        jQuery 13
            e
            t
            (Async: setTimeout handler)
        l
            c
            fireWith
            fire
            c
            fireWith
            ready
            B
            (Async: EventListener.handleEvent)
        <anonymous>
            <anonymous>
            <anonymous>

    And I definitely still cannot build the index, even after having done a few cache clears. And I’m definitely still on the latest version of RelevanSSI too.

    Thanks in advance.

    • This reply was modified 2 years, 7 months ago by Fibro Jedi. Reason: Removing explicite URLs
    • This reply was modified 2 years, 7 months ago by Fibro Jedi.
    Thread Starter Fibro Jedi

    (@fibrojedi)

    Update: I’ve got it to move on to a new stage, by taking the bizarrely html-tagged response variable and making it a boolean.

    if(jQuery(response).text()=="true"){ response = true; }
     if(jQuery(response).text()=="false"){ response = false; }

    So it now gets to ‘counting posts…’ and the response variable is even weirder.

    <html><head></head><body>"504"</body></html>

    So this response is not just the number 504, but it’s wrapped in speech marks.

    Anyway, the root cause of this seems to be the response variable getting wrapped in HTML tags. And I have no idea why it would do that.

    • This reply was modified 2 years, 7 months ago by Fibro Jedi.
    Plugin Author Mikko Saari

    (@msaari)

    That’s probably a 504 Gateway Timeout error.

    Anyway, there’s indeed your problem: something is wrapping the JSON responses in HTML tags. I have no idea what that could be; I would recommend asking on general WordPress support forums.

    Thread Starter Fibro Jedi

    (@fibrojedi)

    And I have finally got it attempting to build my index.

    response = jQuery(response).text()
     response = parseInt(response.replace(/[^a-z0-9\s]/gi, ''));

    Now I just need to figure out why the results page creates a massive blank header:

    See:
    https://fibrojedi.me.uk/?s=shire+deeds&submit=Search

    I’ll also have to take a backup of that JS file, because as soon as you do an update to it, I’ll lose my fixes.

    Thread Starter Fibro Jedi

    (@fibrojedi)

    Having looked at it – I think the massive header has nothing to do with RelevanSSI.

    So I can finally close this for you. Thanks for hearing me out. And sorry it took me so long to settle and fix it ??

    Plugin Author Mikko Saari

    (@msaari)

    No problem. Glad everything’s working better now.

    Thread Starter Fibro Jedi

    (@fibrojedi)

    Much better thank you.

    Though I did just deactivate RelevanSSI and the huge gap at the top disappeared, then reappeared on reactivation.

    It looks like, once I solve this I finally have your plugin working ??

    Thread Starter Fibro Jedi

    (@fibrojedi)

    Okay I’ve solved that so you can ignore the above, thanks again!

Viewing 10 replies - 16 through 25 (of 25 total)
  • The topic ‘Uncaught SyntaxError: JSON.parse: unexpected character at line 1 column 1’ is closed to new replies.