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 Paul Libbrecht <pa...@hoplahup.net> on 2011/03/14 23:21:15 UTC
accessing the analyzers in a component?
Hello fellow SOLRers,
Within my custom query-component, I wish to obtain an instance of the analyzer for a given named field.
Is a schema object I can access?
thanks in advance
paul
Re: accessing the analyzers in a component?
Posted by Paul Libbrecht <pa...@hoplahup.net>.
Thanks Ahmet, I indicated that in the wiki at
http://wiki.apache.org/solr/AnalyzersTokenizersTokenFilters
My solution was a little bit different since I wanted to get the analyzer per field name:
rb.getSchema().getField("name").getFieldType().getAnalyzer()
thanks again!
paul
Le 15 mars 2011 à 02:44, Ahmet Arslan a écrit :
>> Within my custom query-component, I wish to obtain an
>> instance of the analyzer for a given named field.
>> Is a schema object I can access?
>
>
> public void process(ResponseBuilder rb) throws IOException {
>
> Map<String,FieldType> map = rb.req.getSchema().getFieldTypes();
>
> Analyzer analyzer = map.get("myFieldName").getAnalyzer();
> Analyzer queryAnalyzer = map.get("myFieldName").getQueryAnalyzer();
>
>
>
Re: accessing the analyzers in a component?
Posted by Ahmet Arslan <io...@yahoo.com>.
> Within my custom query-component, I wish to obtain an
> instance of the analyzer for a given named field.
> Is a schema object I can access?
public void process(ResponseBuilder rb) throws IOException {
Map<String,FieldType> map = rb.req.getSchema().getFieldTypes();
Analyzer analyzer = map.get("myFieldName").getAnalyzer();
Analyzer queryAnalyzer = map.get("myFieldName").getQueryAnalyzer();