You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Steven White <sw...@gmail.com> on 2020/09/18 16:53:33 UTC

Pining Solr

Hi everyone,

I'm using SolrJ to ping Solr.  This used to work just fine till when I had
to change the name of my search request handler from the default "select"
to "select_cpsearch", i.e.: I now have this:

    <requestHandler name="/select_cpsearch" class="solr.SearchHandler">

I looked this up and the solution suggestion on the internet is I need to
add a ping request handler (which was missing) so I added it like so (and I
tried a variations of it):

<requestHandler name="/admin/ping" class="solr.PingRequestHandler">
  <lst name="invariants">
    <str name="echoParams">all</str>
    <str name="q">solrpingquery</str>
  </lst>
</requestHandler>

But no matter how I change this ping handler, I keep getting this error:

  http://garoush-dtv:8984/solr/cpsearch: Unknown RequestHandler (qt): null

When I add 'qt' to the ping handler like os:
<requestHandler name="/admin/ping" class="solr.PingRequestHandler">
  <lst name="invariants">
    <str name="echoParams">all</str>
    <str name="q">solrpingquery</str>
     <str name="qf"> CP_UNIQUE_FIELD </str>
  </lst>
</requestHandler>

I now get this error: http://garoush-dtv:8984/solr/cpsearch: Unknown
RequestHandler (qt): CP_UNIQUE_FIELD'

Yes, "CP_UNIQUE_FIELD" is in my schema.

What am I missing here?  I cannot go back to the "select" request handler
and I need to be able to ping my collection.

Thanks,

Steven

Re: Pining Solr

Posted by Erick Erickson <er...@gmail.com>.
Well, this is doesn’t look right at all:

/solr/cpsearch/select_cpsearch/select

It should just be:
/solr/cpsearch/select_cpsearch

Best,
Erick

> On Sep 18, 2020, at 3:18 PM, Steven White <sw...@gmail.com> wrote:
> 
> /solr/cpsearch/select_cpsearch/select


Re: Pining Solr

Posted by Alexandre Rafalovitch <ar...@gmail.com>.
Your builder parameter should be up to the collection, so only
"http://testserver-dtv:8984/solr/cpsearch".
Then, on your Query object, you set
query.setRequestHandler("/select_cpsearch") as per
https://lucene.apache.org/solr/8_6_2/solr-solrj/org/apache/solr/client/solrj/SolrQuery.html#setRequestHandler-java.lang.String-

