Hi Alessandro,

Can you use a javascript library which handles ajax and json / jsonp
You will end up with much cleaner client code for example a jquery
implementation looks quite nice using solrs neat jsonp support:

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
        }

Their is also a javascript client for solr as well but i've not used this

Cheers Lee C

On 9 December 2010 17:30, alessandro.ri...@virgilio.it <
alessandro.ri...@virgilio.it> wrote:

>
>  Dear all,
>
> First of all sorry for the previous email with missing object.
> I'm trying to call our solr server
> with the json parameter in order to parse it on the client side which
> is javascript.
> My problem is that when I try the
> call (see the code below) using the wiki instructions
> (http://wiki.apache.org/solr/SolJSON)
> the XMLHttpRequest object gets blank when using the W3C standard
> rather then the Microsoft ActiveX which is working just fine.
> Do you know if there is some further
> implementation I have to use in order to get the standard
> implementation working??
>
>
>
> function
> xmlhttpPost(strURL) {
>
> var
> xmlHttpReq = false;
>
> var
> self = this;
>    if
> (window.XMLHttpRequest) { //
> Mozilla/Safari
>
>  self.xmlHttpReq = new
> XMLHttpRequest();
>
>    }
>
> else
> if
> (window.ActiveXObject) { // IE
>
>  self.xmlHttpReq = new
> ActiveXObject("Microsoft.XMLHTTP");
>    }
>
> self.xmlHttpReq.open('GET',
> strURL, true);
>
> self.xmlHttpReq.setRequestHeader('Content-Type',
> 'text/plain;charset=UTF-8'
> );
>
>
>
>
> self.xmlHttpReq.onreadystatechange
> = function()
> {
>
>       if
> (self.xmlHttpReq.readyState == 4) {
>
>     updatepage(self.xmlHttpReq.responseText);
>
>  }
>    }
>
>
> var
> params = getstandardargs().concat(getquerystring());
>
> var
> strData = params.join('&amp;');
>
> self.xmlHttpReq.send(strData);
> }
> Thanks,Alessandro
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
  • SolJSON alessandro.ri...@virgilio.it
    • Re: SolJSON lee carroll
    • Re: SolJSON alessandro.ri...@virgilio.it

Reply via email to