com.atlassian.confluence.search.lucene
Class CaseInsensitiveSortComparator

java.lang.Object
  extended by org.apache.lucene.search.SortComparator
      extended by com.atlassian.confluence.search.lucene.CaseInsensitiveSortComparator
All Implemented Interfaces:
Serializable, org.apache.lucene.search.SortComparatorSource

public class CaseInsensitiveSortComparator
extends org.apache.lucene.search.SortComparator

A Lucene SortComparator that will convert field text to lower case effectively rendering all comparisons case insensitive.

See Also:
Serialized Form

Constructor Summary
CaseInsensitiveSortComparator()
           
 
Method Summary
 boolean equals(Object obj)
           Since the comparator used has no actual 'user' data we only want one of them cached so equals is just based on class.
protected  Comparable getComparable(String fieldText)
           
 int hashCode()
          See the equals(Object) implementation for explanation.
 
Methods inherited from class org.apache.lucene.search.SortComparator
newComparator
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CaseInsensitiveSortComparator

public CaseInsensitiveSortComparator()
Method Detail

getComparable

protected Comparable getComparable(String fieldText)
Specified by:
getComparable in class org.apache.lucene.search.SortComparator

equals

public boolean equals(Object obj)

Since the comparator used has no actual 'user' data we only want one of them cached so equals is just based on class.

This is very important. Otherwise Lucene will cache a new comparator for each search/sort performed. Since each comparator has a field cache for it's respective field you will quickly run out of memory.

Overrides:
equals in class Object

hashCode

public int hashCode()
See the equals(Object) implementation for explanation.

Overrides:
hashCode in class Object


Copyright © 2003-2013 Atlassian. All Rights Reserved.