You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Anurag <an...@gmail.com> on 2010/12/16 23:19:59 UTC
Jquery Autocomplete Json formatting ?
this is my output for autosuggest
http://localhost:8983/solr/terms/?terms=true&responseHeader=hide&terms.prefix=so&terms.fl=name&wt=json&indent=true
http://localhost:8983/solr/terms/?terms=true&responseHeader=hide&terms.prefix=so&terms.fl=name&wt=json&indent=true
{
"responseHeader":{
"status":0,
"QTime":0},
"terms":[
"name",[
"solr",2,
"some",2]]}
I have the following Jquery
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script src="http://code.jquery.com/jquery-latest.js"></script>
<link rel="stylesheet"
href="http://dev.jquery.com/view/trunk/plugins/autocomplete/demo/main.css"
type="text/css" />
<link rel="stylesheet"
href="http://dev.jquery.com/view/trunk/plugins/autocomplete/jquery.autocomplete.css"
type="text/css" />
<script type="text/javascript"
src="http://dev.jquery.com/view/trunk/plugins/autocomplete/lib/jquery.bgiframe.min.js"></script>
<script type="text/javascript"
src="http://dev.jquery.com/view/trunk/plugins/autocomplete/lib/jquery.dimensions.js"></script>
<script type="text/javascript"
src="http://dev.jquery.com/view/trunk/plugins/autocomplete/jquery.autocomplete.js"></script>
<script>
$(document).ready(function(){
var source =
"http://localhost:8983/solr/terms/?terms=true&terms.prefix=so&terms.fl=name&wt=json&indent=on";
var c=$("#auto").autocomplete(source, {
minChars: 0,
width: 310,
matchContains: true,
dataType:"json",
});
});
</script>
</head>
<body>
API Reference: <input id="auto" />
</body>
</html>
When the source/data file is simple text file say "array.txt"....then it
works well but when i have the Source: as URL (as in the above case) , then
the suggestions dont appear.....Also when i check the terminal of Solr
server then the queries appear and servering is responding well....But the
suggestion are not appearing in Input Form....
How should i format the Json output to text , show that autosuggest terms
appear in my TextArea..
Thanks
-----
Kumar Anurag
--
View this message in context: http://lucene.472066.n3.nabble.com/Jquery-Autocomplete-Json-formatting-tp2101346p2101346.html
Sent from the Solr - User mailing list archive at Nabble.com.
Re: Jquery Autocomplete Json formatting ?
Posted by lee carroll <le...@googlemail.com>.
I think this could be down to the same server rule applied to ajax requests.
Your not allowed to display content from two different servers :-(
the good news solr supports jsonp which is a neat trick around this try this
(pasted from another thread)
queryString = "*:*"
$.getJSON(
"http://[server]:[port]/solr/
select/?jsoncallback=?",
{"q": queryString,
"version": "2.2",
"start": "0",
"rows": "10",
"indent": "on",
"json.wrf": "callbackFunctionToDoSomethingWithOurData",
"wt": "json",
"fl": "field1"}
);
and the callback function
function callbackFunctionToDoSomethingWithOurData(solrData) {
// do stuff with your nice data
}
cheers lee c
On 16 December 2010 23:18, Anurag <an...@gmail.com> wrote:
>
> Installed Firebug
>
> Now getting the following error
> 4139 matches.call( document.documentElement, "[test!='']:sizzle" );
>
> Though my solr server is running on port8983, I am not using any server to
> run this jquery, its just an html file in my home folder that i am opening
> in my firefox browser.
>
>
>
> -----
> Kumar Anurag
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/Jquery-Autocomplete-Json-formatting-tp2101346p2101595.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>
Re: Jquery Autocomplete Json formatting ?
Posted by Anurag <an...@gmail.com>.
Installed Firebug
Now getting the following error
4139 matches.call( document.documentElement, "[test!='']:sizzle" );
Though my solr server is running on port8983, I am not using any server to
run this jquery, its just an html file in my home folder that i am opening
in my firefox browser.
-----
Kumar Anurag
--
View this message in context: http://lucene.472066.n3.nabble.com/Jquery-Autocomplete-Json-formatting-tp2101346p2101595.html
Sent from the Solr - User mailing list archive at Nabble.com.
Re: Jquery Autocomplete Json formatting ?
Posted by Anurag <an...@gmail.com>.
Installed Firebug
Now getting the following error
4139 matches.call( document.documentElement, "[test!='']:sizzle" );
Though my solr server is running on port8983, I am not using any server to
run this jquery, its just an html file in my home folder that i am opening
in my firefox browser.
-----
Kumar Anurag
--
View this message in context: http://lucene.472066.n3.nabble.com/Jquery-Autocomplete-Json-formatting-tp2101346p2101593.html
Sent from the Solr - User mailing list archive at Nabble.com.
Re: Jquery Autocomplete Json formatting ?
Posted by Ezequiel Calderara <ez...@gmail.com>.
Use firebug to verify if you have any javascript error...
is the webpage running on the same domain or server/port?
There is some browser security standards that doesn't allow to read the
response of a cross domain request...
Maybe its that
On Thu, Dec 16, 2010 at 7:19 PM, Anurag <an...@gmail.com> wrote:
>
> this is my output for autosuggest
>
> http://localhost:8983/solr/terms/?terms=true&responseHeader=hide&terms.prefix=so&terms.fl=name&wt=json&indent=true
>
> http://localhost:8983/solr/terms/?terms=true&responseHeader=hide&terms.prefix=so&terms.fl=name&wt=json&indent=true
>
> {
> "responseHeader":{
> "status":0,
> "QTime":0},
> "terms":[
> "name",[
> "solr",2,
> "some",2]]}
>
> I have the following Jquery
>
> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
> "http://www.w3.org/TR/html4/loose.dtd">
> <html>
> <head>
> <script src="http://code.jquery.com/jquery-latest.js"></script>
> <link rel="stylesheet"
> href="http://dev.jquery.com/view/trunk/plugins/autocomplete/demo/main.css"
> type="text/css" />
> <link rel="stylesheet"
> href="
> http://dev.jquery.com/view/trunk/plugins/autocomplete/jquery.autocomplete.css
> "
> type="text/css" />
> <script type="text/javascript"
> src="
> http://dev.jquery.com/view/trunk/plugins/autocomplete/lib/jquery.bgiframe.min.js
> "></script>
> <script type="text/javascript"
> src="
> http://dev.jquery.com/view/trunk/plugins/autocomplete/lib/jquery.dimensions.js
> "></script>
> <script type="text/javascript"
> src="
> http://dev.jquery.com/view/trunk/plugins/autocomplete/jquery.autocomplete.js
> "></script>
>
>
> <script>
> $(document).ready(function(){
> var source =
> "
> http://localhost:8983/solr/terms/?terms=true&terms.prefix=so&terms.fl=name&wt=json&indent=on
> ";
> var c=$("#auto").autocomplete(source, {
> minChars: 0,
> width: 310,
> matchContains: true,
> dataType:"json",
>
>
> });
>
> });
> </script>
> </head>
>
>
> <body>
> API Reference: <input id="auto" />
> </body>
> </html>
>
>
> When the source/data file is simple text file say "array.txt"....then it
> works well but when i have the Source: as URL (as in the above case) , then
> the suggestions dont appear.....Also when i check the terminal of Solr
> server then the queries appear and servering is responding well....But the
> suggestion are not appearing in Input Form....
>
> How should i format the Json output to text , show that autosuggest terms
> appear in my TextArea..
>
> Thanks
>
> -----
> Kumar Anurag
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/Jquery-Autocomplete-Json-formatting-tp2101346p2101346.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>
--
______
Ezequiel.
Http://www.ironicnet.com