Class QueryType
- java.lang.Object
-
- com.broadleafcommerce.search.provider.solr.type.QueryType
-
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
PhraseExactQueryType
,PhraseQueryType
,WordQueryType
public abstract class QueryType extends Object implements Serializable
Represents a type of query. EachQueryType
allows a different matching method on the search query, for example phrase or word match.Implement this class and register the implementation as a bean to add a new type.
- See Also:
- Serialized Form
-
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected boolean
canEqual(Object other)
boolean
equals(Object o)
Double
getBoost()
The amount to boost results which match this query type.String
getField()
The field which is used to reference this query type for constructing Solr queries and associating boosts.static QueryType
getInstance(String type)
Retrieves an QueryType based on its String representation.String
getType()
The named representation of the query type.String
getTypeQuery(String query)
Get the original query formatted to result in the desired query type with boost applied.protected abstract String
getTypeQueryInternal(String query)
Get the original query formatted to result in the desired query type.int
hashCode()
-
-
-
Method Detail
-
getInstance
public static QueryType getInstance(String type)
Retrieves an QueryType based on its String representation.- Parameters:
type
- The type- Returns:
- The QueryType
- Throws:
IllegalArgumentException
- if the QueryType is not found
-
getTypeQuery
public String getTypeQuery(String query)
Get the original query formatted to result in the desired query type with boost applied.- Parameters:
query
- the original query- Returns:
- query formatted for the desired query type with boost applied
-
getTypeQueryInternal
protected abstract String getTypeQueryInternal(String query)
Get the original query formatted to result in the desired query type.- Parameters:
query
- the original query- Returns:
- query formatted for the desired query type
-
canEqual
protected boolean canEqual(Object other)
-
getType
public String getType()
The named representation of the query type.- Returns:
- named representation of the query type
-
getField
public String getField()
The field which is used to reference this query type for constructing Solr queries and associating boosts.- Returns:
- field which is used to reference this query type in Solr queries
-
getBoost
public Double getBoost()
The amount to boost results which match this query type.- Returns:
- amount to boost results which match this query type
-
-