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 Bruno René Santos <br...@gmail.com> on 2013/08/12 15:40:20 UTC
Extending fieldtypes
Hi,
Is it possible to extend a fieldtype from another fieldtype on the
schema.xml?
Regards
Bruno
--
Bruno René Santos
Lisboa - Portugal
Re: Extending fieldtypes
Posted by Erick Erickson <er...@gmail.com>.
This has been mentioned before, but it's never been
implemented. It's a pain to copy/paste the full field
definition, but the utility of "subclassing" fieldTypes
is really pretty restricted. How, for instance, would
you, say, tweak the parameters to WordDelimiterFilterFactory
in your sub-field? And a rule like "you only add stuff to
the end of the chain" is pretty limited.
So copy/paste/edit I'm afraid.
Best
Erick
On Mon, Aug 12, 2013 at 10:19 AM, Bruno René Santos <br...@gmail.com>wrote:
> Hi,
>
> Example:
>
>
> I want that stringTweakedNoIDF would be a stringTweaked but with the extra
> similarity.
>
> <fieldType name="stringTweaked" class="solr.TextField"
> sortMissingLast="true" positionIncrementGap="100">
> <analyzer type="index">
> <tokenizer class="solr.KeywordTokenizerFactory"/>
> <filter class="solr.LowerCaseFilterFactory"/>
> <filter class="solr.ASCIIFoldingFilterFactory"/>
> <filter class="solr.PatternReplaceFilterFactory" pattern="([^a-z0-9]+)"
> replacement=" "/>
> <filter class="solr.TrimFilterFactory"/>
> <filter class="pt.sapo.pai.LowercasePortugueseLightStemFilterFactory"/>
> </analyzer>
> <analyzer type="query">
> <tokenizer class="solr.KeywordTokenizerFactory"/>
> <filter class="solr.LowerCaseFilterFactory"/>
> <filter class="solr.ASCIIFoldingFilterFactory"/>
> <filter class="solr.PatternReplaceFilterFactory" pattern="([^a-z0-9]+)"
> replacement=" "/>
> <filter class="solr.TrimFilterFactory"/>
> <filter class="pt.sapo.pai.LowercasePortugueseLightStemFilterFactory"/>
> <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt"
> ignoreCase="true" expand="true"/>
> </analyzer>
> </fieldType>
> <fieldType name="stringTweakedNoIDF" class="solr.TextField"
> sortMissingLast="true" positionIncrementGap="100">
> <similarity class="pt.sapo.pai.NoIDFSimilarityFactory"/>
> <analyzer type="index">
> <tokenizer class="solr.KeywordTokenizerFactory"/>
> <filter class="solr.LowerCaseFilterFactory"/>
> <filter class="solr.ASCIIFoldingFilterFactory"/>
> <filter class="solr.PatternReplaceFilterFactory" pattern="([^a-z0-9]+)"
> replacement=" "/>
> <filter class="solr.TrimFilterFactory"/>
> <filter class="pt.sapo.pai.LowercasePortugueseLightStemFilterFactory"/>
> </analyzer>
> <analyzer type="query">
> <tokenizer class="solr.KeywordTokenizerFactory"/>
> <filter class="solr.LowerCaseFilterFactory"/>
> <filter class="solr.ASCIIFoldingFilterFactory"/>
> <filter class="solr.PatternReplaceFilterFactory" pattern="([^a-z0-9]+)"
> replacement=" "/>
> <filter class="solr.TrimFilterFactory"/>
> <filter class="pt.sapo.pai.LowercasePortugueseLightStemFilterFactory"/>
> <filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt"
> ignoreCase="true" expand="true"/>
> </analyzer>
> </fieldType>
>
> Regards
> Bruno
>
>
> On Mon, Aug 12, 2013 at 3:07 PM, tamanjit.bindra@yahoo.co.in <
> tamanjit.bindra@yahoo.co.in> wrote:
>
> > You would need to provide a Solr file that would be the basic field type
> > and
> > do rest of analysis on it. Is this what you want?
> >
> > eg. fieldType name="textSpellPhrase" class="solr.TextField"
> > positionIncrementGap="100" stored="false"
> > multiValued="true"><analyzer><tokenizer
> > class="solr.KeywordTokenizerFactory"/><filter
> > class="solr.LowerCaseFilterFactory"/></analyzer></fieldType>
> >
> >
> >
> > --
> > View this message in context:
> >
> http://lucene.472066.n3.nabble.com/Extending-fieldtypes-tp4083986p4083992.html
> > Sent from the Solr - User mailing list archive at Nabble.com.
> >
>
>
>
> --
> Bruno René Santos
> Lisboa - Portugal
>
Re: Extending fieldtypes
Posted by Bruno René Santos <br...@gmail.com>.
Hi,
Example:
I want that stringTweakedNoIDF would be a stringTweaked but with the extra
similarity.
<fieldType name="stringTweaked" class="solr.TextField"
sortMissingLast="true" positionIncrementGap="100">
<analyzer type="index">
<tokenizer class="solr.KeywordTokenizerFactory"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.ASCIIFoldingFilterFactory"/>
<filter class="solr.PatternReplaceFilterFactory" pattern="([^a-z0-9]+)"
replacement=" "/>
<filter class="solr.TrimFilterFactory"/>
<filter class="pt.sapo.pai.LowercasePortugueseLightStemFilterFactory"/>
</analyzer>
<analyzer type="query">
<tokenizer class="solr.KeywordTokenizerFactory"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.ASCIIFoldingFilterFactory"/>
<filter class="solr.PatternReplaceFilterFactory" pattern="([^a-z0-9]+)"
replacement=" "/>
<filter class="solr.TrimFilterFactory"/>
<filter class="pt.sapo.pai.LowercasePortugueseLightStemFilterFactory"/>
<filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt"
ignoreCase="true" expand="true"/>
</analyzer>
</fieldType>
<fieldType name="stringTweakedNoIDF" class="solr.TextField"
sortMissingLast="true" positionIncrementGap="100">
<similarity class="pt.sapo.pai.NoIDFSimilarityFactory"/>
<analyzer type="index">
<tokenizer class="solr.KeywordTokenizerFactory"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.ASCIIFoldingFilterFactory"/>
<filter class="solr.PatternReplaceFilterFactory" pattern="([^a-z0-9]+)"
replacement=" "/>
<filter class="solr.TrimFilterFactory"/>
<filter class="pt.sapo.pai.LowercasePortugueseLightStemFilterFactory"/>
</analyzer>
<analyzer type="query">
<tokenizer class="solr.KeywordTokenizerFactory"/>
<filter class="solr.LowerCaseFilterFactory"/>
<filter class="solr.ASCIIFoldingFilterFactory"/>
<filter class="solr.PatternReplaceFilterFactory" pattern="([^a-z0-9]+)"
replacement=" "/>
<filter class="solr.TrimFilterFactory"/>
<filter class="pt.sapo.pai.LowercasePortugueseLightStemFilterFactory"/>
<filter class="solr.SynonymFilterFactory" synonyms="synonyms.txt"
ignoreCase="true" expand="true"/>
</analyzer>
</fieldType>
Regards
Bruno
On Mon, Aug 12, 2013 at 3:07 PM, tamanjit.bindra@yahoo.co.in <
tamanjit.bindra@yahoo.co.in> wrote:
> You would need to provide a Solr file that would be the basic field type
> and
> do rest of analysis on it. Is this what you want?
>
> eg. fieldType name="textSpellPhrase" class="solr.TextField"
> positionIncrementGap="100" stored="false"
> multiValued="true"><analyzer><tokenizer
> class="solr.KeywordTokenizerFactory"/><filter
> class="solr.LowerCaseFilterFactory"/></analyzer></fieldType>
>
>
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/Extending-fieldtypes-tp4083986p4083992.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>
--
Bruno René Santos
Lisboa - Portugal
Re: Extending fieldtypes
Posted by "tamanjit.bindra@yahoo.co.in" <ta...@yahoo.co.in>.
You would need to provide a Solr file that would be the basic field type and
do rest of analysis on it. Is this what you want?
eg. fieldType name="textSpellPhrase" class="solr.TextField"
positionIncrementGap="100" stored="false"
multiValued="true"><analyzer><tokenizer
class="solr.KeywordTokenizerFactory"/><filter
class="solr.LowerCaseFilterFactory"/></analyzer></fieldType>
--
View this message in context: http://lucene.472066.n3.nabble.com/Extending-fieldtypes-tp4083986p4083992.html
Sent from the Solr - User mailing list archive at Nabble.com.
Re: Extending fieldtypes
Posted by Alexandre Rafalovitch <ar...@gmail.com>.
What are trying to achieve specifically? Reuse chain definitions?
Regards,
Alex
On 12 Aug 2013 09:41, "Bruno René Santos" <br...@gmail.com> wrote:
> Hi,
>
> Is it possible to extend a fieldtype from another fieldtype on the
> schema.xml?
>
> Regards
> Bruno
>
> --
> Bruno René Santos
> Lisboa - Portugal
>