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 Dipti Srivastava <Di...@apollogrp.edu> on 2011/12/19 19:24:24 UTC

Inserting a field in the json doc before indexing

Hi,
I am using HTTP and json to add my documents to Solr. Now, I have defined a special field in the Solr schema which defines what type of document that is being added. This field needs to be inserted into the json doc that I receive from my caller. Is there a way to do this?

Thanks!
Dipti

________________________________
This message is private and confidential. If you have received it in error, please notify the sender and remove it from your system.


Re: Inserting a field in the json doc before indexing

Posted by Dipti Srivastava <Di...@apollogrp.edu>.
Thanks for responding. Both options seem good. For now I just need to
manipulate the JSON string I get and add a special field to it which I
will later on use for my searches. I am going with the approach of using a
JSONObject and converting it back to string.
Dipti

On 12/20/11 10:32 AM, "Erick Erickson" <er...@gmail.com> wrote:

>The other option is to write  custom update handler that injected the
>data, a lot depends on whether you want to put the load on
>the server or client.
>
>Best
>Erick
>
>On Mon, Dec 19, 2011 at 1:35 PM, Anuj Kumar <an...@gmail.com> wrote:
>> Hi Dipti,
>>
>> If you are receiving the JSON within your Java code, you can try any
>> library, like- GSON [1] to manipulate JSON before sending it to Solr.
>>
>> - Anuj
>>
>> 1. http://code.google.com/p/google-gson/
>>
>> On Mon, Dec 19, 2011 at 11:54 PM, Dipti Srivastava <
>> Dipti.Srivastava@apollogrp.edu> wrote:
>>
>>> Hi,
>>> I am using HTTP and json to add my documents to Solr. Now, I have
>>>defined
>>> a special field in the Solr schema which defines what type of document
>>>that
>>> is being added. This field needs to be inserted into the json doc that
>>>I
>>> receive from my caller. Is there a way to do this?
>>>
>>> Thanks!
>>> Dipti
>>>
>>> ________________________________
>>> This message is private and confidential. If you have received it in
>>> error, please notify the sender and remove it from your system.
>>>
>>>
>


This message is private and confidential. If you have received it in error, please notify the sender and remove it from your system.



Re: Inserting a field in the json doc before indexing

Posted by Erick Erickson <er...@gmail.com>.
The other option is to write  custom update handler that injected the
data, a lot depends on whether you want to put the load on
the server or client.

Best
Erick

On Mon, Dec 19, 2011 at 1:35 PM, Anuj Kumar <an...@gmail.com> wrote:
> Hi Dipti,
>
> If you are receiving the JSON within your Java code, you can try any
> library, like- GSON [1] to manipulate JSON before sending it to Solr.
>
> - Anuj
>
> 1. http://code.google.com/p/google-gson/
>
> On Mon, Dec 19, 2011 at 11:54 PM, Dipti Srivastava <
> Dipti.Srivastava@apollogrp.edu> wrote:
>
>> Hi,
>> I am using HTTP and json to add my documents to Solr. Now, I have defined
>> a special field in the Solr schema which defines what type of document that
>> is being added. This field needs to be inserted into the json doc that I
>> receive from my caller. Is there a way to do this?
>>
>> Thanks!
>> Dipti
>>
>> ________________________________
>> This message is private and confidential. If you have received it in
>> error, please notify the sender and remove it from your system.
>>
>>

Re: Inserting a field in the json doc before indexing

Posted by Anuj Kumar <an...@gmail.com>.
Hi Dipti,

If you are receiving the JSON within your Java code, you can try any
library, like- GSON [1] to manipulate JSON before sending it to Solr.

- Anuj

1. http://code.google.com/p/google-gson/

On Mon, Dec 19, 2011 at 11:54 PM, Dipti Srivastava <
Dipti.Srivastava@apollogrp.edu> wrote:

> Hi,
> I am using HTTP and json to add my documents to Solr. Now, I have defined
> a special field in the Solr schema which defines what type of document that
> is being added. This field needs to be inserted into the json doc that I
> receive from my caller. Is there a way to do this?
>
> Thanks!
> Dipti
>
> ________________________________
> This message is private and confidential. If you have received it in
> error, please notify the sender and remove it from your system.
>
>