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 Steven White <sw...@gmail.com> on 2015/04/22 18:55:46 UTC

Complete list of field "type" that Solr supports

Hi Everyone,

I Googled for this with no luck.

Where can I find a complete list of field "type" that Solr supports?  In
the sample scheam.xml that comes with Solr 5 and prior version, I am able
to compile a list such as "boolean", "float", "string", etc. but I cannot
find a complete list documented somewhere.

To be clear, here is an example of a type from Solr's schema.xml:

    <field name="weight" type="float" indexed="true" stored="true"/>

Here, the "type" is "float".  I'm looking for the complete list of
out-of-the-box types supported.

Thanks

Steve

Re: Complete list of field "type" that Solr supports

Posted by Steven White <sw...@gmail.com>.
I got it now.

I have to start from <fieldType/> to create my <field/> list.  If I want a
list of supported field-types (used in my schema.xml), I have to look at
the "class" attribute of <fieldType/> to get that list.  The out-of-the-box
list of field-types is documented in the link you provided:
https://cwiki.apache.org/confluence/display/solr/Field+Types+Included+with+Solr

Thanks

Steve

On Wed, Apr 22, 2015 at 1:46 PM, Chris Hostetter <ho...@fucit.org>
wrote:

>
> : I'm confused.  If type="float" is just a symbolic name, how does Solr
> knows
> : to index the data of field "weight" as "float"?  What about for "date"
> per
> : this example:
> :
> :     <field name="last_modified" type="date" indexed="true"
> stored="true"/>
> :
> : How does Solr applies date-range queries such as:
>
> because somewhere else in your schema is a <type/> declaration that
> defines "<type name="date" ..." using "class="solr.TrieDateField"
>
> you asked for the complete list of all possible values for the "type"
> attribute on a <field/> -- the answer is "infinite" because the possible
> values for the "type" attribute on a <field/> is dictated by whatever you
> might choose to specify as the "name" attribute on a <type/>
>
> : I was always under the impression that there are primitive field-types
> but
> : looks like that's not the case?
>
> There are FieldType *classes* which can be configured a variety of ways in
> your schema.xml, and then reused by different fields -- but the *names* of
> those "types" is up to you.
>
> for example: the exact same TriDateField *class* can be configured in your
> schema.xml to implement 2 differnet *types* named "date_foo" and
> "date_bar" by using different default options (maybe one uses a
> non-default precisionStep and defaults to stored="true" while the other
> uses the default precisionStep and defaults to stored="faluse") ... those
> two diff types can then both be used in your schema...
>
>   <field name="last_modified" type="date_foo" indexed="true" />
>   <field name="pub_date" type="date_bar" indexed="true" />
>
> ...and have different behavior.
>
> :
> : Thanks
> :
> : Steve
> :
> : On Wed, Apr 22, 2015 at 12:59 PM, Chris Hostetter <
> hossman_lucene@fucit.org>
> : wrote:
> :
> : >
> : > : To be clear, here is an example of a type from Solr's schema.xml:
> : > :
> : > :     <field name="weight" type="float" indexed="true" stored="true"/>
> : > :
> : > : Here, the "type" is "float".  I'm looking for the complete list of
> : > : out-of-the-box types supported.
> : >
> : > what you are asking about are just symbolic names that come from
> <type/>
> : > definitions in the schema.xml -- there is no complete list.  you can
> add
> : > any arbitrary <type name="foo" .../> you want to your schema, and now
> : > you've introduced a new "type" that solr supports.
> : >
> : > As far as the list of all "FieldType" *classes* that exist in solr out
> of
> : > the box (ie: the list of classes that can be specified in <type/>
> : > declarations, that is a bit more straight forward...
> : >
> : >
> : >
> https://cwiki.apache.org/confluence/display/solr/Field+Types+Included+with+Solr
> : >
> : >
> : >
> : > -Hoss
> : > http://www.lucidworks.com/
> : >
> :
>
> -Hoss
> http://www.lucidworks.com/
>

Re: Complete list of field "type" that Solr supports

Posted by Chris Hostetter <ho...@fucit.org>.
: I'm confused.  If type="float" is just a symbolic name, how does Solr knows
: to index the data of field "weight" as "float"?  What about for "date" per
: this example:
: 
:     <field name="last_modified" type="date" indexed="true" stored="true"/>
: 
: How does Solr applies date-range queries such as:

because somewhere else in your schema is a <type/> declaration that 
defines "<type name="date" ..." using "class="solr.TrieDateField"

you asked for the complete list of all possible values for the "type" 
attribute on a <field/> -- the answer is "infinite" because the possible 
values for the "type" attribute on a <field/> is dictated by whatever you 
might choose to specify as the "name" attribute on a <type/>

: I was always under the impression that there are primitive field-types but
: looks like that's not the case?

There are FieldType *classes* which can be configured a variety of ways in 
your schema.xml, and then reused by different fields -- but the *names* of 
those "types" is up to you.

for example: the exact same TriDateField *class* can be configured in your 
schema.xml to implement 2 differnet *types* named "date_foo" and 
"date_bar" by using different default options (maybe one uses a 
non-default precisionStep and defaults to stored="true" while the other 
uses the default precisionStep and defaults to stored="faluse") ... those 
two diff types can then both be used in your schema...

  <field name="last_modified" type="date_foo" indexed="true" />
  <field name="pub_date" type="date_bar" indexed="true" />

...and have different behavior.

: 
: Thanks
: 
: Steve
: 
: On Wed, Apr 22, 2015 at 12:59 PM, Chris Hostetter <ho...@fucit.org>
: wrote:
: 
: >
: > : To be clear, here is an example of a type from Solr's schema.xml:
: > :
: > :     <field name="weight" type="float" indexed="true" stored="true"/>
: > :
: > : Here, the "type" is "float".  I'm looking for the complete list of
: > : out-of-the-box types supported.
: >
: > what you are asking about are just symbolic names that come from <type/>
: > definitions in the schema.xml -- there is no complete list.  you can add
: > any arbitrary <type name="foo" .../> you want to your schema, and now
: > you've introduced a new "type" that solr supports.
: >
: > As far as the list of all "FieldType" *classes* that exist in solr out of
: > the box (ie: the list of classes that can be specified in <type/>
: > declarations, that is a bit more straight forward...
: >
: >
: > https://cwiki.apache.org/confluence/display/solr/Field+Types+Included+with+Solr
: >
: >
: >
: > -Hoss
: > http://www.lucidworks.com/
: >
: 

-Hoss
http://www.lucidworks.com/

Re: Complete list of field "type" that Solr supports

Posted by Steven White <sw...@gmail.com>.
Hi Hoss,

I'm confused.  If type="float" is just a symbolic name, how does Solr knows
to index the data of field "weight" as "float"?  What about for "date" per
this example:

    <field name="last_modified" type="date" indexed="true" stored="true"/>

How does Solr applies date-range queries such as:

    last_modified:[NOW-1YEAR/DAY TO NOW/DAY+1DAY]

I was always under the impression that there are primitive field-types but
looks like that's not the case?

Thanks

Steve

On Wed, Apr 22, 2015 at 12:59 PM, Chris Hostetter <ho...@fucit.org>
wrote:

>
> : To be clear, here is an example of a type from Solr's schema.xml:
> :
> :     <field name="weight" type="float" indexed="true" stored="true"/>
> :
> : Here, the "type" is "float".  I'm looking for the complete list of
> : out-of-the-box types supported.
>
> what you are asking about are just symbolic names that come from <type/>
> definitions in the schema.xml -- there is no complete list.  you can add
> any arbitrary <type name="foo" .../> you want to your schema, and now
> you've introduced a new "type" that solr supports.
>
> As far as the list of all "FieldType" *classes* that exist in solr out of
> the box (ie: the list of classes that can be specified in <type/>
> declarations, that is a bit more straight forward...
>
>
> https://cwiki.apache.org/confluence/display/solr/Field+Types+Included+with+Solr
>
>
>
> -Hoss
> http://www.lucidworks.com/
>

Re: Complete list of field "type" that Solr supports

Posted by Chris Hostetter <ho...@fucit.org>.
: To be clear, here is an example of a type from Solr's schema.xml:
: 
:     <field name="weight" type="float" indexed="true" stored="true"/>
: 
: Here, the "type" is "float".  I'm looking for the complete list of
: out-of-the-box types supported.

what you are asking about are just symbolic names that come from <type/> 
definitions in the schema.xml -- there is no complete list.  you can add 
any arbitrary <type name="foo" .../> you want to your schema, and now 
you've introduced a new "type" that solr supports.

As far as the list of all "FieldType" *classes* that exist in solr out of 
the box (ie: the list of classes that can be specified in <type/> 
declarations, that is a bit more straight forward...

https://cwiki.apache.org/confluence/display/solr/Field+Types+Included+with+Solr



-Hoss
http://www.lucidworks.com/