publish solr on galsshfish server

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

publish solr on galsshfish server

Adel Mohamed Khalifa

Hello All,

 

What is the requirement for installing solr on glassfish server, and how can I do it?

 

Regards,
Adel Khalifa | Developer | Saudisoft-Egypt |  Tel: +2 023 303 2037 - ext 112 | M +2 01149247744 | Fax +2 023 303 2036 | Follow us on  |  |

 

 

Reply | Threaded
Open this post in threaded view
|

Re: publish solr on galsshfish server

Malcolm Upayavira Holmes
This is not recommended. It may work, and if it does, a future update to
Solr may stop it working, without warning.
 
Solr is to be considered its own app, to be run using its own embedded
servlet container, as this allows the project to manage its own
configuration and to test thoroughly that it works with a specific
container.
 
Think of Solr much like you would any other app such as Mysql or Mongo.
You just install the app, not making it depend upon any other
'container'.
 
Upayavira
 
 
On Thu, 17 Mar 2016, at 09:54 AM, Adel Mohamed Khalifa wrote:
> Hello All,
>
> What is the requirement for installing solr on glassfish server, and
> how can I do it?
>
> *Regards,
**Adel Khalifa | *Developer* **| **Saudisoft-Egypt | ** Tel: *+2 023 303
2037 - *ext *112 | *M *+2 01149247744 | *Fax *+2 023 303 2036 | *Follow
us on **Description: cid:image001.gif@01D11A1D.D81CE0C0** |
**Description: cid:image002.gif@01D11A1D.D81CE0C0** | **Description:
cid:image003.gif@01D11A1D.D81CE0C0****Description:
cid:image004.jpg@01D11A1D.D81CE0C0***
>
>
 
Reply | Threaded
Open this post in threaded view
|

RE: publish solr on galsshfish server

Adel Mohamed Khalifa
I build my webpage for searching and create a servlet for it but it is not
working

I using this Ajax for calling servlet :-

