Package org.apache.solr.client.solrj

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


public class EmbeddedSolrCASConsumer extends SolrCASConsumer {

  @Override
  protected SolrServer createServer() throws SolrServerException {
    SolrServer solrServer = null;
    try {
      String solrInstanceTypeParam = String.valueOf(getContext().
              getConfigParameterValue("solrInstanceType"));
 
      String solrPathParam = String.valueOf(getContext().
View Full Code Here


    SolrMappingConfiguration solrMappingConfiguration = fieldMappingReader.getConf(input);
    return solrMappingConfiguration;
  }

  protected SolrServer createServer() throws SolrServerException {
    SolrServer solrServer = null;
    try {
      /* get Solr type*/
      String solrInstanceTypeParam = String.valueOf(getContext().
              getConfigParameterValue("solrInstanceType"));
 
View Full Code Here

                    super.modifiedService(reference, service);
                }
               
                @Override
                public SolrServer addingService(ServiceReference reference) {
                    SolrServer server = super.addingService(reference);
                    if(solrCore != null){
                        log.warn("Multiple SolrServer for IndexLocation {} available!",
                            indexReference);
                    } else {
                        log.info(" ... SolrCore for {} becomes available!", indexReference);
View Full Code Here

        config.setImmediateCommit(true);
        //init the ManagedSolrServer used for the UnitTest
        System.setProperty(ManagedSolrServer.MANAGED_SOLR_DIR_PROPERTY, solrServerDir);
        IndexReference solrServerRef = IndexReference.parse(config.getSolrServerLocation());
        solrServerProvider = StandaloneEmbeddedSolrServerProvider.getInstance();
        SolrServer server = solrServerProvider.getSolrServer(solrServerRef,
            config.isAllowInitialisation() ? config.getIndexConfigurationName() : null);
        //Optional support for the nsPrefix service
        final NamespacePrefixService nsPrefixService;
        ServiceLoader<NamespacePrefixService> spsl = ServiceLoader.load(NamespacePrefixService.class);
        Iterator<NamespacePrefixService> it = spsl.iterator();
View Full Code Here

                        super.modifiedService(reference, service);
                    }
                   
                    @Override
                    public SolrServer addingService(ServiceReference reference) {
                        SolrServer server = super.addingService(reference);
                        if(solrServer != null){
                            log.warn("Multiple SolrServer for IndexLocation {} available!",
                                config.getSolrServerLocation());
                        } else {
                            updateSolrYardRegistration(server,config);
View Full Code Here

    public SolrServer[] getServices() {
        ServiceReference[] refs = getServiceReferences();
        Collection<SolrServer> servers = new ArrayList<SolrServer>(refs.length);
        if(refs != null){
            for(ServiceReference ref : refs){
                SolrServer server = getService(ref);
                if(server != null){
                    servers.add(server);
                } //else null ... ignore
            }
        }
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 String put(ContentItem ci, String ldProgramName) throws StoreException {
        SolrInputDocument doc = new SolrInputDocument();
        addDefaultFields(ci, doc);
        SolrServer solrServer;
        if (ldProgramName == null || ldProgramName.isEmpty()
            || ldProgramName.equals(SolrCoreManager.CONTENTHUB_DEFAULT_INDEX_NAME)) {

            addSolrSpecificFields(ci, doc);
            solrServer = SolrCoreManager.getInstance(bundleContext, managedSolrServer).getServer();
        } else {
            addSolrSpecificFields(ci, doc, ldProgramName);
            solrServer = SolrCoreManager.getInstance(bundleContext, managedSolrServer).getServer(
                ldProgramName);
        }
        updateEnhancementGraph(ci);
        try {
            solrServer.add(doc);
            solrServer.commit();
            log.debug("Documents are committed to Solr Server successfully.");
        } catch (SolrServerException e) {
            log.error("Solr Server Exception", e);
            throw new StoreException(e.getMessage(), e);
        } catch (IOException e) {
View Full Code Here

    @Override
    public ContentItem get(String id, String ldProgramName) throws StoreException {
        if (id == null) {
            throw new IllegalArgumentException("Id of the requested ContentItem cannot be null");
        }
        SolrServer solrServer = SolrCoreManager.getInstance(bundleContext, managedSolrServer).getServer(
            ldProgramName);
        byte[] content = null;
        String mimeType = null;

        SolrQuery query = new SolrQuery();
        StringBuilder queryString = new StringBuilder();
        queryString.append(SolrFieldName.ID.toString());
        queryString.append(":\"");
        queryString.append(id);
        queryString.append('\"');
        query.setQuery(queryString.toString());
        QueryResponse response;
        try {
            response = solrServer.query(query);
            SolrDocumentList results = response.getResults();
            if (results != null && results.size() > 0) {
                SolrDocument result = results.get(0);
                content = (byte[]) result.getFieldValue(SolrFieldName.BINARYCONTENT.toString());
                mimeType = (String) result.getFieldValue(SolrFieldName.MIMETYPE.toString());
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.