On Fri, Jun 19, 2009 at 12:50 PM, Ian Holsman <li...@holsman.net> wrote:

> I've noticed that one of the new features in Solr 1.4 is the Termscomponent
> which enables the Autosuggest.
>

TermsComponent *can* be used for autosuggest though I don't think that was
the original motivation. In the end it just the same thing as a prefix but
returns the indexed tokens only rather than the stored field values. I think
that by naming it as /autoSuggest, a lot of users have been misled since
there are other techniques available.


>
> but what puzzles me is how to actually use it in an application.
>
> most autosuggests are case insensitive, so there is no difference if I type
> in 'San Francisco' or 'san francisco'.
>
> now I've tried with a 'text' field, and a 'string' field with no joy. with
> String providing the best result, but still with case sensitivity.
>
> at the moment I'm using a custom field type
>
>    <fieldType name="string_lc" class="solr.TextField"
> sortMissingLast="true" omitNorms="true">
>      <analyzer>
>        <!-- KeywordTokenizer does no actual tokenizing, so the entire
>             input string is preserved as a single token
>          -->
>        <tokenizer class="solr.KeywordTokenizerFactory"/>
>        <!-- The LowerCase TokenFilter does what you expect, which can be
>             when you want your sorting to be case insensitive
>          -->
>        <filter class="solr.LowerCaseFilterFactory" />
>
>
>      </analyzer>
>    </fieldType>
>
> which converts all the field to all lower case, which allows me to submit
> the query as lower case and better good results.
>
> so the point of the email is to find out how do I get the autosuggest to
> return mixed case results, and not require me to lower case the query
> before
> I send it?
>

There is no way to do this right now using TermsComponent. You can index
lower case terms and store the mixed case terms. Then you can use a prefix
query which will return documents (and hence stored field values).

-- 
Regards,
Shalin Shekhar Mangar.

Reply via email to