Regain 2.1.0-STABLE API

net.sf.regain.search.results
Class SortingOption

java.lang.Object
  extended by net.sf.regain.search.results.SortingOption
All Implemented Interfaces:
Comparable

public class SortingOption
extends Object
implements Comparable

Holds the sorting for the current search request.

Author:
Thomas Tesche: www.thtesche.com

Field Summary
private  String description
           
static String FILENAME
           
private  int id
           
static String LAST_MODIFIED
           
static String MIMETYPE
           
static String PATH
           
static String RELEVANCE
           
private  boolean reverse
           
static String SIZE
           
private  String sortFieldName
           
private  int sortType
           
static String TITLE
           
 
Constructor Summary
SortingOption(String orderFromRequest)
          Creates the class from a given sorting option.
SortingOption(String description, String field, String order, int id)
          Creates the instance from given config entries.
 
Method Summary
 int compareTo(Object sortingOption)
          Sort this option against another option.
 boolean equals(Object object)
          Equal if same id.
 String getDescription()
           
 String getFieldNameAndOrder()
           
 int getId()
           
 org.apache.lucene.search.SortField getSortField()
           
 String getSortFieldName()
           
 int getSortType()
           
 int hashCode()
           
 boolean isReverse()
           
private  boolean isReverse(String option)
           
private  void setRelevance()
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

RELEVANCE

public static String RELEVANCE

FILENAME

public static String FILENAME

SIZE

public static String SIZE

MIMETYPE

public static String MIMETYPE

LAST_MODIFIED

public static String LAST_MODIFIED

TITLE

public static String TITLE

PATH

public static String PATH

sortFieldName

private String sortFieldName

reverse

private boolean reverse

sortType

private int sortType

description

private String description

id

private int id
Constructor Detail

SortingOption

public SortingOption(String orderFromRequest)
Creates the class from a given sorting option.

Parameters:
orderFromRequest - the order String from the request. The orderFromRequest is build from the field and the sorting direction e.g. size_desc.

SortingOption

public SortingOption(String description,
                     String field,
                     String order,
                     int id)
              throws RegainException
Creates the instance from given config entries.

Parameters:
description - the description shown in the dropdown box
field - the field name for sorting
order - asc|desc indicates the sorting direction
id - the position in the dropdown list
Throws:
RegainException
Method Detail

isReverse

private boolean isReverse(String option)

setRelevance

private void setRelevance()

getSortFieldName

public String getSortFieldName()
Returns:
the sortField

getFieldNameAndOrder

public String getFieldNameAndOrder()
Returns:
the sortField plus the sorting direction

isReverse

public boolean isReverse()
Returns:
the reverse

getSortType

public int getSortType()
Returns:
the sortType

getSortField

public org.apache.lucene.search.SortField getSortField()

getDescription

public String getDescription()
Returns:
the description

getId

public int getId()
Returns:
the id

compareTo

public int compareTo(Object sortingOption)
              throws ClassCastException
Sort this option against another option.

Specified by:
compareTo in interface Comparable
Parameters:
sortingOption -
Returns:
Throws:
ClassCastException

equals

public boolean equals(Object object)
Equal if same id.

Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object

Regain 2.1.0-STABLE API

Regain 2.1.0-STABLE, Copyright (C) 2004-2010 Til Schneider, www.murfman.de, Thomas Tesche, www.clustersystems.info