Package org.apache.solr.client.solrj

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


            managedSolrServer.removeIndex(coreName, true);
        }
    }

    private SolrServer getSolrServerFromTracker(String coreName) throws StoreException {
        SolrServer solrServer = null;
        for (int i = 0; solrServer == null && i <= SECONDS_TO_WAITFOR_CORE_TO_BEREADY; i++) {
            RegisteredSolrServerTracker tracker = null;
            try {
                tracker = new RegisteredSolrServerTracker(bundleContext, new IndexReference(
                        managedSolrServer.getServerName(), coreName));
View Full Code Here


    public SolrServer getServer() throws StoreException {
        return getServer(CONTENTHUB_DEFAULT_INDEX_NAME);
    }

    public SolrServer getServer(String coreName) throws StoreException {
        SolrServer solrServer = null;
        if (coreName == null || coreName.trim().isEmpty()) {
            coreName = CONTENTHUB_DEFAULT_INDEX_NAME;
        }
        if (cache.containsKey(coreName)) {
            // check cache for the server reference
View Full Code Here

        return getAllFacetResults(null);
    }

    @Override
    public List<FacetResult> getAllFacetResults(String ldProgramName) throws SearchException {
        SolrServer solrServer = getSolrServer(ldProgramName);
        List<FacetResult> facetResults = new ArrayList<FacetResult>();
        NamedList<Object> fieldsList;
        try {
            fieldsList = SolrQueryUtil.getAllFacetFields(solrServer);
            for (int i = 0; i < fieldsList.size(); i++) {
View Full Code Here

        return facetResults;
    }

    private SolrServer getSolrServer(String ldProgramName) throws SearchException {
        try {
            SolrServer solrServer = SolrCoreManager.getInstance(bundleContext, managedSolrServer).getServer(
                ldProgramName);
            return solrServer;
        } catch (StoreException e) {
            String msg = String
                    .format("SolrSearchImpl.getFacetNames: Failed to obtain solr server for ldprogram: %s",
View Full Code Here

    }

    @Override
    public QueryResponse search(String queryTerm) throws SearchException {
        SolrQuery solrQuery = null;
        SolrServer solrServer = null;
        try {
            solrServer = SolrCoreManager.getInstance(bundleContext, managedSolrServer).getServer();
            solrQuery = SolrQueryUtil.prepareSolrQuery(solrServer, queryTerm);
        } catch (StoreException e) {
            throw new SearchException(e.getMessage(), e);
View Full Code Here

    @Override
    public QueryResponse search(String queryTerm, String ldProgramName) throws SearchException {
        // By default solr query, we perform a faceted search when a keyword is supplied. To customize the search
        // please use the method which accepts SolrParams/SolrQuery
        SolrQuery solrQuery = null;
        SolrServer solrServer = null;
        try {
            solrServer = SolrCoreManager.getInstance(bundleContext, managedSolrServer).getServer(ldProgramName);
            solrQuery = SolrQueryUtil.prepareSolrQuery(solrServer, queryTerm);
        } catch (StoreException e) {
            throw new SearchException(e.getMessage(), e);
View Full Code Here

        return executeSolrQuery(solrServer, solrQuery);
    }

    @Override
    public QueryResponse search(SolrParams solrQuery) throws SearchException {
        SolrServer solrServer = null;
        try {
            solrServer = SolrCoreManager.getInstance(bundleContext, managedSolrServer).getServer();
        } catch (StoreException e) {
            throw new SearchException(e);
        }
View Full Code Here

        return executeSolrQuery(solrServer, solrQuery);
    }

    @Override
    public QueryResponse search(SolrParams solrQuery, String ldProgramName) throws SearchException {
        SolrServer solrServer = null;
        try {
            solrServer = SolrCoreManager.getInstance(bundleContext, managedSolrServer).getServer(
                ldProgramName);
        } catch (StoreException e) {
            throw new SearchException(e);
View Full Code Here

   
    deleteAllDocuments();
  }
 
  private void deleteAllDocuments() throws SolrServerException, IOException {
    SolrServer s = solrServer;
    s.deleteByQuery("*:*"); // delete everything!
    s.commit();
  }
View Full Code Here

      /* create a Solr instance to check document has been indexed as expected */
      URL solrURL = this.getClass().getResource("/org/apache/uima/solrcas/");
      System.setProperty("solr.solr.home", new File(solrURL.toURI()).getAbsolutePath());
      CoreContainer.Initializer initializer = new CoreContainer.Initializer();
      CoreContainer coreContainer = initializer.initialize();
      SolrServer solrServer = new EmbeddedSolrServer(coreContainer, "");

      ModifiableSolrParams solrParams = new ModifiableSolrParams();
      solrParams.add("q", "annotation:Francesco");
      QueryResponse queryResponse = solrServer.query(solrParams);

      /* check the result contains only one doc with 2 annotations of the mock CAS */
      assertTrue(queryResponse != null);
      SolrDocumentList results = queryResponse.getResults();
      assertTrue(results.getNumFound() == 1);
View Full Code Here

TOP

Related Classes of org.apache.solr.client.solrj.SolrServer

Copyright © 2018 www.massapicom. 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.