You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by Rajani Maski <ra...@gmail.com> on 2012/08/03 11:37:37 UTC

Adding new field before import- using post.jar

Hi all,

I have xmls in a folder in the standard solr xml format. I was simply using
SimplePostTool.java to import these xmls to solr. Now I have to add 3 new
fields to each document in the xml before doing a post.

What can be the effective way for doing this?


Thanks & Regards
Rajani

Re: Adding new field before import- using post.jar

Posted by Lance Norskog <go...@gmail.com>.
For a permanent solution, DataImportHandler and the scripting update
handler are the best choices- they are small files and live inside
Solr.

On Sat, Aug 4, 2012 at 12:02 PM, Jack Krupansky <ja...@basetechnology.com> wrote:
> Sounds like a perl script would be sufficient.
>
>
> -- Jack Krupansky
>
> -----Original Message----- From: Rajani Maski
> Sent: Saturday, August 04, 2012 2:23 PM
> To: solr-user@lucene.apache.org
> Subject: Re: Adding new field before import- using post.jar
>
>
> They are coming from text file.
>
> SolrXML input documents are xmls in folder location. (To import these xmls,
> I was using simple post.jar) Now, for each xml there is need to add 3
> external new fields reading values from text file.
>
>
> Regards
> Rajani
>
> On Sat, Aug 4, 2012 at 10:59 PM, Jack Krupansky
> <ja...@basetechnology.com>wrote:
>
>> Where are the values of the three new fields coming from?
>>
>> Are they constant/default values?
>> Computed from other fields in the XML?
>> From other XML files?
>> From a text file?
>> From a database?
>> Or where?
>>
>> So, given a specific Solr XML input document, how will you be accessing
>> the three field values to add?
>>
>> This may guide the approach that you could/should take.
>>
>>
>> -- Jack Krupansky
>>
>> -----Original Message----- From: Rajani Maski
>> Sent: Friday, August 03, 2012 5:37 AM
>> To: solr-user@lucene.apache.org
>> Subject: Adding new field before import- using post.jar
>>
>> Hi all,
>>
>> I have xmls in a folder in the standard solr xml format. I was simply
>> using
>> SimplePostTool.java to import these xmls to solr. Now I have to add 3 new
>> fields to each document in the xml before doing a post.
>>
>> What can be the effective way for doing this?
>>
>>
>> Thanks & Regards
>> Rajani
>>
>



-- 
Lance Norskog
goksron@gmail.com

Re: Adding new field before import- using post.jar

Posted by Jack Krupansky <ja...@basetechnology.com>.
Sounds like a perl script would be sufficient.

-- Jack Krupansky

-----Original Message----- 
From: Rajani Maski
Sent: Saturday, August 04, 2012 2:23 PM
To: solr-user@lucene.apache.org
Subject: Re: Adding new field before import- using post.jar

They are coming from text file.

SolrXML input documents are xmls in folder location. (To import these xmls,
I was using simple post.jar) Now, for each xml there is need to add 3
external new fields reading values from text file.


Regards
Rajani

On Sat, Aug 4, 2012 at 10:59 PM, Jack Krupansky 
<ja...@basetechnology.com>wrote:

> Where are the values of the three new fields coming from?
>
> Are they constant/default values?
> Computed from other fields in the XML?
> From other XML files?
> From a text file?
> From a database?
> Or where?
>
> So, given a specific Solr XML input document, how will you be accessing
> the three field values to add?
>
> This may guide the approach that you could/should take.
>
>
> -- Jack Krupansky
>
> -----Original Message----- From: Rajani Maski
> Sent: Friday, August 03, 2012 5:37 AM
> To: solr-user@lucene.apache.org
> Subject: Adding new field before import- using post.jar
>
> Hi all,
>
> I have xmls in a folder in the standard solr xml format. I was simply 
> using
> SimplePostTool.java to import these xmls to solr. Now I have to add 3 new
> fields to each document in the xml before doing a post.
>
> What can be the effective way for doing this?
>
>
> Thanks & Regards
> Rajani
> 


Re: Adding new field before import- using post.jar

Posted by Rajani Maski <ra...@gmail.com>.
They are coming from text file.

SolrXML input documents are xmls in folder location. (To import these xmls,
I was using simple post.jar) Now, for each xml there is need to add 3
external new fields reading values from text file.


Regards
Rajani

On Sat, Aug 4, 2012 at 10:59 PM, Jack Krupansky <ja...@basetechnology.com>wrote:

> Where are the values of the three new fields coming from?
>
> Are they constant/default values?
> Computed from other fields in the XML?
> From other XML files?
> From a text file?
> From a database?
> Or where?
>
> So, given a specific Solr XML input document, how will you be accessing
> the three field values to add?
>
> This may guide the approach that you could/should take.
>
>
> -- Jack Krupansky
>
> -----Original Message----- From: Rajani Maski
> Sent: Friday, August 03, 2012 5:37 AM
> To: solr-user@lucene.apache.org
> Subject: Adding new field before import- using post.jar
>
> Hi all,
>
> I have xmls in a folder in the standard solr xml format. I was simply using
> SimplePostTool.java to import these xmls to solr. Now I have to add 3 new
> fields to each document in the xml before doing a post.
>
> What can be the effective way for doing this?
>
>
> Thanks & Regards
> Rajani
>

