com.raritantechnologies.searchApp.resultComparators
Class ResultFieldLengthComparator
java.lang.Object
com.raritantechnologies.searchApp.resultComparators.ResultFieldLengthComparator
- All Implemented Interfaces:
- java.util.Comparator, IConfigurable, IResultComparator
- public class ResultFieldLengthComparator
- extends java.lang.Object
- implements IResultComparator
Compares two results based on the presence of a search word in a field...
XML Configuration Template:
<ResultComparator class="com.raritantechnologies.searchApp.resultComparators.ResultFieldLengthComparator"
resultField="[ name of result field to compare ]"
queryParameter="[ name of query parameter to get query hit ]" />
If both Results have hit in resultField
If both have same token length
first hit is lower
Else
shorter title is lower
Else if one result has hit in resultField
resultField hit is lower
Else
no difference
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface java.util.Comparator |
equals |
ResultFieldLengthComparator
public ResultFieldLengthComparator()
setResultField
public void setResultField(java.lang.String resultField)
setQueryParameter
public void setQueryParameter(java.lang.String queryParameter)
setContext
public void setContext(java.util.Map parameterMap)
- Specified by:
setContext in interface IResultComparator
compare
public int compare(IResult res1,
IResult res2)
- Specified by:
compare in interface IResultComparator
compare
public int compare(java.lang.Object obj1,
java.lang.Object obj2)
- Specified by:
compare in interface java.util.Comparator
initialize
public void initialize(org.w3c.dom.Element elem)
- Description copied from interface:
IConfigurable
- Initializes the object from an XML tag or element.
This method is called by the Framework as part of the application initializtion.
see ConfigurationManager, XMLConfigurationManager, XMLSearchFieldMapFactory, XMLSearchSourceFactory.
Configurable objects that are owned or contained by other configurable objects will be initialized
in by the parent object.
- Specified by:
initialize in interface IResultComparator
getConfigurationXML
public java.lang.String getConfigurationXML()
getConfigurationXML
public java.lang.String getConfigurationXML(java.lang.String configurationTemplate)