Note that there are some explanatory texts on larger screens.

plurals
  1. POAccess variable in JSON with JQuery
    primarykey
    data
    text
    <p>I'm having difficulty accessing a variable returned from solr in JSON format. I'm using JQuery.</p> <p>My JSON response looks like this</p> <pre><code>{ "responseHeader":{ "status":0, "QTime":44, "params":{ "indent":"true", "q":"title:\"clrfying clan\" OR title:clrfying clan OR text:\"clrfying clan\" OR text:clrfying clan", "wt":"json"}}, "response":{"numFound":0,"start":0,"docs":[] }, "spellcheck":{ "suggestions":[ "clrfying",{ "numFound":1, "startOffset":7, "endOffset":15, "suggestion":["clarifying"]}, "clan",{ "numFound":1, "startOffset":16, "endOffset":20, "suggestion":["clean"]}, "clrfying",{ "numFound":1, "startOffset":31, "endOffset":39, "suggestion":["clarifying"]}, "clan",{ "numFound":1, "startOffset":40, "endOffset":44, "suggestion":["clean"]}, "clrfying",{ "numFound":1, "startOffset":54, "endOffset":62, "suggestion":["clarifying"]}, "clan",{ "numFound":1, "startOffset":63, "endOffset":67, "suggestion":["clean"]}, "clrfying",{ "numFound":1, "startOffset":77, "endOffset":85, "suggestion":["clarifying"]}, "clan",{ "numFound":1, "startOffset":86, "endOffset":90, "suggestion":["clean"]}, "collation",[ "collationQuery","title:\"clarifying clean\" OR title:clarifying clean OR text:\"clarifying clean\" OR text:clarifying clean", "hits",44, "misspellingsAndCorrections",[ "clrfying","clarifying", "clan","clean", "clrfying","clarifying", "clan","clean", "clrfying","clarifying", "clan","clean", "clrfying","clarifying", "clan","clean"]]]}} </code></pre> <p>The part I want to access is </p> <pre><code>"collation",[ "collationQuery","title:\"clarifying clean\" OR title:clarifying clean OR text:\"clarifying clean\" OR text:clarifying clean", </code></pre> <p>I can't seem to access it though. I get this response using JQuery with the following code</p> <pre><code>$.getJSON("http://mydomain.com/solrsearch?q=title%3A%22clrfying%20clan%22+OR+title%3Aclrfying%20clan+OR+text%3A%22clrfying%20clan%22+OR+text%3Aclrfying%20clan&amp;wt=json&amp;indent=true", function(resp){}) </code></pre> <p>I have tried to access collationQuery like this resp.spellcheck.suggestions.collation.collationQuery but I think I must be doing it incorrectly because it returns empty.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload