public abstract class FulltextSupportingDatabaseConfiguration extends StandardDatabaseConfiguration
setUseFulltextFeature(boolean)
has been set to true it will use the database
getSpecificFulltextSQLFunction()
for rendering the fulltext query. Otherwise the simple
'like' will be used.COMMUNOTE_CONNECTION_PROVIDER_CLASS
Constructor and Description |
---|
FulltextSupportingDatabaseConfiguration() |
Modifier and Type | Method and Description |
---|---|
String |
getFulltextParameterValue(String pattern,
org.hibernate.criterion.MatchMode matchMode,
boolean doNotUseFulltext)
Get the (database specific) parameter value for the given pattern
|
org.hibernate.dialect.function.SQLFunction |
getFulltextSQLFunction()
Return the SQL function that translates the HQL 'fulltext' function to SQL.
|
protected abstract String |
getSpecificFulltextParameterValue(String pattern,
org.hibernate.criterion.MatchMode matchMode)
Take the pattern and match mode an return the parameter value to be used in the fulltext
query.
|
protected abstract org.hibernate.dialect.function.SQLFunction |
getSpecificFulltextSQLFunction() |
static String |
getWildcardPattern(String pattern,
org.hibernate.criterion.MatchMode matchMode,
String wildcard,
String prefix,
String suffix)
Take the pattern and match mode an return the parameter value to be used in the fulltext
query.
|
static String |
getWildcardPattern(String pattern,
org.hibernate.criterion.MatchMode matchMode,
String wildcardStart,
String wildcardEnd,
String prefix,
String suffix)
Take the pattern and match mode an return the parameter value to be used in the fulltext
query.
|
boolean |
isUseFulltextFeature() |
void |
setUseFulltextFeature(boolean useFulltextFeature)
Enable or disable the fulltext feature of configuration that supports the fulltext function
|
getConnectionProviderClassName, getDatepartSQLFunction, getFulltextParameterValue, isExtendSubselectsWithOuterConditions
public FulltextSupportingDatabaseConfiguration()
public static String getWildcardPattern(String pattern, org.hibernate.criterion.MatchMode matchMode, String wildcard, String prefix, String suffix)
pattern
- the search stringmatchMode
- the match mode to usewildcard
- the wildcardprefix
- some additional string to prependsuffix
- some additional string to appendpublic static String getWildcardPattern(String pattern, org.hibernate.criterion.MatchMode matchMode, String wildcardStart, String wildcardEnd, String prefix, String suffix)
pattern
- the search stringmatchMode
- the match mode to usewildcardStart
- the wildcardwildcardEnd
- the wildcardprefix
- some additional string to prependsuffix
- some additional string to appendpublic String getFulltextParameterValue(String pattern, org.hibernate.criterion.MatchMode matchMode, boolean doNotUseFulltext)
getFulltextParameterValue
in interface DatabaseConfiguration
getFulltextParameterValue
in class StandardDatabaseConfiguration
pattern
- the patternmatchMode
- the hibernate match modedoNotUseFulltext
- true if the parameter should use the like wildcards matching even if fulltext is
enabledpublic org.hibernate.dialect.function.SQLFunction getFulltextSQLFunction()
The HQL 'fulltext' function takes two arguments: The field to be search and the string to
search for. In HQL the fulltext function has always to be matched against 1, e.g.
fulltext(content.content, 'mysearch') = 1
. BUT if you want the negation use:
not (fulltext(content.content,'mysearch'))
When building queries with the HQL fulltext function always use the
DatabaseConfiguration.getFulltextParameterValue(String, MatchMode)
to set the parameter values because the
syntax differs per database
getFulltextSQLFunction
in interface DatabaseConfiguration
getFulltextSQLFunction
in class StandardDatabaseConfiguration
protected abstract String getSpecificFulltextParameterValue(String pattern, org.hibernate.criterion.MatchMode matchMode)
pattern
- the search stringmatchMode
- the match mode to useprotected abstract org.hibernate.dialect.function.SQLFunction getSpecificFulltextSQLFunction()
public boolean isUseFulltextFeature()
isUseFulltextFeature
in interface DatabaseConfiguration
isUseFulltextFeature
in class StandardDatabaseConfiguration
setUseFulltextFeature(boolean)
public void setUseFulltextFeature(boolean useFulltextFeature)
useFeature
- true to use the featureCopyright © 2019 Communote team. All rights reserved.