Hi all!

I have documents, all of which have a title, and I would like to sort by
that title.  The catch is, I wish to sort ignoring any "A" or "The" at the
beginning of the title.  

My first (and only) attempt is by creating a type that looks like:

        <fieldType name="titleSort" class="solr.TextField"
           sortMissingLast="true" omitNorms="true">
          <analyzer>
            <tokenizer class="solr.KeywordTokenizerFactory"/>
            <filter class="solr.LowerCaseFilterFactory"/>
            <filter class="solr.TrimFilterFactory"/>
            <filter class="solr.PatternReplaceFilterFactory"
                pattern="([^a-z])" replacement="" replace="all" />
            <filter class="solr.PatternReplaceFilterFactory"
                pattern="^the\s" replacement="" replace="first" />
            <filter class="solr.PatternReplaceFilterFactory"
                pattern="^a\s" replacement="" replace="first" />
            <filter class="solr.StopFilterFactory" ignoreCase="true"
                words="stopwords.txt"/>
          </analyzer>
        </fieldType>

Also, the StopFilter should do the same thing I think, so there is some
redundancy here too, right?

and a field that looks like:

        <field name="title.main" type="stringSort" indexed="true"
           maxChars="32" stored="true" multiValued="false"/>

I copyField my original title to this field at index time.

However, when I add "sort=title.main asc" to my query, the original sort is
what I see.

Clearly, I'm either doing something wrong, or I am misunderstanding
something.  Can anybody explain what's up and suggest a way to accomplish
what I need to do?

Thanks in Advance!!

--
View this message in context: 
http://lucene.472066.n3.nabble.com/Sorting-by-article-title-tp3396743p3396743.html
Sent from the Solr - User mailing list archive at Nabble.com.

Reply via email to