Package org.apache.solr.client.solrj

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


        } 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 {
            throw new IllegalArgumentException(SolrConstants.OPERATION + " header value '" + operation + "' is not supported");
        }
    }
View Full Code Here


      docs.add(doc);
    }

    solr.add(docs);
    solr.commit();
    solr.optimize();
    //<start id="solrj-search-1"/>
    SolrQuery queryParams = new SolrQuery();//<co id="solrj-search.co.query"/>
    queryParams.setFields("description", "title");//<co id="solrj-search.co.fields"/>
    queryParams.setQuery("description:win OR description:all");//<co id="solrj-search.co.terms"/>
    queryParams.setRows(10);
View Full Code Here

    public boolean saveOrUpdateBeans(List<Serializable> indexBeans) {
        boolean isSuccess = false;
        try {
            SolrServer solrServer = this.getSolrClient();
            solrServer.addBeans(indexBeans);
            solrServer.optimize();
            solrServer.commit();
            logger.info("Add or Update index beans request commit success! " + indexBeans);
            isSuccess = true;
        } catch (SolrServerException e) {
            logger.error(e.toString());
View Full Code Here

                    solrInputDocument.addField(key, value);
                }
                solrServer.add(solrInputDocument);
            }
           
            solrServer.optimize();
            solrServer.commit();
            logger.info("Add or Update index request commit success! " + indexDocuments);
            isSuccess = true;
        } catch (SolrServerException e) {
            logger.error(e.toString());
View Full Code Here

                solrServer.commit();
                if (count < batchSize) {
                    done = true;
                }
            }
            solrServer.optimize();
        } catch (Exception e) {
            String msg = String.format("Error while updating topics on Solr Core '%s'.", solrCoreId);
            throw new TrainingSetException(msg, e);
        }
        return processedCount;
View Full Code Here

            for (int cvFoldIndex = 0; cvFoldIndex < cvIterationCount; cvFoldIndex++) {
                updatedTopics = performCVFold(cvFoldIndex, cvFoldCount, cvIterationCount,
                    incremental);
            }
            SolrServer solrServer = getActiveSolrServer();
            solrServer.optimize();
        } catch (ConfigurationException e) {
            throw new ClassifierException(e);
        } catch (IOException e) {
            throw new ClassifierException(e);
        } catch (SolrServerException e) {
View Full Code Here

     * @throws YardException on any error while optimising
     */
    public final void optimize() throws YardException{
        SolrServer server = getServer();
        try {
            server.optimize();
        } catch (SolrServerException e) {
            throw new YardException("Unable to optimise SolrIndex!", e);
        } catch (IOException e) {
            throw new YardException("Unable to optimise SolrIndex!", e);
        }
View Full Code Here

        } 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 {
            throw new IllegalArgumentException(SolrConstants.OPERATION + " header value '" + operation + "' is not supported");
        }
    }
View Full Code Here

     * @throws YardException on any error while optimising
     */
    public final void optimize() throws YardException{
        SolrServer server = getServer();
        try {
            server.optimize();
        } catch (SolrServerException e) {
            throw new YardException("Unable to optimise SolrIndex!", e);
        } catch (IOException e) {
            throw new YardException("Unable to optimise SolrIndex!", e);
        }
View Full Code Here

                solrServer.commit();
                if (count < batchSize) {
                    done = true;
                }
            }
            solrServer.optimize();
        } catch (Exception e) {
            String msg = String.format("Error while updating topics on Solr Core '%s'.", solrCoreId);
            throw new TrainingSetException(msg, e);
        }
        return processedCount;
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.