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 Ben Incani <be...@datacomit.com.au> on 2007/10/19 09:51:36 UTC

lowercase text/strings to be used in list box

I have a field which will only contain several values (that include
spaces).

I want to display a list box with all possible values by browsing the
lucene terms.

I have setup a field in the schema.xml file.

    <fieldtype name="text_lc" class="solr.TextField">
      <analyzer>
        <tokenizer class="solr.KeywordTokenizerFactory"/>
        <filter class="solr.LowerCaseFilterFactory"/>
      </analyzer>
    </fieldtype>

I also tried;

    <fieldtype name="string_lc" class="solr.StrField">
      <analyzer>
        <tokenizer class="solr.LowerCaseTokenizerFactory"/>
        <filter class="solr.LowerCaseFilterFactory"/>
      </analyzer>
    </fieldtype>


This allows me to browse all the values no problem, but when it comes to
search the documents I have to use the lucene
org.apache.lucene.analysis.KeywordAnalyzer, when I would rather use the
org.apache.lucene.analysis.standard.StandardAnalyzer and the power of
the default query parser to perform a phrase query such as my_field:(the
value) or my_field:"the value", which don't work?

So is there a way to prevent tokenisation of a field using the
StandardAnalyzer, without implementing your own TokenizerFactory?

Regards

Ben

RE: lowercase text/strings to be used in list box

Posted by Ben Incani <be...@datacomit.com.au>.
sorry - this should have been posted on the Lucene user list.

...the solution is to use the lucene PerFieldAnalyzerWrapper and add the
field with the KeywordAnalyzer then pass the PerFieldAnalyzerWrapper to
the QueryParser.

-Ben

> -----Original Message-----
> From: Ben Incani [mailto:ben.incani@datacomit.com.au] 
> Sent: Friday, 19 October 2007 5:52 PM
> To: solr-user@lucene.apache.org
> Subject: lowercase text/strings to be used in list box
> 
> I have a field which will only contain several values (that 
> include spaces).
> 
> I want to display a list box with all possible values by 
> browsing the lucene terms.
> 
> I have setup a field in the schema.xml file.
> 
>     <fieldtype name="text_lc" class="solr.TextField">
>       <analyzer>
>         <tokenizer class="solr.KeywordTokenizerFactory"/>
>         <filter class="solr.LowerCaseFilterFactory"/>
>       </analyzer>
>     </fieldtype>
> 
> I also tried;
> 
>     <fieldtype name="string_lc" class="solr.StrField">
>       <analyzer>
>         <tokenizer class="solr.LowerCaseTokenizerFactory"/>
>         <filter class="solr.LowerCaseFilterFactory"/>
>       </analyzer>
>     </fieldtype>
> 
> 
> This allows me to browse all the values no problem, but when 
> it comes to search the documents I have to use the lucene 
> org.apache.lucene.analysis.KeywordAnalyzer, when I would 
> rather use the 
> org.apache.lucene.analysis.standard.StandardAnalyzer and the 
> power of the default query parser to perform a phrase query 
> such as my_field:(the
> value) or my_field:"the value", which don't work?
> 
> So is there a way to prevent tokenisation of a field using 
> the StandardAnalyzer, without implementing your own TokenizerFactory?
> 
> Regards
> 
> Ben
>