$.ajax({
                url: contextPath + '/GetResults',
                data: {
                    qu: $("#query").val()
                },
                dataType: 'json'
            }).done(function (result) {
//get the result on table
}

And on servlet I coded :-
Try{
SolrServer server = new
HttpSolrServer(Core.solrResourceBundle.getString("//http://172.16.0.1:8983/S
earchCore"));
            ModifiableSolrParams params = new ModifiableSolrParams();
            String qqq = new
String(request.getParameter("qu").getBytes("ISO-8859-1"), "UTF-8");
            params.set("q", new
String(request.getParameter("qu").getBytes("ISO-8859-1"), "UTF-8"));
            params.set("rows", "30000");
            params.set("spellcheck", "on");
            params.set("spellcheck.build", "true");
            params.set("wt", "json");
            params.set("indent", "true");
           
            QueryResponse res = server.query(params);
            SolrDocumentList results = res.getResults();
            Iterator i = results.iterator();
            request.setAttribute("size", results.size());
            String json = new Gson().toJson(res.getResults());
            out.write(json);
} catch (SolrServerException ex) {
            oout.write(ex.toString());
        }
}

It's break on SolrServer server = new
HttpSolrServer(Core.solrResourceBundle.getString("//http://172.16.0.1:8983/S
earchCore")); without any exception just stop.

Regards,
Adel Khalifa

-----Original Message-----
From: Upayavira [mailto:[hidden email]]
Sent: Thursday, March 17, 2016 12:07 PM
To: [hidden email]
Subject: Re: publish solr on galsshfish server

This is not recommended. It may work, and if it does, a future update to
Solr may stop it working, without warning.
 
Solr is to be considered its own app, to be run using its own embedded
servlet container, as this allows the project to manage its own
configuration and to test thoroughly that it works with a specific
container.
 
Think of Solr much like you would any other app such as Mysql or Mongo.
You just install the app, not making it depend upon any other 'container'.
 
Upayavira
 
 
On Thu, 17 Mar 2016, at 09:54 AM, Adel Mohamed Khalifa wrote:
> Hello All,
>
> What is the requirement for installing solr on glassfish server, and
> how can I do it?
>
> *Regards,
**Adel Khalifa | *Developer* **| **Saudisoft-Egypt | ** Tel: *+2 023 303
2037 - *ext *112 | *M *+2 01149247744 | *Fax *+2 023 303 2036 | *Follow us
on **Description: cid:image001.gif@01D11A1D.D81CE0C0** |
**Description: cid:image002.gif@01D11A1D.D81CE0C0** | **Description:
cid:image003.gif@01D11A1D.D81CE0C0****Description:
cid:image004.jpg@01D11A1D.D81CE0C0***
>
>
 


Reply | Threaded
Open this post in threaded view
|

Re: publish solr on galsshfish server

Shawn Heisey-2
On 3/17/2016 4:20 AM, Adel Mohamed Khalifa wrote:

> And on servlet I coded :-
> Try{
> SolrServer server = new
> HttpSolrServer(Core.solrResourceBundle.getString("//http://172.16.0.1:8983/S
> earchCore"));
>             ModifiableSolrParams params = new ModifiableSolrParams();
>             String qqq = new
> String(request.getParameter("qu").getBytes("ISO-8859-1"), "UTF-8");
>             params.set("q", new
> String(request.getParameter("qu").getBytes("ISO-8859-1"), "UTF-8"));
>             params.set("rows", "30000");
>             params.set("spellcheck", "on");
>             params.set("spellcheck.build", "true");
>             params.set("wt", "json");
>             params.set("indent", "true");
>            
>             QueryResponse res = server.query(params);
>             SolrDocumentList results = res.getResults();
>             Iterator i = results.iterator();
>             request.setAttribute("size", results.size());
>             String json = new Gson().toJson(res.getResults());
>             out.write(json);
> } catch (SolrServerException ex) {
>             oout.write(ex.toString());
>         }
> }
>
> It's break on SolrServer server = new
> HttpSolrServer(Core.solrResourceBundle.getString("//http://172.16.0.1:8983/S
> earchCore")); without any exception just stop.

This code looks different than the last code you said you were using,
when you posted to the dev list.  Have you included the real code this
time?  I can see at least two typos that would make the code refuse to
compile, so I'm guessing you're still changing it, not showing the
actual code.

What exactly does the following code return?

Core.solrResourceBundle.getString("//http://172.16.0.1:8983/SearchCore")

What version of SolrJ are you using?  I'm not asking about the Solr
server version here although that would be good to know as well. I'm
guessing a 4.x version, or I think you'd be using HttpSolrClient, not
HttpSolrServer.  The latter will work on 5.x, but it is deprecated.

Thanks, Shawn

Reply | Threaded
Open this post in threaded view
|

RE: publish solr on galsshfish server

Adel Mohamed Khalifa
Thanks Shawn,

This " Core.solrResourceBundle.getString("//http://172.16.0.1:8983/SearchCore")" return the solr search core (( <a href="http://server:port/core">http://server:port/core))


-----Original Message-----
From: Shawn Heisey [mailto:[hidden email]]
Sent: Thursday, March 17, 2016 4:09 PM
To: [hidden email]
Subject: Re: publish solr on galsshfish server

On 3/17/2016 4:20 AM, Adel Mohamed Khalifa wrote:

> And on servlet I coded :-
> Try{
> SolrServer server = new
> HttpSolrServer(Core.solrResourceBundle.getString("//http://172.16.0.1:8983/S
> earchCore"));
>             ModifiableSolrParams params = new ModifiableSolrParams();
>             String qqq = new
> String(request.getParameter("qu").getBytes("ISO-8859-1"), "UTF-8");
>             params.set("q", new
> String(request.getParameter("qu").getBytes("ISO-8859-1"), "UTF-8"));
>             params.set("rows", "30000");
>             params.set("spellcheck", "on");
>             params.set("spellcheck.build", "true");
>             params.set("wt", "json");
>             params.set("indent", "true");
>            
>             QueryResponse res = server.query(params);
>             SolrDocumentList results = res.getResults();
>             Iterator i = results.iterator();
>             request.setAttribute("size", results.size());
>             String json = new Gson().toJson(res.getResults());
>             out.write(json);
> } catch (SolrServerException ex) {
>             oout.write(ex.toString());
>         }
> }
>
> It's break on SolrServer server = new
> HttpSolrServer(Core.solrResourceBundle.getString("//http://172.16.0.1:8983/S
> earchCore")); without any exception just stop.

This code looks different than the last code you said you were using,
when you posted to the dev list.  Have you included the real code this
time?  I can see at least two typos that would make the code refuse to
compile, so I'm guessing you're still changing it, not showing the
actual code.

What exactly does the following code return?

Core.solrResourceBundle.getString("//http://172.16.0.1:8983/SearchCore")

What version of SolrJ are you using?  I'm not asking about the Solr
server version here although that would be good to know as well. I'm
guessing a 4.x version, or I think you'd be using HttpSolrClient, not
HttpSolrServer.  The latter will work on 5.x, but it is deprecated.

Thanks, Shawn


Reply | Threaded
Open this post in threaded view
|

Re: publish solr on galsshfish server

Shawn Heisey-2
On 3/20/2016 5:46 AM, Adel Mohamed Khalifa wrote:
> Thanks Shawn,
>
> This " Core.solrResourceBundle.getString("//http://172.16.0.1:8983/SearchCore")" return the solr search core (( <a href="http://server:port/core">http://server:port/core))

Generally speaking, Solr lives on the "/solr" URL context, so the most
of the time the correct format of a Solr core URL is this:

<a href="http://server:port/solr/core">http://server:port/solr/core

The HttpSolrServer constructor will not throw an exception with an
invalid but correctly formatted URL, though.  The newest versions of
Solr won't even throw an exception if you send complete gibberish for
the URL.  Older versions would throw a MalformedURLException.

As I have said elsewhere on this problem, the constructor does *not*
contact the server.  This only happens when you send a request, and one
of the ways to send a request is with the SolrServer#query method.

The Solr *server* probably won't run on glassfish, and Solr 5.x has no
official support for third-party containers at all.

https://issues.apache.org/jira/browse/SOLR-5109
https://wiki.apache.org/solr/WhyNoWar

SolrJ programs will probably be fine on glassfish, though.
 
Thanks,
Shawn