I am not sure what is happening with your ping, but I also believe
that there is a definition by default in the latest Solr. You could
see all the definitions (including defaults), by using config API
(see. https://lucene.apache.org/solr/guide/8_6/config-api.html)

Regards,
   Alex.

On Fri, 18 Sep 2020 at 15:18, Steven White <sw...@gmail.com> wrote:
>
> Hi Erick,
>
> I'm on Solr 8.6.1.  I did further debugging into this and just noticed that
> my search is not working too now (this is after I changed the request
> handler name from "select" to "select_cpsearch").  I have this very basic
> test code as a test which I think revailes the issue:
>
>     try
>     {
>         SolrClient solrClient = new HttpSolrClient.Builder("
> http://testserver-dtv:8984/solr/cpsearch/select_cpsearch").build();
>         SolrQuery query = new SolrQuery();
>         query.set("q", "*");
>         QueryResponse response = solrClient.query(query);
>     }
>     catch (Exception ex)
>     {
>         ex.printStackTrace();  // has this:
> "<tr><th>URI:</th><td>/solr/cpsearch/select_cpsearch/select</td></tr>"
>     }
>
> In the stack, there is this message (I'm showing the relevant part only):
>
>     <title>Error 404 Not Found</title>
>     </head>
>     <body><h2>HTTP ERROR 404 Not Found</h2>
>     <table>
>     <tr><th>URI:</th><td>/solr/cpsearch/select_cpsearch/select</td></tr>
>
> As you can see "select" got added to the URI.  I think this is the root
> cause for the ping issue too that I'm having, but even if it is not, I have
> to fix this search issue too but I don't know how to tell SolrJ to use my
> named search request handler.  Any ideas?
>
> Thanks.
>
> Steven
>
>
> On Fri, Sep 18, 2020 at 2:24 PM Erick Erickson <er...@gmail.com>
> wrote:
>
> > This looks kind of confused. I’m assuming what you’re after is a way to get
> > to your select_cpsearch request handler to test if Solr is alive and
> > calling that
> > “ping”.
> >
> > The ping request handler is just that, a separate request handler that you
> > hit by going to
> > http://sever:port/solr/admin/ping.
> >
> > It has nothing to do at all with your custom search handler and in recent
> > versions of
> > Solr is implicitly defined so it should just be there.
> >
> > Your custom handler is defined as
> > <requestHandler name="/select_cpsearch" class="solr.SearchHandler”>
> > presumably in some collection called “cpsearch”?
> >
> > yet your URL is solr/cpsearch. It should be something like
> > …solr/cpsearch/select_cpsearch…
> >
> > The “qf” parameter is part of the (e)dismax query parser which it doesn’t
> > look like you’re using.
> >
> > So let’s back up a bit and state, at a high level, what you want to
> > accomplish.
> >
> > First, what version of Solr? in recent Solr versions.
> >
> > Then the full definition of your custom request handler.
> >
> > Then an example of exactly how you try to get to it from a browser
> > ‘cause that’s easier to try to reproduce than SolrJ.
> >
> > Best,
> > Erick
> >
> > > On Sep 18, 2020, at 12:53 PM, Steven White <sw...@gmail.com> wrote:
> > >
> > > <requestHandler name="/select_cpsearch" class="solr.SearchHandler">
> >
> >

Re: Pining Solr

Posted by Steven White <sw...@gmail.com>.
Hi Erick,

I'm on Solr 8.6.1.  I did further debugging into this and just noticed that
my search is not working too now (this is after I changed the request
handler name from "select" to "select_cpsearch").  I have this very basic
test code as a test which I think revailes the issue:

    try
    {
        SolrClient solrClient = new HttpSolrClient.Builder("
http://testserver-dtv:8984/solr/cpsearch/select_cpsearch").build();
        SolrQuery query = new SolrQuery();
        query.set("q", "*");
        QueryResponse response = solrClient.query(query);
    }
    catch (Exception ex)
    {
        ex.printStackTrace();  // has this:
"<tr><th>URI:</th><td>/solr/cpsearch/select_cpsearch/select</td></tr>"
    }

In the stack, there is this message (I'm showing the relevant part only):

    <title>Error 404 Not Found</title>
    </head>
    <body><h2>HTTP ERROR 404 Not Found</h2>
    <table>
    <tr><th>URI:</th><td>/solr/cpsearch/select_cpsearch/select</td></tr>

As you can see "select" got added to the URI.  I think this is the root
cause for the ping issue too that I'm having, but even if it is not, I have
to fix this search issue too but I don't know how to tell SolrJ to use my
named search request handler.  Any ideas?

Thanks.

Steven


On Fri, Sep 18, 2020 at 2:24 PM Erick Erickson <er...@gmail.com>
wrote:

> This looks kind of confused. I’m assuming what you’re after is a way to get
> to your select_cpsearch request handler to test if Solr is alive and
> calling that
> “ping”.
>
> The ping request handler is just that, a separate request handler that you
> hit by going to
> http://sever:port/solr/admin/ping.
>
> It has nothing to do at all with your custom search handler and in recent
> versions of
> Solr is implicitly defined so it should just be there.
>
> Your custom handler is defined as
> <requestHandler name="/select_cpsearch" class="solr.SearchHandler”>
> presumably in some collection called “cpsearch”?
>
> yet your URL is solr/cpsearch. It should be something like
> …solr/cpsearch/select_cpsearch…
>
> The “qf” parameter is part of the (e)dismax query parser which it doesn’t
> look like you’re using.
>
> So let’s back up a bit and state, at a high level, what you want to
> accomplish.
>
> First, what version of Solr? in recent Solr versions.
>
> Then the full definition of your custom request handler.
>
> Then an example of exactly how you try to get to it from a browser
> ‘cause that’s easier to try to reproduce than SolrJ.
>
> Best,
> Erick
>
> > On Sep 18, 2020, at 12:53 PM, Steven White <sw...@gmail.com> wrote:
> >
> > <requestHandler name="/select_cpsearch" class="solr.SearchHandler">
>
>

Re: Pining Solr

Posted by Erick Erickson <er...@gmail.com>.
This looks kind of confused. I’m assuming what you’re after is a way to get
to your select_cpsearch request handler to test if Solr is alive and calling that
“ping”.

The ping request handler is just that, a separate request handler that you hit by going to 
http://sever:port/solr/admin/ping. 

It has nothing to do at all with your custom search handler and in recent versions of
Solr is implicitly defined so it should just be there.

Your custom handler is defined as 
<requestHandler name="/select_cpsearch" class="solr.SearchHandler”>
presumably in some collection called “cpsearch”?

yet your URL is solr/cpsearch. It should be something like
…solr/cpsearch/select_cpsearch…

The “qf” parameter is part of the (e)dismax query parser which it doesn’t
look like you’re using.

So let’s back up a bit and state, at a high level, what you want to
accomplish.

First, what version of Solr? in recent Solr versions.

Then the full definition of your custom request handler.

Then an example of exactly how you try to get to it from a browser
‘cause that’s easier to try to reproduce than SolrJ.

Best,
Erick

> On Sep 18, 2020, at 12:53 PM, Steven White <sw...@gmail.com> wrote:
> 
> <requestHandler name="/select_cpsearch" class="solr.SearchHandler">