Hi rhys, if you are taking the PHP route for the mentioned server part then I would suggest using a client library, not plain curl. There is solarium, for instance:
https://solarium.readthedocs.io/en/stable/ https://github.com/solariumphp/solarium It can use curl under the hood but you can program your stuff on a higher level, against an API. Christian > Am 25.11.2019 um 07:09 schrieb Paras Lehana <paras.leh...@indiamart.com>: > > Hey rhys, > > What David suggested is what we do for querying Solr. You can figure out > our frontend implementation of Auto-Suggest by seeing the AJAX requests > fired when you type in the search box on www.indiamart.com. > > Why are you using two jQuery files? If you have a web server, you already > know that which core you queried from. Just convert the Solr JSON response > and add the key "core" and return the modified JSON response. Keep your > front-end query simple - just describe your query. All the other parameters > can be added on the web server side. Anyways, why do you want to know the > core name? > > On Sat, 23 Nov 2019 at 00:23, David Hastings <hastings.recurs...@gmail.com> > wrote: > >> i personally dont like php, but it may just be the easiest way to do what >> you need assuming you have a basic web server, >> send your search query to php, and use $_GET or $_POST to read it into a >> variable: >> https://www.php.net/manual/en/reserved.variables.get.php >> >> then send that to the solr server in the same piece of php with curl >> >> https://phpenthusiast.com/blog/five-php-curl-examples >> >> and return the raw result if you want. at the very least it hides its url, >> but with this you can block the solr port to outside ip's and only allow 80 >> or whatever your webserver is using >> >> >> On Fri, Nov 22, 2019 at 1:43 PM rhys J <rhyssha...@gmail.com> wrote: >> >>> On Fri, Nov 22, 2019 at 1:39 PM David Hastings < >>> hastings.recurs...@gmail.com> >>> wrote: >>> >>>> 2 things (maybe 3): >>>> 1. dont have this code facing a client thats not you, otherwise anyone >>>> could view the source and see where the solr server is, which means >> they >>>> can destroy your index or anything they want. put at the very least a >>>> simple api/front end in between the javascript page for the user and >> the >>>> solr server >>>> >>> >>> Is there a way I can fix this? >>> >>> >>>> 2. i dont think there is a way, you would be better off indexing an >>>> indicator of sorts into your documents >>>> >>> >>> Oh this is a good idea. >>> >>> Thanks! >>> >>> 3. the jquery in your example already has the core identified, not sure >> why >>>> the receiving javascript wouldn't be able to read that variable unless >> im >>>> missing something. >>>> >>>> >>> There's another function on_data that is being called by the url, which >>> does not have any indication of what the core was, only the response from >>> the url. >>> >>> Thanks, >>> >>> Rhys >>> >> > > > -- > -- > Regards, > > *Paras Lehana* [65871] > Development Engineer, Auto-Suggest, > IndiaMART Intermesh Ltd. > > 8th Floor, Tower A, Advant-Navis Business Park, Sector 142, > Noida, UP, IN - 201303 > > Mob.: +91-9560911996 > Work: 01203916600 | Extn: *8173* > > -- > IMPORTANT: > NEVER share your IndiaMART OTP/ Password with anyone. -- Christian Spitzlay Senior Software-Entwickler bio.logis Genetic Information Management GmbH Zentrale: Olof-Palme-Str. 15 D-60439 Frankfurt am Main T: +49 69 348 739 116 christian.spitz...@biologis.com biologis.com Geschäftsführung: Prof. Dr. med. Daniela Steinberger Firmensitz: Altenhöferallee 3, 60438 Frankfurt am Main Registergericht Frankfurt am Main, HRB 97945