Package org.apache.solr.client.solrj

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


                update.setCommitWithin(commitWithin);
            }
            update.add(inputDocs);
            update.process(server);
            if (immediateCommit) {
                server.commit();
            }
        } catch (SolrServerException e) {
            throw new YardException("Exception while adding Documents to the Solr Server!", e);
        } catch (IOException e) {
            throw new YardException("Unable to access Solr server", e);
View Full Code Here


                update.add(inputDocs);
                AccessController.doPrivileged(new PrivilegedExceptionAction<Object>() {
                    public UpdateResponse run() throws IOException, SolrServerException {
                        update.process(server);
                        if (immediateCommit) {
                            server.commit();
                        }
                        return null;
                    }
                });
            } catch (PrivilegedActionException pae){
View Full Code Here

        } 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_COMMIT)) {
            serverToUse.commit();
        } else if (operation.equalsIgnoreCase(SolrConstants.OPERATION_ROLLBACK)) {
            serverToUse.rollback();
        } else if (operation.equalsIgnoreCase(SolrConstants.OPERATION_OPTIMIZE)) {
            serverToUse.optimize();
        } else {
View Full Code Here

        }
    }

    private List<RecordId> querySolr(String name) throws SolrServerException, IOException {
        SolrServer solr = lilyProxy.getSolrProxy().getSolrServer();
        solr.commit();
        SolrQuery solrQuery = new SolrQuery();
        //set default search field (no longer supported in schema.xml
        solrQuery.set("df", "name");
        solrQuery.setQuery(name);
        solrQuery.set("fl", "lily.id");
View Full Code Here

    }

    private void wipeSolr(String coreName) throws Exception{
        SolrServer server = lilyProxy.getSolrProxy().getSolrServer(coreName);
        server.deleteByQuery("*:*");
        server.commit();
        assertEquals(0, countDocsInRepo(coreName));
    }

    private long countDocsInRepo(String coreName) throws SolrServerException {
        SolrDocumentList results = getAllDocs(coreName);
View Full Code Here

            throw new IllegalArgumentException("The parsed Representation id MUST NOT be empty!");
        }
        SolrServer server = getServer();
        try {
            server.deleteById(id);
            server.commit();
        } catch (SolrServerException e) {
            throw new YardException("Error while deleting document " + id + " from the Solr server", e);
        } catch (IOException e) {
            throw new YardException("Unable to access SolrServer", e);
        }
View Full Code Here

            }
        }
        SolrServer server = getServer();
        try {
            server.deleteById(toRemove);
            server.commit();
        } catch (SolrServerException e) {
            throw new YardException("Error while deleting documents from the Solr server", e);
        } catch (IOException e) {
            throw new YardException("Unable to access SolrServer", e);
        }
View Full Code Here

                update.setCommitWithin(commitWithin);
            }
            update.add(inputDocument);
            update.process(server);
            if (immediateCommit) {
                server.commit();
            }
            long stored = System.currentTimeMillis();
            log.debug("  ... done [create={}ms|store={}ms|sum={}ms]", new Object[] {(create - start),
                                                                                    (stored - create),
                                                                                    (stored - start)});
View Full Code Here

                update.setCommitWithin(commitWithin);
            }
            update.add(inputDocs);
            update.process(server);
            if (immediateCommit) {
                server.commit();
            }
        } catch (SolrServerException e) {
            throw new YardException("Exception while adding Documents to the Solr Server!", e);
        } catch (IOException e) {
            throw new YardException("Unable to access Solr server", e);
View Full Code Here

                    update.setCommitWithin(commitWithin);
                }
                update.add(inputDocs);
                update.process(server);
                if (immediateCommit) {
                    server.commit();
                }
            } catch (SolrServerException e) {
                throw new YardException("Error while adding updated Documents to the SolrServer", e);
            } catch (IOException e) {
                throw new YardException("Unable to access Solr server", e);
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.