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 Kamal Palei <pa...@gmail.com> on 2013/05/17 14:49:55 UTC

Adding filed in Schema.xml

Hi All
I am trying to add few fields in schema.xml file as below.

   <field name="salary"  type="long" indexed="true" stored="true" />
   <field name="experience"  type="long" indexed="true" stored="true "/>
 *  <field name="last_updated_date"  type="tdate" indexed="true"
stored="true" default="NOW" multiValued="false "/>
*

   <dynamicField name="rs_*"  type="long"  indexed="true"  stored="true"
multiValued="false"/>
   <dynamicField name="rd_*"  type="tdate"  indexed="true"  stored="true"
multiValued="false"/>

Only the "last_updated_date"  (the one in bold letters) getting added. Is
there any syntax issue with other 4 entries. Kindly let me know.

Thanks
kamal

Re: Adding filed in Schema.xml

Posted by Raymond Wiker <rw...@gmail.com>.
On May 20, 2013, at 05:05 , Kamal Palei <pa...@gmail.com> wrote:
> I have put the code to add these fields in document object and index it.
> I have not deleted whole indexed data and reindex it. But I expect whatever
> new documents are added, for those documents these two fields salary and
> experience should be reindexed. Eventually I have to delete the index and
> re-index it, but will do after  all these things work.
> 
> Now question is, what I need to do so that these fields are shown as index
> fields.

Ar you using the "fl" query parameter? If so, you may need to add the new fields to the list of fields that you want solr to return...

Re: Adding filed in Schema.xml

Posted by Gora Mohanty <go...@mimirtech.com>.
On 20 May 2013 08:35, Kamal Palei <pa...@gmail.com> wrote:
> Hi Gora
> Thanks for your response.
>
>
> *>>What do you mean by "not taking effect"? You do not seem to have
>>>made this clear anywhere in the thread.
> *
> Basically I user SOLR in drupal environment. In drupal, in configuration
> page, there is a link that shows all available index fields.

You would probably be better off asking on the Drupal forums,
or on some issue tracker specific to the Drupal/Solr integration
that you are using.

> I had added two long types and one date type.
>
> The date type index field I can see. However I am not able to see two long
> fields salary and experience.

Please be clearer in your statements: What does "The date type index field
I can see" mean? See where?

> *
>>>Besides adding the fields to Solr's schema.xml, you have to make
>>>sure that field values are picked up, and indexed properly into Solr.
>>>How are you indexing? Have you reindexed after adding the fields?
>>>Are you getting any errors in the logs after the indexing.
> *
> I have put the code to add these fields in document object and index it.
> I have not deleted whole indexed data and reindex it. But I expect whatever
> new documents are added, for those documents these two fields salary and
> experience should be reindexed. Eventually I have to delete the index and
> re-index it, but will do after  all these things work.
[...]

Yes, that is correct: New documents should have values for the new
fields. Did you restart Solr after changing the schema? Are there any
errors in the Solr logs?

Regards,
Gora

Re: Adding filed in Schema.xml

Posted by Kamal Palei <pa...@gmail.com>.
Hi Gora
Thanks for your response.


*>>What do you mean by "not taking effect"? You do not seem to have
>>made this clear anywhere in the thread.
*
Basically I user SOLR in drupal environment. In drupal, in configuration
page, there is a link that shows all available index fields.

I had added two long types and one date type.

The date type index field I can see. However I am not able to see two long
fields salary and experience.

*
>>Besides adding the fields to Solr's schema.xml, you have to make
>>sure that field values are picked up, and indexed properly into Solr.
>>How are you indexing? Have you reindexed after adding the fields?
>>Are you getting any errors in the logs after the indexing.
*
I have put the code to add these fields in document object and index it.
I have not deleted whole indexed data and reindex it. But I expect whatever
new documents are added, for those documents these two fields salary and
experience should be reindexed. Eventually I have to delete the index and
re-index it, but will do after  all these things work.

Now question is, what I need to do so that these fields are shown as index
fields.

Best Regards
Kamal
Mob: 9164 20 22 21
















