0
votes

I'm using Solr 6.1.0 and not use cloud mode,

I has add searchhandler in solrconfig.xml and it's work, can see the search results

But when I use this searchhandler and add query in URL it'll error

Like this :

http://localhost:8983/solr/testcorea/contentsearch?indent=on&q=%22test%22&wt=json&shards=localhost:8983/solr/testcorea,localhost:8983/solr/testcoreb,localhost:8983/solr/testcorec,localhost:8983/solr/testcored

This is my searchhandler:

<requestHandler name="/contentsearch" class="solr.SearchHandler">
    <lst name="defaults">
        <str name="echoParams">explicit</str>
        <str name="wt">json</str>
        <str name="indent">true</str>

        <str name="defType">edismax</str>
        <str name="qf">
        title^100.0 content^80.0 text^5.0
        </str>
        <str name="q">*:*</str>
        <str name="indent">true</str>
        <str name="rows">10</str>

        <!-- Facet settings -->
        <str name="facet">on</str>
        <str name="facet.field">content_type</str>
        <str name="facet.field">category</str>
        <str name="facet.field">author</str>
        <str name="facet.field">editor</str>
        <str name="facet.field">source_type</str>

        <str name="hl">on</str>
        <str name="hl.fl">title content</str>
        <str name="hl.preserveMulti">true</str>
    </lst>    
    <arr name="last-components">
        <str>elevator</str>
    </arr>
</requestHandler>

Error message :

=========================================================================

{"responseHeader":{"status":404,"QTime":10,"params":{"q":"\"test\"","shards":"localhost:8983/solr/testcorea,localhost:8983/solr/testcoreb,localhost:8983/solr/testcorec,localhost:8983/solr/testcored","indent":"on","wt":"json"}},"error":{"metadata":["error-class","org.apache.solr.client.solrj.impl.HttpSolrClient$RemoteSolrException","root-error-class","org.apache.solr.client.solrj.impl.HttpSolrClient$RemoteSolrException"],"msg":"Error from server at http://localhost:8983/solr/testcorec: Expected mime type application/octet-stream but got text/html. \n\n\nError 404 Not Found\n\n

HTTP ERROR 404

\n

Problem accessing /solr/testcorec/contentsearch. Reason:\n

    Not Found
\n\n\n","code":404}}

When I use solr default searchhandlr and query url it'll work Like this :

http://localhost:8983/solr/testcorea/browse?indent=on&q=%22test%22&wt=json&shards=localhost:8983/solr/testcorea,localhost:8983/solr/testcoreb,localhost:8983/solr/testcorec,localhost:8983/solr/testcored

does anyone know what's different?

and why it does not work?

Thanks

1
Did you reload the core after changing the solrconfig.xml? Have you checked the config files via the admin UI to see if that search handler is there in the solrconfig.xml?Jayce444
Hi @Jayce444 Yes, when I has change solrconfig.xml I'll restart solr service and I confirm the solrconfig.xml has been change.ZivHus
And you checked the config of all 4 cores? (looks like the handler isn't in the config of testcorec)Jayce444
@Jayce444 It's work now, thanks, But I still not understand the rank it has mapping the keyword but it does not to highlight Like this : KeyWord: Test "docid": { "title": [ "<em>Test</em>" ], "content": [ "0x0100AAFC59B5DB221440A574F622D4A674BFTest277813Not AffectedNot Affectedduplicate of 2424158/1" ] }, In the content I found the keyword but I does not to highlight, why?ZivHus
Have a look at vinod's answer. You have to enable highlighting, it's not on by defaultJayce444

1 Answers

1
votes

Add highlighting parameters to URL.

Add hl=on and hl.fl=field_name to your url

ex:

hl.fl=title&hl=on&indent=on&q=test