Examples of SolrServer


Examples of org.apache.solr.client.solrj.SolrServer

                                             String collectionName) throws Exception {
    String originalUser = getAuthenticatedUser();
    try {
      setAuthenticationUser(solrUserName);
      QueryRequest request = populateCollectionAdminParams(adminOp, collectionName);
      SolrServer solrServer = createNewSolrServer("", getBaseUrl((HttpSolrServer) clients.get(0)));
      try {
        NamedList<Object> result = solrServer.request(request);
        if (adminOp.compareTo(CollectionAction.CREATE) == 0) {
          // Wait for collection creation to complete.
          waitForRecoveriesToFinish(collectionName, false);
        }
      } finally {
        solrServer.shutdown();
      }
    } finally {
      setAuthenticationUser(originalUser);
    }
  }
View Full Code Here

Examples of org.apache.solr.client.solrj.SolrServer

    String originalUser = getAuthenticatedUser();
    try {
      setAuthenticationUser(solrUserName);
      try {
        QueryRequest request = populateCollectionAdminParams(adminOp, collectionName);
        SolrServer solrServer = createNewSolrServer("", getBaseUrl((HttpSolrServer) clients.get(0)));
        try {
          NamedList<Object> result = solrServer.request(request);
          if (adminOp.compareTo(CollectionAction.CREATE) == 0) {
            // Wait for collection creation to complete.
            waitForRecoveriesToFinish(collectionName, false);
          }
        } finally {
          solrServer.shutdown();
        }

        fail("The specified user: " + solrUserName + " shouldn't get admin access for " + adminOp);
      } catch (Exception exception) {
        assertTrue("Expected " + SENTRY_ERROR_MSG + " in " + exception.toString(),
View Full Code Here

Examples of org.apache.solr.client.solrj.SolrServer

    @Override
    protected void preCreateRepository(Jcr jcr) {
        String path = getClass().getResource("/").getFile() + "/queryjcrtest";
        File f = new File(path);
        final SolrServer solrServer;
        try {
            solrServer = new EmbeddedSolrServerProvider(new EmbeddedSolrServerConfiguration(f.getPath(), "", "oak")).getSolrServer();
        } catch (Exception e) {
            throw new RuntimeException();
        }
View Full Code Here

Examples of org.apache.solr.client.solrj.SolrServer

          String url = "http://" + shard;

          params.remove(CommonParams.WT); // use default (or should we explicitly set it?)
          params.remove(CommonParams.VERSION);

          SolrServer server = new CommonsHttpSolrServer(url, client);
          // SolrRequest req = new QueryRequest(SolrRequest.METHOD.POST, "/select");
          // use generic request to avoid extra processing of queries
          QueryRequest req = new QueryRequest(params);
          req.setMethod(SolrRequest.METHOD.POST);
          req.setResponseParser(new BinaryResponseParser())// this sets the wt param
          // srsp.rsp = server.request(req);
          // srsp.rsp = server.query(sreq.params);

          ssr.nl = server.request(req);
        } catch (Throwable th) {
          srsp.setException(th);
          if (th instanceof SolrException) {
            srsp.setResponseCode(((SolrException)th).code());
          } else {
View Full Code Here

Examples of org.apache.solr.client.solrj.SolrServer

    assertEquals(0, getSolrCore1().query(new SolrQuery("id:AAA")).getResults().size());
    assertEquals(1, getSolrCore1().query(new SolrQuery("id:BBB")).getResults().size());

    // Now test reloading it should have a newer open time
    String name = "core0";
    SolrServer coreadmin = getSolrAdmin();
    CoreAdminResponse mcr = CoreAdminRequest.getStatus(name, coreadmin);
    long before = mcr.getStartTime(name).getTime();
    CoreAdminRequest.reloadCore(name, coreadmin);

    mcr = CoreAdminRequest.getStatus(name, coreadmin);
View Full Code Here

Examples of org.apache.solr.client.solrj.SolrServer

      return this;
    }

    public SolrServer create() throws Exception {
      createTable(tableName);
      SolrServer server = new SolrLookingBlurServer(miniCluster.getControllerConnectionStr(), tableName);

      for (int i = 0; i < rows; i++) {
        SolrInputDocument parent = new SolrInputDocument();
        parent.addField(BlurConstants.ROW_ID, i);
        for (int j = 0; j < recordsPerRow; j++) {
          SolrInputDocument child = new SolrInputDocument();
          child.addField(BlurConstants.RECORD_ID, j);

          for (String colName : columns) {
            child.addField(colName, "value" + i + "-" + j);
          }
          parent.addChildDocument(child);
        }
        server.add(parent);
      }
      return server;
    }
View Full Code Here

Examples of org.apache.solr.client.solrj.SolrServer

  @Test
  public void docShouldBeDiscoverableWithMultiValuedFields() throws SolrServerException, IOException, BlurException,
      TException {
    String table = "docShouldBeDiscoverableWithMultiValuedFields";
    createTable(table);
    SolrServer server = new SolrLookingBlurServer(miniCluster.getControllerConnectionStr(), table);
    SolrInputDocument doc = new SolrInputDocument();
    doc.addField("rowid", "1");

    SolrInputDocument child = new SolrInputDocument();
    child.addField("recordid", "1");
    child.addField("fam.value", "123");
    child.addField("fam.value", "124");

    doc.addChildDocument(child);

    server.add(doc);

    assertTotalResults(table, "fam.value:123", 1l);
    assertTotalResults(table, "fam.value:124", 1l);
    assertTotalResults(table, "fam.value:justincase", 0l);
View Full Code Here

Examples of org.apache.solr.client.solrj.SolrServer

  @Test
  public void weShouldBeAbleToDeleteARowById() throws Exception,
      TException {
    String table = "weShouldBeAbleToDeleteARowById";

    SolrServer server = TestTableCreator.newTable(table).withRowCount(2).withRecordsPerRow(1)
        .withRecordColumns("fam.value").create();

    assertTotalResults(table, "rowid:0", 1l);
    assertTotalResults(table, "rowid:1", 1l);

    server.deleteById("1");

    assertTotalResults(table, "rowid:0", 1l);
    assertTotalResults(table, "rowid:1", 0l);

    removeTable(table);
View Full Code Here

Examples of org.apache.solr.client.solrj.SolrServer

  @Test
  public void weShouldBeAbleToDeleteARowByAListOfIds() throws Exception,
      TException {
    String table = "weShouldBeAbleToDeleteARowByAListOfIds";

    SolrServer server = TestTableCreator.newTable(table).withRowCount(20).withRecordsPerRow(1)
        .withRecordColumns("fam.value").create();

    assertTotalResults(table, "rowid:1", 1l);
    assertTotalResults(table, "rowid:2", 1l);
    List<String> ids = Lists.newArrayList("1", "2", "3", "4", "5");
    server.deleteById(ids);

    for (String id : ids) {
      assertTotalResults(table, "rowid:" + id, 0l);
    }
View Full Code Here

Examples of org.apache.solr.client.solrj.SolrServer

  }

  @Test
  public void basicFullTextQuery() throws Exception {
    String table = "basicFullTextQuery";
    SolrServer server = TestTableCreator.newTable(table)
        .withRowCount(1).withRecordsPerRow(2)
        .withRecordColumns("fam.value", "fam.mvf", "fam.mvf").create();

    SolrQuery query = new SolrQuery("value0-0");

    QueryResponse response = server.query(query);

    assertEquals("We should get our doc back.", 1l, response.getResults().getNumFound());

    SolrDocument docResult = response.getResults().get(0);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.