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 Igor Littig <ig...@gmail.com> on 2013/05/30 16:39:03 UTC

Fwd: indexing only selected fields

---------- Forwarded message ----------
From: Igor Littig <ig...@gmail.com>
Date: 2013/5/30
Subject: indexing only selected fields
To: solr-user-faq@lucene.apache.org


Hello everyone.

I'm quite new in Solr and need your advice... Does anybody know how to
index not all fields in an uploading document but only those which I
mentioned in the schema, others fields and symbols just ignore. Is it
possible ???

Re: Fwd: indexing only selected fields

Posted by Jack Krupansky <ja...@basetechnology.com>.
Update Request Processors to the rescue!

Example - Ignore input values for any undefined fields

Add to solrconfig:

  <updateRequestProcessorChain name="ignore-undefined">
    <processor class="solr.IgnoreFieldUpdateProcessorFactory" />
    <processor class="solr.LogUpdateProcessorFactory" />
    <processor class="solr.RunUpdateProcessorFactory" />
  </updateRequestProcessorChain>

Index content:

  curl 
"http://localhost:8983/solr/update?commit=true&update.chain=ignore-undefined" 
\
  -H 'Content-type:application/json' -d '
  [{"id": "doc-1",
    "title": "Hello World",
    "features": ["Fast", "Cheap"],
    "bad_field_name": "Junk",
    "abstract": "Not in schema either"}]'

Results:

  "id":"doc-1",
  "title":["Hello World"],
  "features":["Fast",
    "Cheap"],

(From the book!)

-- Jack Krupansky

-----Original Message----- 
From: Igor Littig
Sent: Thursday, May 30, 2013 10:39 AM
To: solr-user@lucene.apache.org
Subject: Fwd: indexing only selected fields

---------- Forwarded message ----------
From: Igor Littig <ig...@gmail.com>
Date: 2013/5/30
Subject: indexing only selected fields
To: solr-user-faq@lucene.apache.org


Hello everyone.

I'm quite new in Solr and need your advice... Does anybody know how to
index not all fields in an uploading document but only those which I
mentioned in the schema, others fields and symbols just ignore. Is it
possible ??? 


Re: Fwd: indexing only selected fields

Posted by Shawn Heisey <so...@elyograg.org>.
> ---------- Forwarded message ----------
> From: Igor Littig <ig...@gmail.com>
> Date: 2013/5/30
> Subject: indexing only selected fields
> To: solr-user-faq@lucene.apache.org
>
>
> Hello everyone.
>
> I'm quite new in Solr and need your advice... Does anybody know how to
> index not all fields in an uploading document but only those which I
> mentioned in the schema, others fields and symbols just ignore. Is it
> possible ???

This should be exactly how Solr works. The only way that you would get
fields not explicitly mentioned in your schema is if they match a dynamic
field wildcard ... but that would also be in your schema, so it doesn't
change what I'm saying.

Thanks,
Shawn




Re: indexing only selected fields

Posted by Igor Littig <ig...@gmail.com>.
Ok, that is clear. Thanks fo the answer


2013/5/30 Alexandre Rafalovitch <ar...@gmail.com>

> If you want to just removing anything that does not match then
> 'ignored' field type in example schema would work. If you want to
> ignore specific fields but complain on any unexpected things you can
> still use specific fields but with ignored type.
>
> Or you could use Update Request Processors like this one:
>
> http://lucene.apache.org/solr/4_3_0/solr-core/org/apache/solr/update/processor/IgnoreFieldUpdateProcessorFactory.html
>
> 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 Thu, May 30, 2013 at 10:55 AM, Igor Littig <ig...@gmail.com>
> wrote:
> > Alex
> >
> > Thank you for the answer. I am submitting by POST method via curl... For
> > example when I want to submit a document I'm typing in the command line:
> >
> > curl 'http://localhost:8983/solr/update/json?commit=true' --data-binary
> @
> > base.info -H 'Content-type:application/json'
> >
> > where "base.info" my file with information which I want to index. Could
> you
> > in which ways(methods) I can automatically omit unknown fields. It would
> be
> > easier to select only needed fields.
> >
> > Cheers
> > Igor
> >
> >
> > 2013/5/30 Alexandre Rafalovitch <ar...@gmail.com>
> >
> >> How are you submitting your document? Some methods automatically
> >> ignore unknown fields, other complaint.
> >>
> >> In any case, there is always a way to define an ignored field type.
> >> The schema.xml in the main example shows how to do it. Search for
> >> 'ignored'. But beware that this will hide all spelling and other
> >> errors later..
> >>
> >> 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 Thu, May 30, 2013 at 10:39 AM, Igor Littig <ig...@gmail.com>
> >> wrote:
> >> > ---------- Forwarded message ----------
> >> > From: Igor Littig <ig...@gmail.com>
> >> > Date: 2013/5/30
> >> > Subject: indexing only selected fields
> >> > To: solr-user-faq@lucene.apache.org
> >> >
> >> >
> >> > Hello everyone.
> >> >
> >> > I'm quite new in Solr and need your advice... Does anybody know how to
> >> > index not all fields in an uploading document but only those which I
> >> > mentioned in the schema, others fields and symbols just ignore. Is it
> >> > possible ???
> >>
>

