Search in sources :

Example 66 with LocalSolrQueryRequest

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

the class SkipExistingDocumentsProcessorFactoryTest method testSkipUpdatesFalseIfInitArgsTrueButFalseBooleanInRequest.

@Test
public void testSkipUpdatesFalseIfInitArgsTrueButFalseBooleanInRequest() {
    SkipExistingDocumentsProcessorFactory factory = new SkipExistingDocumentsProcessorFactory();
    NamedList<Object> initArgs = new NamedList<>();
    initArgs.add("skipUpdateIfMissing", true);
    factory.init(initArgs);
    NamedList<Object> requestArgs = new NamedList<>();
    requestArgs.add("skipUpdateIfMissing", false);
    SolrQueryRequest req = new LocalSolrQueryRequest(null, requestArgs);
    UpdateRequestProcessor next = Mockito.mock(DistributedUpdateProcessor.class);
    SkipExistingDocumentsUpdateProcessor processor = factory.getInstance(req, new SolrQueryResponse(), next);
    assertTrue("Expected skipInsertIfExists to be true", processor.isSkipInsertIfExists());
    assertFalse("Expected skipUpdateIfMissing to be false", processor.isSkipUpdateIfMissing());
}
Also used : LocalSolrQueryRequest(org.apache.solr.request.LocalSolrQueryRequest) LocalSolrQueryRequest(org.apache.solr.request.LocalSolrQueryRequest) SolrQueryRequest(org.apache.solr.request.SolrQueryRequest) SolrQueryResponse(org.apache.solr.response.SolrQueryResponse) NamedList(org.apache.solr.common.util.NamedList) SkipExistingDocumentsUpdateProcessor(org.apache.solr.update.processor.SkipExistingDocumentsProcessorFactory.SkipExistingDocumentsUpdateProcessor) Test(org.junit.Test)

Example 67 with LocalSolrQueryRequest

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

the class SkipExistingDocumentsProcessorFactoryTest method testSkipInsertsFalseIfInitArgsTrueButFalseStringInRequest.

@Test
public void testSkipInsertsFalseIfInitArgsTrueButFalseStringInRequest() {
    SkipExistingDocumentsProcessorFactory factory = new SkipExistingDocumentsProcessorFactory();
    NamedList<Object> initArgs = new NamedList<>();
    initArgs.add("skipInsertIfExists", true);
    factory.init(initArgs);
    NamedList<String> requestArgs = new NamedList<>();
    requestArgs.add("skipInsertIfExists", "false");
    SolrQueryRequest req = new LocalSolrQueryRequest(null, requestArgs);
    UpdateRequestProcessor next = Mockito.mock(DistributedUpdateProcessor.class);
    SkipExistingDocumentsUpdateProcessor processor = factory.getInstance(req, new SolrQueryResponse(), next);
    assertFalse("Expected skipInsertIfExists to be false", processor.isSkipInsertIfExists());
    assertTrue("Expected skipUpdateIfMissing to be true", processor.isSkipUpdateIfMissing());
}
Also used : LocalSolrQueryRequest(org.apache.solr.request.LocalSolrQueryRequest) LocalSolrQueryRequest(org.apache.solr.request.LocalSolrQueryRequest) SolrQueryRequest(org.apache.solr.request.SolrQueryRequest) SolrQueryResponse(org.apache.solr.response.SolrQueryResponse) NamedList(org.apache.solr.common.util.NamedList) SkipExistingDocumentsUpdateProcessor(org.apache.solr.update.processor.SkipExistingDocumentsProcessorFactory.SkipExistingDocumentsUpdateProcessor) Test(org.junit.Test)

Example 68 with LocalSolrQueryRequest

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

the class AbstractDIHJdbcTestCase method totalDatabaseRequests.

public int totalDatabaseRequests(String dihHandlerName) throws Exception {
    LocalSolrQueryRequest request = lrf.makeRequest("indent", "true");
    String response = h.query(dihHandlerName, request);
    Matcher m = totalRequestsPattern.matcher(response);
    Assert.assertTrue("The handler " + dihHandlerName + " is not reporting any database requests. ", m.find() && m.groupCount() == 1);
    return Integer.parseInt(m.group(1));
}
Also used : LocalSolrQueryRequest(org.apache.solr.request.LocalSolrQueryRequest) Matcher(java.util.regex.Matcher)

Example 69 with LocalSolrQueryRequest

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

the class BlobHandler method forward.

// This does not work for the general case of forwarding requests.  It probably currently
// works OK for real-time get (which is all that BlobHandler uses it for).
private static void forward(SolrQueryRequest req, String handler, SolrParams params, SolrQueryResponse rsp) {
    LocalSolrQueryRequest r = new LocalSolrQueryRequest(req.getCore(), params);
    // Close as late as possible...
    SolrRequestInfo.getRequestInfo().addCloseHook(r);
    req.getCore().getRequestHandler(handler).handleRequest(r, rsp);
}
Also used : LocalSolrQueryRequest(org.apache.solr.request.LocalSolrQueryRequest)

Example 70 with LocalSolrQueryRequest

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

the class TestCrossCoreJoin method testCoresAreDifferent.

@Test
public void testCoresAreDifferent() throws Exception {
    assertQEx("schema12.xml" + " has no \"cat\" field", req("cat:*"), ErrorCode.BAD_REQUEST);
    final LocalSolrQueryRequest req = new LocalSolrQueryRequest(fromCore, "cat:*", "/select", 0, 100, Collections.emptyMap());
    final String resp = query(fromCore, req);
    assertTrue(resp, resp.contains("numFound=\"1\""));
    assertTrue(resp, resp.contains("<str name=\"id\">10</str>"));
}
Also used : LocalSolrQueryRequest(org.apache.solr.request.LocalSolrQueryRequest) Test(org.junit.Test)

Aggregations

LocalSolrQueryRequest (org.apache.solr.request.LocalSolrQueryRequest)107 SolrQueryRequest (org.apache.solr.request.SolrQueryRequest)61 ModifiableSolrParams (org.apache.solr.common.params.ModifiableSolrParams)49 SolrCore (org.apache.solr.core.SolrCore)47 SolrQueryResponse (org.apache.solr.response.SolrQueryResponse)41 Test (org.junit.Test)41 HashMap (java.util.HashMap)32 NamedList (org.apache.solr.common.util.NamedList)26 ArrayList (java.util.ArrayList)23 MapSolrParams (org.apache.solr.common.params.MapSolrParams)21 SolrException (org.apache.solr.common.SolrException)18 List (java.util.List)15 LinkedHashMap (java.util.LinkedHashMap)11 SolrParams (org.apache.solr.common.params.SolrParams)10 SearchComponent (org.apache.solr.handler.component.SearchComponent)10 SolrRequestHandler (org.apache.solr.request.SolrRequestHandler)10 AddUpdateCommand (org.apache.solr.update.AddUpdateCommand)10 Map (java.util.Map)9 SimpleOrderedMap (org.apache.solr.common.util.SimpleOrderedMap)9 IOException (java.io.IOException)8