Re: Adding new field before import- using post.jar

Posted by Jack Krupansky <ja...@basetechnology.com>.
Where are the values of the three new fields coming from?

Are they constant/default values?
Computed from other fields in the XML?
>From other XML files?
>From a text file?
>From a database?
Or where?

So, given a specific Solr XML input document, how will you be accessing the 
three field values to add?

This may guide the approach that you could/should take.

-- Jack Krupansky

-----Original Message----- 
From: Rajani Maski
Sent: Friday, August 03, 2012 5:37 AM
To: solr-user@lucene.apache.org
Subject: Adding new field before import- using post.jar

Hi all,

I have xmls in a folder in the standard solr xml format. I was simply using
SimplePostTool.java to import these xmls to solr. Now I have to add 3 new
fields to each document in the xml before doing a post.

What can be the effective way for doing this?


Thanks & Regards
Rajani 


Re: Adding new field before import- using post.jar

Posted by Rajani Maski <ra...@gmail.com>.
Thank you for the reply.

8.How about Extending class : XmlUpdateRequestHandler? Is it possible and
good method?


Regards
Rajani






On Fri, Aug 3, 2012 at 8:32 PM, Erik Hatcher <er...@gmail.com> wrote:

> I hate to also add:
>
>   6. Use DataImportHandler
>
> It can index Solr XML, and could add field values, either statically or by
> template glue if you need to combine multiple field values somehow.
>
> And in 4.0 you'll be able to use:
>
>   7: scripting update processor
>
>         Erik
>
>
> On Aug 3, 2012, at 10:51 , Jack Krupansky wrote:
>
> > 1. Google for "XSLT tools".
> > 2. Write a script that loads the XML, adds the fields, and writes the
> updated XML.
> > 3. Same as #2, but using Java.
> > 4. If the fields are constants, set default values in the schema and
> then the documents will automatically get those values when added. Take the
> default value attributes out of the schema once you have input documents
> that actually have the new field values.
> > 5. Hire a consultant.
> >
> > -- Jack Krupansky
> >
> > -----Original Message----- From: Rajani Maski
> > Sent: Friday, August 03, 2012 5:37 AM
> > To: solr-user@lucene.apache.org
> > Subject: Adding new field before import- using post.jar
> >
> > Hi all,
> >
> > I have xmls in a folder in the standard solr xml format. I was simply
> using
> > SimplePostTool.java to import these xmls to solr. Now I have to add 3 new
> > fields to each document in the xml before doing a post.
> >
> > What can be the effective way for doing this?
> >
> >
> > Thanks & Regards
> > Rajani
>
>

Re: Adding new field before import- using post.jar

Posted by Erik Hatcher <er...@gmail.com>.
I hate to also add:

  6. Use DataImportHandler

It can index Solr XML, and could add field values, either statically or by template glue if you need to combine multiple field values somehow.

And in 4.0 you'll be able to use:

  7: scripting update processor

	Erik


On Aug 3, 2012, at 10:51 , Jack Krupansky wrote:

> 1. Google for "XSLT tools".
> 2. Write a script that loads the XML, adds the fields, and writes the updated XML.
> 3. Same as #2, but using Java.
> 4. If the fields are constants, set default values in the schema and then the documents will automatically get those values when added. Take the default value attributes out of the schema once you have input documents that actually have the new field values.
> 5. Hire a consultant.
> 
> -- Jack Krupansky
> 
> -----Original Message----- From: Rajani Maski
> Sent: Friday, August 03, 2012 5:37 AM
> To: solr-user@lucene.apache.org
> Subject: Adding new field before import- using post.jar
> 
> Hi all,
> 
> I have xmls in a folder in the standard solr xml format. I was simply using
> SimplePostTool.java to import these xmls to solr. Now I have to add 3 new
> fields to each document in the xml before doing a post.
> 
> What can be the effective way for doing this?
> 
> 
> Thanks & Regards
> Rajani 


Re: Adding new field before import- using post.jar

Posted by Jack Krupansky <ja...@basetechnology.com>.
1. Google for "XSLT tools".
2. Write a script that loads the XML, adds the fields, and writes the 
updated XML.
3. Same as #2, but using Java.
4. If the fields are constants, set default values in the schema and then 
the documents will automatically get those values when added. Take the 
default value attributes out of the schema once you have input documents 
that actually have the new field values.
5. Hire a consultant.

-- Jack Krupansky

-----Original Message----- 
From: Rajani Maski
Sent: Friday, August 03, 2012 5:37 AM
To: solr-user@lucene.apache.org
Subject: Adding new field before import- using post.jar

Hi all,

I have xmls in a folder in the standard solr xml format. I was simply using
SimplePostTool.java to import these xmls to solr. Now I have to add 3 new
fields to each document in the xml before doing a post.

What can be the effective way for doing this?


Thanks & Regards
Rajani