On Sun, May 19, 2013 at 9:12 AM, Gora Mohanty <go...@mimirtech.com> wrote:

> On 19 May 2013 08:36, Kamal Palei <pa...@gmail.com> wrote:
> > Hi Alex
> > I just saw in* types *area, long is already defined as
> >
> > * <fieldType name="long" class="solr.TrieLongField" precisionStep="0"
> > omitNorms="true" positionIncrementGap="0"/>
> > *
> > Hence I hope, I should be able to declare a long type index in* fields
> *area
> > as shown below.
> >
> >   <field name="salary"  type="long" indexed="true" stored="true" />
> >   <field name="experience"  type="long" indexed="true" stored="true "/>
>
> Yes, this should be fine.
>
> > Not sure, why it is not taking effect.
>
> What do you mean by "not taking effect"? You do not seem to have
> made this clear anywhere in the thread.
>
> Besides adding the fields to Solr's schema.xml, you have to make
> sure that field values are picked up, and indexed properly into Solr.
> How are you indexing? Have you reindexed after adding the fields?
> Are you getting any errors in the logs after the indexing.
>
> Regards,
> Gora
>

Re: Adding filed in Schema.xml

Posted by Gora Mohanty <go...@mimirtech.com>.
On 19 May 2013 08:36, Kamal Palei <pa...@gmail.com> wrote:
> Hi Alex
> I just saw in* types *area, long is already defined as
>
> * <fieldType name="long" class="solr.TrieLongField" precisionStep="0"
> omitNorms="true" positionIncrementGap="0"/>
> *
> Hence I hope, I should be able to declare a long type index in* fields *area
> as shown below.
>
>   <field name="salary"  type="long" indexed="true" stored="true" />
>   <field name="experience"  type="long" indexed="true" stored="true "/>

Yes, this should be fine.

> Not sure, why it is not taking effect.

What do you mean by "not taking effect"? You do not seem to have
made this clear anywhere in the thread.

Besides adding the fields to Solr's schema.xml, you have to make
sure that field values are picked up, and indexed properly into Solr.
How are you indexing? Have you reindexed after adding the fields?
Are you getting any errors in the logs after the indexing.

Regards,
Gora

Re: Adding filed in Schema.xml

Posted by Kamal Palei <pa...@gmail.com>.
Hi Alex
I just saw in* types *area, long is already defined as

* <fieldType name="long" class="solr.TrieLongField" precisionStep="0"
omitNorms="true" positionIncrementGap="0"/>
*
Hence I hope, I should be able to declare a long type index in* fields *area
as shown below.

  <field name="salary"  type="long" indexed="true" stored="true" />
  <field name="experience"  type="long" indexed="true" stored="true "/>

Not sure, why it is not taking effect.

Best Regards
Kamal




On Sat, May 18, 2013 at 6:23 PM, Kamal Palei <pa...@gmail.com> wrote:

> Hi Alex,
> Where I need to mention the types. Kindly tell me in detail.
>
> I use Drupal framework. It has given a schema file. In that there are
> already some long type fields, and these are actually shown by solr as part
> of index.
>
> Whatever long field I am adding it does not show part of index.
>
> Best Regards
> kamal
>
>
> On Fri, May 17, 2013 at 7:47 PM, Alexandre Rafalovitch <arafalov@gmail.com
> > wrote:
>
>> Do you have the types corresponding to those fields present?
>> Specifically, "long". You don't get any special type names out of the
>> box, they all need to be present in types area.
>>
>> Regards,
>>    Alex.
>> Personal blog: http://blog.outerthoughts.com/
>> LinkedIn: http://www.linkedin.com/in/alexandrerafalovitch
>> - Time is the quality of nature that keeps events from happening all
>> at once. Lately, it doesn't seem to be working.  (Anonymous  - via GTD
>> book)
>>
>>
>> On Fri, May 17, 2013 at 8:49 AM, Kamal Palei <pa...@gmail.com>
>> wrote:
>> > Hi All
>> > I am trying to add few fields in schema.xml file as below.
>> >
>> >    <field name="salary"  type="long" indexed="true" stored="true" />
>> >    <field name="experience"  type="long" indexed="true" stored="true "/>
>> >  *  <field name="last_updated_date"  type="tdate" indexed="true"
>> > stored="true" default="NOW" multiValued="false "/>
>> > *
>> >
>> >    <dynamicField name="rs_*"  type="long"  indexed="true"  stored="true"
>> > multiValued="false"/>
>> >    <dynamicField name="rd_*"  type="tdate"  indexed="true"
>>  stored="true"
>> > multiValued="false"/>
>> >
>> > Only the "last_updated_date"  (the one in bold letters) getting added.
>> Is
>> > there any syntax issue with other 4 entries. Kindly let me know.
>> >
>> > Thanks
>> > kamal
>>
>
>

