|
|
-
Is it compulsory to define a tokenizer when defining field types in solr
Kissue Kissue 2012-06-28, 15:10
Hi,
When defining a fieldtype is it compulsory to include a tokenizer in its definition?
I have a field defined as follows without tokenizer:
<fieldType name="lowercase_pattern" class="solr.TextField" positionIncrementGap="100"> <analyzer type="index"> <filter class="solr.LowerCaseFilterFactory" /> </analyzer> <analyzer type="query"> <filter class="solr.LowerCaseFilterFactory" /> </analyzer> </fieldType>
Using this field when i try to start up Solr it says the field is not recognised. But when i change it to the following with tokenizer included it works:
<fieldType name="lowercase_pattern" class="solr.TextField" positionIncrementGap="100"> <analyzer type="index"> <tokenizer class="solr.KeywordTokenizerFactory"/> <filter class="solr.LowerCaseFilterFactory" /> </analyzer> <analyzer type="query"> <tokenizer class="solr.KeywordTokenizerFactory"/> <filter class="solr.LowerCaseFilterFactory" /> </analyzer> </fieldType>
Thanks.
-
Re: Is it compulsory to define a tokenizer when defining field types in solr
Erick Erickson 2012-06-29, 13:08
Yes, it's mandatory to define at least one tokenizer (and only one tokenizer). If you need the whole input treated as one token, you can use KeywordTokenizerFactory.
Best Erick
On Thu, Jun 28, 2012 at 11:10 AM, Kissue Kissue <[EMAIL PROTECTED]> wrote: > Hi, > > When defining a fieldtype is it compulsory to include a tokenizer in its > definition? > > I have a field defined as follows without tokenizer: > > <fieldType name="lowercase_pattern" class="solr.TextField" > positionIncrementGap="100"> > <analyzer type="index"> > <filter class="solr.LowerCaseFilterFactory" /> > </analyzer> > <analyzer type="query"> > <filter class="solr.LowerCaseFilterFactory" /> > </analyzer> > </fieldType> > > Using this field when i try to start up Solr it says the field is not > recognised. But when i change it to the following with tokenizer included > it works: > > <fieldType name="lowercase_pattern" class="solr.TextField" > positionIncrementGap="100"> > <analyzer type="index"> > <tokenizer class="solr.KeywordTokenizerFactory"/> > <filter class="solr.LowerCaseFilterFactory" /> > </analyzer> > <analyzer type="query"> > <tokenizer class="solr.KeywordTokenizerFactory"/> > <filter class="solr.LowerCaseFilterFactory" /> > </analyzer> > </fieldType> > > Thanks.
-
Re: Is it compulsory to define a tokenizer when defining field types in solr
Kissue Kissue 2012-06-29, 17:23
Thanks Erick for the clarification.
Cheers!
On Fri, Jun 29, 2012 at 2:08 PM, Erick Erickson <[EMAIL PROTECTED]>wrote:
> Yes, it's mandatory to define at least one tokenizer (and only one > tokenizer). If > you need the whole input treated as one token, you can use > KeywordTokenizerFactory. > > Best > Erick > > On Thu, Jun 28, 2012 at 11:10 AM, Kissue Kissue <[EMAIL PROTECTED]> > wrote: > > Hi, > > > > When defining a fieldtype is it compulsory to include a tokenizer in its > > definition? > > > > I have a field defined as follows without tokenizer: > > > > <fieldType name="lowercase_pattern" class="solr.TextField" > > positionIncrementGap="100"> > > <analyzer type="index"> > > <filter class="solr.LowerCaseFilterFactory" /> > > </analyzer> > > <analyzer type="query"> > > <filter class="solr.LowerCaseFilterFactory" /> > > </analyzer> > > </fieldType> > > > > Using this field when i try to start up Solr it says the field is not > > recognised. But when i change it to the following with tokenizer included > > it works: > > > > <fieldType name="lowercase_pattern" class="solr.TextField" > > positionIncrementGap="100"> > > <analyzer type="index"> > > <tokenizer class="solr.KeywordTokenizerFactory"/> > > <filter class="solr.LowerCaseFilterFactory" /> > > </analyzer> > > <analyzer type="query"> > > <tokenizer class="solr.KeywordTokenizerFactory"/> > > <filter class="solr.LowerCaseFilterFactory" /> > > </analyzer> > > </fieldType> > > > > Thanks. >
|
|
All projects made searchable here are trademarks of the Apache Software Foundation.
Service operated by
Sematext