Solr update/csv

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Solr update/csv

ovosh
This post was updated on .
Hi all!
I try to upload some data to my new instance with upload/csv.
Like this
 curl 'http://localhost:8983/solr/sampler/update/csv?commit=true&separator=%09&escape=%5c&fieldnames=mutation,allele1FWD,allele2REF,type,action,xraw,yraw&stream.file=/tmp/439.txt'

How i can add some default value for each row?

p/s solr version 5.2.1
Reply | Threaded
Open this post in threaded view
|

Re: Solr update/csv

Alexandre Rafalovitch
All the parameters are here:
https://cwiki.apache.org/confluence/display/solr/Uploading+Data+with+Index+Handlers#UploadingDatawithIndexHandlers-CSVFormattedIndexUpdates

Perhaps "literal.fieldname" is what you are looking for? That is
assuming default value for _other_ fields, not listed in CSV.

If you are talking about default values which may or may not overriden
by CSV content, then the best way is probably an
UpdateRequestProcessor chain that allows to provide a default value:
http://www.solr-start.com/javadoc/solr-lucene/org/apache/solr/update/processor/DefaultValueUpdateProcessorFactory.html
. (usually combined with
http://www.solr-start.com/javadoc/solr-lucene/org/apache/solr/update/processor/TrimFieldUpdateProcessorFactory.html
)

You don't have to have the URP chain be default all the time, but can
add it as a URL parameter "update.chain".

Regards,
   Alex.
----
Newsletter and resources for Solr beginners and intermediates:
http://www.solr-start.com/


On 18 June 2016 at 22:02, ovosh <[hidden email]> wrote:

> Hi all!
> I try to upload some data to my new instance with upload/csv.
> Like this
> * curl
> 'http://localhost:8983/solr/sampler/update/csv?commit=true&separator=%09&escape=%5c&fieldnames=mutation,allele1FWD,allele2REF,type,action,xraw,yraw&stream.file=/tmp/439.txt'*
>
> How i can add some default value for each row?
>
>
>
>
> --
> View this message in context: http://lucene.472066.n3.nabble.com/Solr-update-csv-tp4283168.html
> Sent from the Solr - User mailing list archive at Nabble.com.
Reply | Threaded
Open this post in threaded view
|

Re: Solr update/csv

Malcolm Upayavira Holmes
Don't forget you can set a default value in the field definition in your
schema.

Upayavira

On Sun, 19 Jun 2016, at 03:21 PM, Alexandre Rafalovitch wrote:

> All the parameters are here:
> https://cwiki.apache.org/confluence/display/solr/Uploading+Data+with+Index+Handlers#UploadingDatawithIndexHandlers-CSVFormattedIndexUpdates
>
> Perhaps "literal.fieldname" is what you are looking for? That is
> assuming default value for _other_ fields, not listed in CSV.
>
> If you are talking about default values which may or may not overriden
> by CSV content, then the best way is probably an
> UpdateRequestProcessor chain that allows to provide a default value:
> http://www.solr-start.com/javadoc/solr-lucene/org/apache/solr/update/processor/DefaultValueUpdateProcessorFactory.html
> . (usually combined with
> http://www.solr-start.com/javadoc/solr-lucene/org/apache/solr/update/processor/TrimFieldUpdateProcessorFactory.html
> )
>
> You don't have to have the URP chain be default all the time, but can
> add it as a URL parameter "update.chain".
>
> Regards,
>    Alex.
> ----
> Newsletter and resources for Solr beginners and intermediates:
> http://www.solr-start.com/
>
>
> On 18 June 2016 at 22:02, ovosh <[hidden email]> wrote:
> > Hi all!
> > I try to upload some data to my new instance with upload/csv.
> > Like this
> > * curl
> > 'http://localhost:8983/solr/sampler/update/csv?commit=true&separator=%09&escape=%5c&fieldnames=mutation,allele1FWD,allele2REF,type,action,xraw,yraw&stream.file=/tmp/439.txt'*
> >
> > How i can add some default value for each row?
> >
> >
> >
> >
> > --
> > View this message in context: http://lucene.472066.n3.nabble.com/Solr-update-csv-tp4283168.html
> > Sent from the Solr - User mailing list archive at Nabble.com.