Package org.apache.stanbol.contenthub.servicesapi.store.solr

Examples of org.apache.stanbol.contenthub.servicesapi.store.solr.SolrContentItem


  @Override
  public String put(ContentItem ci) throws StoreException {
    SolrInputDocument doc = new SolrInputDocument();
    addDefaultFields(ci, doc);
    if (ci instanceof SolrContentItem) {
      SolrContentItem sci = (SolrContentItem) ci;
      addSolrSpecificFields(sci, doc);
    }
    SolrServer solrServer = SolrCoreManager.getInstance(bundleContext,
        managedSolrServer).getServer();
    try {
View Full Code Here


        Map<String,List<Object>> constraints = getConstraintsFromNode(contentContext);
        if (constraints.isEmpty()) {
            log.debug("There is no constraint for the node having id: {}", id);
        }

        SolrContentItem sci = solrStore.create(contentContext.getContent(), id, contentContext.getNodeName(),
            contentContext.getContentType(), constraints);
        try {
            solrStore.enhanceAndPut(sci, indexName);
        } catch (StoreException e) {
            log.error(e.getMessage(), e);
        }
        log.info("Document submitted to Contenthub.");
        log.info("Id: {}", sci.getUri().getUnicodeString());
        log.info("Mime type: {}", sci.getMimeType());
        log.info("Constraints: {}", sci.getConstraints().toString());
    }
View Full Code Here

     * @throws StoreException
     */
    @GET
    @Path("/edit/{uri:.+}")
    public Response editContentItem(@PathParam(value = "uri") String contentURI, @Context HttpHeaders headers) throws StoreException {
        SolrContentItem sci = (SolrContentItem) solrStore.get(contentURI, indexName);
        if (sci == null) {
            throw new WebApplicationException(404);
        }

        String jsonString;
View Full Code Here

                                              String title,
                                              HttpHeaders headers) throws EngineException,
                                                                  URISyntaxException,
                                                                  StoreException {

        SolrContentItem sci = solrStore.create(content, contentURI, title, mediaType.toString(), constraints);
        solrStore.enhanceAndPut(sci, indexName);
        if (useExplicitRedirect) {
            // use an redirect to point browsers to newly created content
            ResponseBuilder rb = Response.seeOther(makeRedirectionURI(sci.getUri().getUnicodeString()));
            addCORSOrigin(servletContext, rb, headers);
            return rb.build();
        } else {
            // use the correct way of notifying the RESTful client that the
            // resource has been successfully created
            ResponseBuilder rb = Response.created(makeRedirectionURI(sci.getUri().getUnicodeString()));
            addCORSOrigin(servletContext, rb, headers);
            return rb.build();
        }
    }
View Full Code Here

            return;
        }
        String mimeType = d.getContentStreamMimeType();
        Map<String,List<Object>> constraints = getConstraintsFromDocument(d);
        id = (id == null || id.equals("")) ? d.getId() : id;
        SolrContentItem sci = solrStore.create(content, d.getId(), d.getName(), mimeType, constraints);
        try {
            solrStore.enhanceAndPut(sci, indexName);
        } catch (StoreException e) {
            log.error(e.getMessage(), e);
        }
        log.info("Document submitted to Contenthub.");
        log.info("Id: {}", sci.getUri().getUnicodeString());
        log.info("Mime type: {}", sci.getMimeType());
        log.info("Constraints: {}", sci.getConstraints().toString());
    }
View Full Code Here

TOP

Related Classes of org.apache.stanbol.contenthub.servicesapi.store.solr.SolrContentItem

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.