Package org.apache.solr.client.solrj

Examples of org.apache.solr.client.solrj.SolrServer.deleteByQuery()


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

  @After
  @Override
View Full Code Here


        } else if (operation.equalsIgnoreCase(SolrConstants.OPERATION_INSERT_STREAMING)) {
            insert(exchange, serverToUse);
        } else if (operation.equalsIgnoreCase(SolrConstants.OPERATION_DELETE_BY_ID)) {
            serverToUse.deleteById(exchange.getIn().getBody(String.class));
        } else if (operation.equalsIgnoreCase(SolrConstants.OPERATION_DELETE_BY_QUERY)) {
            serverToUse.deleteByQuery(exchange.getIn().getBody(String.class));
        } else if (operation.equalsIgnoreCase(SolrConstants.OPERATION_ADD_BEAN)) {
            serverToUse.addBean(exchange.getIn().getBody());
        } else if (operation.equalsIgnoreCase(SolrConstants.OPERATION_ADD_BEANS)) {
            serverToUse.addBeans(exchange.getIn().getBody(Collection.class));
        } else if (operation.equalsIgnoreCase(SolrConstants.OPERATION_COMMIT)) {
View Full Code Here

        }
       
        boolean isSuccess = false;
        try {
            SolrServer solrClient = this.getSolrClient();
            solrClient.deleteByQuery(queryString, COMMIT_WITHIN_MS);
            isSuccess = true;
        } catch (SolrServerException e) {
            logger.error("Delete indexs by queryString fail!", e);
        } catch (IOException e) {
            logger.error("Delete indexs by queryString fail!", e);
View Full Code Here

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

  @After
  @Override
View Full Code Here

            if (exampleId == null) {
                throw new IllegalArgumentException("exampleId and text should not be null simultaneously");
            }
            SolrServer solrServer = getActiveSolrServer();
            try {
                solrServer.deleteByQuery(exampleIdField + ":" + exampleId);
                solrServer.commit();
                return exampleId;
            } catch (Exception e) {
                String msg = String.format("Error deleting example with id '%s' on Solr Core '%s'",
                    exampleId, solrCoreId);
View Full Code Here

    @Override
    public void removeAllConcepts() throws ClassifierException {
        SolrServer solrServer = getActiveSolrServer();
        try {
            solrServer.deleteByQuery("*:*");
            solrServer.commit();
        } catch (Exception e) {
            String msg = String.format("Error deleting concepts from Solr Core '%s'", solrCoreId);
            throw new ClassifierException(msg, e);
        }
View Full Code Here

        if (conceptId == null || conceptId.isEmpty()) {
            throw new ClassifierException("conceptId must not be null or empty");
        }
        SolrServer solrServer = getActiveSolrServer();
        try {
            solrServer.deleteByQuery(conceptUriField + ":" + ClientUtils.escapeQueryChars(conceptId));
            solrServer.commit();
        } catch (Exception e) {
            String msg = String
                    .format("Error removing concept '%s' on Solr Core '%s'", conceptId, solrCoreId);
            throw new ClassifierException(msg, e);
View Full Code Here

            AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
                public Object run() throws IOException, SolrServerException {
                    if(config.isMultiYardIndexLayout()){
                        //make sure we only delete the Entity only if it is  managed by
                        //this Yard. Entities of other Yards MUST NOT be deleted!
                        server.deleteByQuery(String.format("%s:%s AND %s:%s",
                            fieldMapper.getDocumentDomainField(),
                            SolrUtil.escapeSolrSpecialChars(getId()),
                            fieldMapper.getDocumentIdField(),
                            SolrUtil.escapeSolrSpecialChars(id)));
                    } else {
View Full Code Here

                    if(config.isMultiYardIndexLayout()){
                        //make sure we only delete Entities managed by this Yard
                        //if someone parses an ID managed by an other yard we MUST NOT
                        //delete it!
                        for(String id : toRemove){
                            server.deleteByQuery(String.format("%s:%s AND %s:%s",
                                fieldMapper.getDocumentDomainField(),
                                SolrUtil.escapeSolrSpecialChars(getId()),
                                fieldMapper.getDocumentIdField(),
                                SolrUtil.escapeSolrSpecialChars(id)));
                        }
View Full Code Here

                    //ensures that the fildMapper is initialised and reads the
                    //namespace config before deleting all documents
                    FieldMapper fieldMapper = getFieldMapper();
                    if(config.isMultiYardIndexLayout()){
                        //only delete entities of this referenced site
                        server.deleteByQuery(String.format("%s:%s",
                            fieldMapper.getDocumentDomainField(),
                            SolrUtil.escapeSolrSpecialChars(getId())));
                    } else { //we can delete all
                        server.deleteByQuery("*:*");
                    }
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.