Re: indexing only selected fields

Posted by Alexandre Rafalovitch <ar...@gmail.com>.
If you want to just removing anything that does not match then
'ignored' field type in example schema would work. If you want to
ignore specific fields but complain on any unexpected things you can
still use specific fields but with ignored type.

Or you could use Update Request Processors like this one:
http://lucene.apache.org/solr/4_3_0/solr-core/org/apache/solr/update/processor/IgnoreFieldUpdateProcessorFactory.html

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 Thu, May 30, 2013 at 10:55 AM, Igor Littig <ig...@gmail.com> wrote:
> Alex
>
> Thank you for the answer. I am submitting by POST method via curl... For
> example when I want to submit a document I'm typing in the command line:
>
> curl 'http://localhost:8983/solr/update/json?commit=true' --data-binary @
> base.info -H 'Content-type:application/json'
>
> where "base.info" my file with information which I want to index. Could you
> in which ways(methods) I can automatically omit unknown fields. It would be
> easier to select only needed fields.
>
> Cheers
> Igor
>
>
> 2013/5/30 Alexandre Rafalovitch <ar...@gmail.com>
>
>> How are you submitting your document? Some methods automatically
>> ignore unknown fields, other complaint.
>>
>> In any case, there is always a way to define an ignored field type.
>> The schema.xml in the main example shows how to do it. Search for
>> 'ignored'. But beware that this will hide all spelling and other
>> errors later..
>>
>> 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 Thu, May 30, 2013 at 10:39 AM, Igor Littig <ig...@gmail.com>
>> wrote:
>> > ---------- Forwarded message ----------
>> > From: Igor Littig <ig...@gmail.com>
>> > Date: 2013/5/30
>> > Subject: indexing only selected fields
>> > To: solr-user-faq@lucene.apache.org
>> >
>> >
>> > Hello everyone.
>> >
>> > I'm quite new in Solr and need your advice... Does anybody know how to
>> > index not all fields in an uploading document but only those which I
>> > mentioned in the schema, others fields and symbols just ignore. Is it
>> > possible ???
>>

Re: indexing only selected fields

Posted by Igor Littig <ig...@gmail.com>.
Alex

Thank you for the answer. I am submitting by POST method via curl... For
example when I want to submit a document I'm typing in the command line:

curl 'http://localhost:8983/solr/update/json?commit=true' --data-binary @
base.info -H 'Content-type:application/json'

where "base.info" my file with information which I want to index. Could you
in which ways(methods) I can automatically omit unknown fields. It would be
easier to select only needed fields.

Cheers
Igor


2013/5/30 Alexandre Rafalovitch <ar...@gmail.com>

> How are you submitting your document? Some methods automatically
> ignore unknown fields, other complaint.
>
> In any case, there is always a way to define an ignored field type.
> The schema.xml in the main example shows how to do it. Search for
> 'ignored'. But beware that this will hide all spelling and other
> errors later..
>
> 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 Thu, May 30, 2013 at 10:39 AM, Igor Littig <ig...@gmail.com>
> wrote:
> > ---------- Forwarded message ----------
> > From: Igor Littig <ig...@gmail.com>
> > Date: 2013/5/30
> > Subject: indexing only selected fields
> > To: solr-user-faq@lucene.apache.org
> >
> >
> > Hello everyone.
> >
> > I'm quite new in Solr and need your advice... Does anybody know how to
> > index not all fields in an uploading document but only those which I
> > mentioned in the schema, others fields and symbols just ignore. Is it
> > possible ???
>

Re: indexing only selected fields

Posted by Alexandre Rafalovitch <ar...@gmail.com>.
How are you submitting your document? Some methods automatically
ignore unknown fields, other complaint.

In any case, there is always a way to define an ignored field type.
The schema.xml in the main example shows how to do it. Search for
'ignored'. But beware that this will hide all spelling and other
errors later..

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 Thu, May 30, 2013 at 10:39 AM, Igor Littig <ig...@gmail.com> wrote:
> ---------- Forwarded message ----------
> From: Igor Littig <ig...@gmail.com>
> Date: 2013/5/30
> Subject: indexing only selected fields
> To: solr-user-faq@lucene.apache.org
>
>
> Hello everyone.
>
> I'm quite new in Solr and need your advice... Does anybody know how to
> index not all fields in an uploading document but only those which I
> mentioned in the schema, others fields and symbols just ignore. Is it
> possible ???