At the moment for "string", I have:

<fieldType name="string" class="solr.StrField" sortMissingLast="true"
omitNorms="true"/>

is there an example type so that it will do exact matches?

Would "alphaOnlySort" do the trick? It looks like it might.

    <fieldType name="alphaOnlySort" 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" />
        <!-- The TrimFilter removes any leading or trailing whitespace -->
        <filter class="solr.TrimFilterFactory" />
        <!-- The PatternReplaceFilter gives you the flexibility to use
             Java Regular expression to replace any sequence of characters
             matching a pattern with an arbitrary replacement string,
             which may include back refrences to portions of the orriginal
             string matched by the pattern.

             See the Java Regular Expression documentation for more
             infomation on pattern and replacement string syntax.

             
http://java.sun.com/j2se/1.5.0/docs/api/java/util/regex/package-summary.html
          -->
        <filter class="solr.PatternReplaceFilterFactory"
                pattern="([^a-z])" replacement="" replace="all"
        />
      </analyzer>
    </fieldType>

On Tue, Jul 22, 2008 at 11:20 AM, Yonik Seeley <[EMAIL PROTECTED]> wrote:
> On Tue, Jul 22, 2008 at 11:08 AM, Ian Connor <[EMAIL PROTECTED]> wrote:
>> How can I require an exact field match in a query. For instance, if a
>> title field contains "Nature" or "Nature Cell Biology", when I search
>> title:Nature I only want "Nature" and not "Nature Cell Biology". Is
>> that something I do as a query or do I need to re index it with the
>> field defined in a certain way?
>>
>> I have this definition now - but it returns all titles that contain
>> "Nature" rather than just the ones that equals it exactly.
>>
>>
>>   <field name="title" type="string" indexed="true" stored="true"
>> omitNorms="true"/>
>
> That field definition should do it.
> Try title:Nature  it may be that you have a default search field that
> has a different analyzer configured.
> If that doesn't work, make sure you have reindexed after your schema changes.
>
> -Yonik
>



-- 
Regards,

Ian Connor
82 Fellsway W #2
Somerville, MA 02145
Direct Line: +1 (978) 6333372
Call Center Phone: +1 (714) 239 3875 (24 hrs)
Mobile Phone: +1 (312) 218 3209
Fax: +1(770) 818 5697
Suisse Phone: +41 (0) 22 548 1664
Skype: ian.connor

Reply via email to