Re: Adding filed in Schema.xml

Posted by Kamal Palei <pa...@gmail.com>.
Hi Alex,
Where I need to mention the types. Kindly tell me in detail.

I use Drupal framework. It has given a schema file. In that there are
already some long type fields, and these are actually shown by solr as part
of index.

Whatever long field I am adding it does not show part of index.

Best Regards
kamal


On Fri, May 17, 2013 at 7:47 PM, Alexandre Rafalovitch
<ar...@gmail.com>wrote:

> Do you have the types corresponding to those fields present?
> Specifically, "long". You don't get any special type names out of the
> box, they all need to be present in types area.
>
> Regards,
>    Alex.
> Personal blog: http://blog.outerthoughts.com/
> LinkedIn: http://www.linkedin.com/in/alexandrerafalovitch
> - Time is the quality of nature that keeps events from happening all
> at once. Lately, it doesn't seem to be working.  (Anonymous  - via GTD
> book)
>
>
> On Fri, May 17, 2013 at 8:49 AM, Kamal Palei <pa...@gmail.com>
> wrote:
> > Hi All
> > I am trying to add few fields in schema.xml file as below.
> >
> >    <field name="salary"  type="long" indexed="true" stored="true" />
> >    <field name="experience"  type="long" indexed="true" stored="true "/>
> >  *  <field name="last_updated_date"  type="tdate" indexed="true"
> > stored="true" default="NOW" multiValued="false "/>
> > *
> >
> >    <dynamicField name="rs_*"  type="long"  indexed="true"  stored="true"
> > multiValued="false"/>
> >    <dynamicField name="rd_*"  type="tdate"  indexed="true"  stored="true"
> > multiValued="false"/>
> >
> > Only the "last_updated_date"  (the one in bold letters) getting added. Is
> > there any syntax issue with other 4 entries. Kindly let me know.
> >
> > Thanks
> > kamal
>

Re: Adding filed in Schema.xml

Posted by Alexandre Rafalovitch <ar...@gmail.com>.
Do you have the types corresponding to those fields present?
Specifically, "long". You don't get any special type names out of the
box, they all need to be present in types area.

Regards,
   Alex.
Personal blog: http://blog.outerthoughts.com/
LinkedIn: http://www.linkedin.com/in/alexandrerafalovitch
- Time is the quality of nature that keeps events from happening all
at once. Lately, it doesn't seem to be working.  (Anonymous  - via GTD
book)


On Fri, May 17, 2013 at 8:49 AM, Kamal Palei <pa...@gmail.com> wrote:
> Hi All
> I am trying to add few fields in schema.xml file as below.
>
>    <field name="salary"  type="long" indexed="true" stored="true" />
>    <field name="experience"  type="long" indexed="true" stored="true "/>
>  *  <field name="last_updated_date"  type="tdate" indexed="true"
> stored="true" default="NOW" multiValued="false "/>
> *
>
>    <dynamicField name="rs_*"  type="long"  indexed="true"  stored="true"
> multiValued="false"/>
>    <dynamicField name="rd_*"  type="tdate"  indexed="true"  stored="true"
> multiValued="false"/>
>
> Only the "last_updated_date"  (the one in bold letters) getting added. Is
> there any syntax issue with other 4 entries. Kindly let me know.
>
> Thanks
> kamal