RE: Solr in Linux Platform

2016-03-14 Thread Adel Mohamed Khalifa
I do that with the hostname ( “ 172.16.0.**:8983/solr/SearchCore “ ) and still 
the problem exist

 

Regards,
Adel Khalifa

 

From: Walter Underwood [mailto:wun...@wunderwood.org] 
Sent: Monday, March 14, 2016 5:36 PM
To: dev@lucene.apache.org
Subject: Re: Solr in Linux Platform

 

Use the hostname of the Ubuntu server instead of “localhost”. This URL will 
only connect to the same host where your client is running: 
localhost:8983/solr/SearchCore

 

wunder

Walter Underwood
wun...@wunderwood.org
http://observer.wunderwood.org/  (my blog)

 

On Mar 14, 2016, at 8:12 AM, Shawn Heisey <apa...@elyograg.org> wrote:

 

On 3/14/2016 8:31 AM, Adel Mohamed Khalifa wrote:



I build a website (Java EE ) and want to search in some json files so
I installed the solr server in an Ubuntu server and create a new core
then indexing json files and the web searched correctly when I moved
my code from windows to the server it stopped and cannot connect to
solr server I try to debug using netbeans in Ubuntu it’s stopped and
there is no exception on this statement (SolrServer server = new
HttpSolrServer(“localhost:8983/solr/SearchCore”) ).



I need for some help Please.



Note :- I attached the servlet I used to search and connect to solr
server.


Don't set the "wt" or "indent" parameters.  You won't be interacting
with the actual text of the response -- all response access with SolrJ
is through Java objects.  Changing wt might just confuse SolrJ -- let it
use its normal binary response format.

The gson/json code you've got probably isn't going to do what you
expect.  If the "wt" parameter did not break the request (which might
happen), then what you get with the getResults method on the response
object will NOT be any standardized format like gson or json.  You will
need to access the SolrDocument object(s) from the SolrDocumentList, and
then access fields from SolrDocument.

Thanks,
Shawn


-
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org

 



Re: Solr in Linux Platform

2016-03-14 Thread Walter Underwood
Use the hostname of the Ubuntu server instead of “localhost”. This URL will 
only connect to the same host where your client is running: 
localhost:8983/solr/SearchCore

wunder
Walter Underwood
wun...@wunderwood.org
http://observer.wunderwood.org/  (my blog)


> On Mar 14, 2016, at 8:12 AM, Shawn Heisey  wrote:
> 
> On 3/14/2016 8:31 AM, Adel Mohamed Khalifa wrote:
>> I build a website (Java EE ) and want to search in some json files so
>> I installed the solr server in an Ubuntu server and create a new core
>> then indexing json files and the web searched correctly when I moved
>> my code from windows to the server it stopped and cannot connect to
>> solr server I try to debug using netbeans in Ubuntu it’s stopped and
>> there is no exception on this statement (SolrServer server = new
>> HttpSolrServer(“localhost:8983/solr/SearchCore”) ).
>> 
>> 
>> 
>> I need for some help Please.
>> 
>> 
>> 
>> Note :- I attached the servlet I used to search and connect to solr
>> server.
>> 
> 
> Don't set the "wt" or "indent" parameters.  You won't be interacting
> with the actual text of the response -- all response access with SolrJ
> is through Java objects.  Changing wt might just confuse SolrJ -- let it
> use its normal binary response format.
> 
> The gson/json code you've got probably isn't going to do what you
> expect.  If the "wt" parameter did not break the request (which might
> happen), then what you get with the getResults method on the response
> object will NOT be any standardized format like gson or json.  You will
> need to access the SolrDocument object(s) from the SolrDocumentList, and
> then access fields from SolrDocument.
> 
> Thanks,
> Shawn
> 
> 
> -
> To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
> For additional commands, e-mail: dev-h...@lucene.apache.org
> 



Re: Solr in Linux Platform

2016-03-14 Thread Shawn Heisey
On 3/14/2016 8:31 AM, Adel Mohamed Khalifa wrote:
> I build a website (Java EE ) and want to search in some json files so
> I installed the solr server in an Ubuntu server and create a new core
> then indexing json files and the web searched correctly when I moved
> my code from windows to the server it stopped and cannot connect to
> solr server I try to debug using netbeans in Ubuntu it’s stopped and
> there is no exception on this statement (SolrServer server = new
> HttpSolrServer(“localhost:8983/solr/SearchCore”) ).
>
>  
>
> I need for some help Please.
>
>  
>
> Note :- I attached the servlet I used to search and connect to solr
> server.
>

Don't set the "wt" or "indent" parameters.  You won't be interacting
with the actual text of the response -- all response access with SolrJ
is through Java objects.  Changing wt might just confuse SolrJ -- let it
use its normal binary response format.

The gson/json code you've got probably isn't going to do what you
expect.  If the "wt" parameter did not break the request (which might
happen), then what you get with the getResults method on the response
object will NOT be any standardized format like gson or json.  You will
need to access the SolrDocument object(s) from the SolrDocumentList, and
then access fields from SolrDocument.

Thanks,
Shawn


-
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org



Re: Solr in Linux Platform

2016-03-14 Thread Ishan Chattopadhyaya
Hi Abdel,
I think asking in the solr-users mailing list would be more appropriate. In
this mailing list, we discuss development related issues.
Hope your problem is solved soon,
Regards,
Ishan

On Mon, Mar 14, 2016 at 8:01 PM, Adel Mohamed Khalifa <
a.moha...@saudisoft.com> wrote:

> Hello everybody,
>
>
>
> I build a website (Java EE ) and want to search in some json files so I
> installed the solr server in an Ubuntu server and create a new core then
> indexing json files and the web searched correctly when I moved my code
> from windows to the server it stopped and cannot connect to solr server I
> try to debug using netbeans in Ubuntu it’s stopped and there is no
> exception on this statement (SolrServer server = new
> HttpSolrServer(“localhost:8983/solr/SearchCore”) ).
>
>
>
> I need for some help Please.
>
>
>
> Note :- I attached the servlet I used to search and connect to solr server.
>
>
>
>
> *Regards,**Adel Khalifa*
>
>
>
>
> -
> To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
> For additional commands, e-mail: dev-h...@lucene.apache.org
>


Solr in Linux Platform

2016-03-14 Thread Adel Mohamed Khalifa
Hello everybody,

 

I build a website (Java EE ) and want to search in some json files so I 
installed the solr server in an Ubuntu server and create a new core then 
indexing json files and the web searched correctly when I moved my code from 
windows to the server it stopped and cannot connect to solr server I try to 
debug using netbeans in Ubuntu it’s stopped and there is no exception on this 
statement (SolrServer server = new 
HttpSolrServer(“localhost:8983/solr/SearchCore”) ).

 

I need for some help Please.

 

Note :- I attached the servlet I used to search and connect to solr server.

 

Regards,
Adel Khalifa

 

protected void processRequest(HttpServletRequest request, HttpServletResponse 
response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
try {
SolrServer server = new 
HttpSolrServer("http://localhost:8983/solr/SearchCore;);

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", "3");


params.set("spellcheck", "on");
params.set("spellcheck.build", "true");
params.set("wt", "json");
params.set("indent", "true");
   
PrintWriter out = response.getWriter();
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) {
System.out.println(ex.toString());
}

}

-
To unsubscribe, e-mail: dev-unsubscr...@lucene.apache.org
For additional commands, e-mail: dev-h...@lucene.apache.org