Package org.apache.solr.client.solrj.request

Examples of org.apache.solr.client.solrj.request.ContentStreamUpdateRequest


        try {
            if(getSolr() != null)
            {
                if(CollectionUtils.isNotEmpty(streams))
                {
                    ContentStreamUpdateRequest req = new ContentStreamUpdateRequest("/update/extract");

                    for(BitstreamContentStream bce : streams)
                    {
                        req.addContentStream(bce);
                    }

                    ModifiableSolrParams params = new ModifiableSolrParams();

                    //req.setParam(ExtractingParams.EXTRACT_ONLY, "true");
                    for(String name : doc.getFieldNames())
                    {
                        for(Object val : doc.getFieldValues(name))
                        {
                             params.add(ExtractingParams.LITERALS_PREFIX + name,val.toString());
                        }
                    }

                    req.setParams(params);
                    req.setParam(ExtractingParams.UNKNOWN_FIELD_PREFIX, "attr_");
                    req.setParam(ExtractingParams.MAP_PREFIX + "content", "fulltext");
                    req.setParam(ExtractingParams.EXTRACT_FORMAT, "text");
                    req.setAction(AbstractUpdateRequest.ACTION.COMMIT, true, true);
                    req.process(getSolr());
                }
                else
                {
                    getSolr().add(doc);
                }
View Full Code Here


                yearQueryParams.put(CommonParams.START, String.valueOf((i + 10000)));
            }

            for (File tempCsv : filesToUpload) {
                //Upload the data in the csv files to our new solr core
                ContentStreamUpdateRequest contentStreamUpdateRequest = new ContentStreamUpdateRequest("/update/csv");
                contentStreamUpdateRequest.setParam("stream.contentType", "text/plain;charset=utf-8");
                contentStreamUpdateRequest.setAction(AbstractUpdateRequest.ACTION.COMMIT, true, true);
                contentStreamUpdateRequest.addFile(tempCsv, "text/plain;charset=utf-8");

                statisticsYearServer.request(contentStreamUpdateRequest);
            }
            statisticsYearServer.commit(true, true);
View Full Code Here

                csvp.close();
            }

            //Add all the separate csv files
            for (File tempCsv : tempCsvFiles) {
                ContentStreamUpdateRequest contentStreamUpdateRequest = new ContentStreamUpdateRequest("/update/csv");
                contentStreamUpdateRequest.setParam("stream.contentType", "text/plain;charset=utf-8");
                contentStreamUpdateRequest.setAction(AbstractUpdateRequest.ACTION.COMMIT, true, true);
                contentStreamUpdateRequest.addFile(tempCsv, "text/plain;charset=utf-8");

                solr.request(contentStreamUpdateRequest);
            }

            //Now that all our new bitstream stats are in place, delete all the old ones !
View Full Code Here

            return false;
        }
    }

    public void add(final File file, final String solrId) throws IOException {
        final ContentStreamUpdateRequest up = new ContentStreamUpdateRequest("/update/extract");
        up.addFile(file);
        up.setParam("literal.id", solrId);
        up.setParam("uprefix", "attr_");
        up.setParam("fmap.content", "attr_content");
        //up.setAction(AbstractUpdateRequest.ACTION.COMMIT, true, true);
        try {
            this.server.request(up);
            this.server.commit();
        } catch (final Throwable e) {
View Full Code Here

     *
     * @throws IngesterException if there was an error processing a specific
     * content, but the Solr server is probably fine.
     */
    private void ingestExtract(ContentStream cs, Map<String, String> fields, final long size) throws IngesterException {
        final ContentStreamUpdateRequest up = new ContentStreamUpdateRequest("/update/extract"); //NON-NLS
        up.addContentStream(cs);
        setFields(up, fields);
        up.setAction(AbstractUpdateRequest.ACTION.COMMIT, true, true);

        final String contentType = cs.getContentType();
        if (contentType != null && !contentType.trim().equals("")) {
            up.setParam("stream.contentType", contentType); //NON-NLS
        }

        //logger.log(Level.INFO, "Ingesting " + fields.get("file_name"));
        up.setParam("commit", "false"); //NON-NLS

        final Future<?> f = upRequestExecutor.submit(new UpRequestTask(up));

        try {
            f.get(getTimeout(size), TimeUnit.SECONDS);
View Full Code Here

TOP

Related Classes of org.apache.solr.client.solrj.request.ContentStreamUpdateRequest

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.