Search in sources :

Example 6 with SolrRequestHandler

use of org.apache.solr.request.SolrRequestHandler in project lucene-solr by apache.

the class TestInitParams method testElevateExample.

public void testElevateExample() {
    SolrRequestHandler handler = h.getCore().getRequestHandler("/elevate");
    SolrQueryResponse rsp = new SolrQueryResponse();
    handler.handleRequest(req("initArgs", "true"), rsp);
    NamedList nl = (NamedList) rsp.getValues().get("initArgs");
    NamedList def = (NamedList) nl.get(PluginInfo.DEFAULTS);
    assertEquals("text", def.get("df"));
}
Also used : SolrQueryResponse(org.apache.solr.response.SolrQueryResponse) NamedList(org.apache.solr.common.util.NamedList) SolrRequestHandler(org.apache.solr.request.SolrRequestHandler)

Example 7 with SolrRequestHandler

use of org.apache.solr.request.SolrRequestHandler in project lucene-solr by apache.

the class TestInitParams method testArbitraryAttributes.

public void testArbitraryAttributes() {
    SolrRequestHandler handler = h.getCore().getRequestHandler("/dump7");
    SolrQueryResponse rsp = new SolrQueryResponse();
    handler.handleRequest(req("initArgs", "true"), rsp);
    NamedList nl = (NamedList) rsp.getValues().get("initArgs");
    assertEquals("server-enabled.txt", nl.get("healthcheckFile"));
}
Also used : SolrQueryResponse(org.apache.solr.response.SolrQueryResponse) NamedList(org.apache.solr.common.util.NamedList) SolrRequestHandler(org.apache.solr.request.SolrRequestHandler)

Example 8 with SolrRequestHandler

use of org.apache.solr.request.SolrRequestHandler in project lucene-solr by apache.

the class TestInitParams method testMultiInitParams.

@Test
public void testMultiInitParams() {
    SolrRequestHandler handler = h.getCore().getRequestHandler("/dump6");
    SolrQueryResponse rsp = new SolrQueryResponse();
    handler.handleRequest(req("initArgs", "true"), rsp);
    NamedList nl = (NamedList) rsp.getValues().get("initArgs");
    NamedList def = (NamedList) nl.get(PluginInfo.DEFAULTS);
    assertEquals("A", def.get("a"));
    assertEquals("P", def.get("p"));
    def = (NamedList) nl.get(PluginInfo.INVARIANTS);
    assertEquals("B", def.get("b"));
    def = (NamedList) nl.get(PluginInfo.APPENDS);
    assertEquals("C", def.get("c"));
}
Also used : SolrQueryResponse(org.apache.solr.response.SolrQueryResponse) NamedList(org.apache.solr.common.util.NamedList) SolrRequestHandler(org.apache.solr.request.SolrRequestHandler) Test(org.junit.Test)

Example 9 with SolrRequestHandler

use of org.apache.solr.request.SolrRequestHandler in project lucene-solr by apache.

the class TestInitParams method testComponentWithConflictingInitParams.

@Test
public void testComponentWithConflictingInitParams() {
    SolrRequestHandler handler = h.getCore().getRequestHandler("/dump2");
    SolrQueryResponse rsp = new SolrQueryResponse();
    handler.handleRequest(req("initArgs", "true"), rsp);
    NamedList nl = (NamedList) rsp.getValues().get("initArgs");
    NamedList def = (NamedList) nl.get(PluginInfo.DEFAULTS);
    assertEquals("A1", def.get("a"));
    def = (NamedList) nl.get(PluginInfo.INVARIANTS);
    assertEquals("B1", def.get("b"));
    def = (NamedList) nl.get(PluginInfo.APPENDS);
    assertEquals(Arrays.asList("C1", "C"), def.getAll("c"));
}
Also used : SolrQueryResponse(org.apache.solr.response.SolrQueryResponse) NamedList(org.apache.solr.common.util.NamedList) SolrRequestHandler(org.apache.solr.request.SolrRequestHandler) Test(org.junit.Test)

Example 10 with SolrRequestHandler

use of org.apache.solr.request.SolrRequestHandler in project lucene-solr by apache.

the class TolerantUpdateProcessorTest method update.

public String update(String chain, String xml) {
    DirectSolrConnection connection = new DirectSolrConnection(h.getCore());
    SolrRequestHandler handler = h.getCore().getRequestHandler("/update");
    ModifiableSolrParams params = new ModifiableSolrParams();
    params.add("update.chain", chain);
    try {
        return connection.request(handler, params, xml);
    } catch (SolrException e) {
        throw (SolrException) e;
    } catch (Exception e) {
        throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, e);
    }
}
Also used : DirectSolrConnection(org.apache.solr.servlet.DirectSolrConnection) ModifiableSolrParams(org.apache.solr.common.params.ModifiableSolrParams) SolrException(org.apache.solr.common.SolrException) XPathExpressionException(javax.xml.xpath.XPathExpressionException) SolrException(org.apache.solr.common.SolrException) IOException(java.io.IOException) SAXException(org.xml.sax.SAXException) SolrRequestHandler(org.apache.solr.request.SolrRequestHandler)

Aggregations

SolrRequestHandler (org.apache.solr.request.SolrRequestHandler)35 Test (org.junit.Test)20 SolrQueryResponse (org.apache.solr.response.SolrQueryResponse)19 NamedList (org.apache.solr.common.util.NamedList)16 ModifiableSolrParams (org.apache.solr.common.params.ModifiableSolrParams)15 SolrCore (org.apache.solr.core.SolrCore)15 SolrQueryRequest (org.apache.solr.request.SolrQueryRequest)12 LocalSolrQueryRequest (org.apache.solr.request.LocalSolrQueryRequest)11 SimpleOrderedMap (org.apache.solr.common.util.SimpleOrderedMap)9 SearchComponent (org.apache.solr.handler.component.SearchComponent)9 SolrException (org.apache.solr.common.SolrException)6 DirectSolrConnection (org.apache.solr.servlet.DirectSolrConnection)6 IOException (java.io.IOException)5 List (java.util.List)4 HashMap (java.util.HashMap)2 SolrServerException (org.apache.solr.client.solrj.SolrServerException)2 SolrParams (org.apache.solr.common.params.SolrParams)2 CoreContainer (org.apache.solr.core.CoreContainer)2 Counter (com.codahale.metrics.Counter)1 InputStream (java.io.InputStream)1