This implies that you are attempting to access Solr direct from
Javascript in the browser. This is a bad idea. Solr doesn't (until 5.2
at least) have any security within, so you will be exposing
functionality to your end users that allows them to delete (or corrupt)
the data in your index.

Normal usage would be to have an intermediate application sitting
between Solr and your end user. That could use templates to lay out the
page based upon the JSON data.

If you really want to do it in the browser (e.g. if it is only for use
by people you trust) then you could use additional Javascript (e.g.
jQuery) to modify the page based upon the results of an Ajax request,
but how to do that is really out of scope of this list.

Upayavira

On Sun, Jun 7, 2015, at 12:33 AM, Tom Running wrote:
> Hello,
> 
> I have customized my Solr results so that they display only 3 fields: the
> document ID, name and last_modified date. The results are in JSON.
> 
> This is a sample of my Javascript function to execute the query:
> ////////////////////////////////////////////////
> var query = "";
> 
> //set user input to query
> query = window.document.box.input.value;
> 
> //solr URL
> var sol = "
> http://localhost:8983/solr/gettingstarted_shard1_replica1/select?q=";;
> var sol2 =
> "&wt=json&fl=title,id,category,last_modified&rows=10000000&indent=true";
> 
> //redirect
> window.location.href = sol+query+sol2;
> //////////////////////////////////////////////////////
> 
> The output example would look like:
> 
> {
>         "id":"/solr/docs/ISO/Employee Benefits Information/BCN.doc",
>         "title":["BCN Auto Policy Verbiage:"],
>         "last_modified":["2014-01-07T15:19:00Z"]},
> 
> 
> 
> I want to format my Solr results so that the document ID will be
> displayed
> as a link that users can click on and load the BCN.doc file.
> 
> Any tips on how to do this? I am a stuck.
> 
> All help is appreciated!
> 
> Thanks,
> 
> T
  • Solr Tom Running
    • Re: Solr Upayavira

Reply via email to