BrightSide Workbench Full Report + Source Code
org.turro.sql.SQLUtil Class Reference

Static Public Member Functions

static void applySearchToQuery (String search, WhereClause wc, List< String > fields)
 
static void applySearchToQuery (String search, WhereClause wc, List< String > fields, boolean withSynonyms)
 
static void applySearchToQuery (String search, WhereClause wc, List< String > fields, boolean withSynonyms, boolean orEd)
 
static void applyFullsearchToQuery (String search, WhereClause wc, String fields)
 
static void applyFullsearchToQuery (String search, WhereClause wc, String fields, boolean withSynonyms)
 
static void applyFullsearchToQuery (String search, WhereClause wc, String fields, boolean withSynonyms, boolean orEd)
 

Static Public Attributes

static final int MAX_SYNONIMS = 10
 

Detailed Description

Author
Lluis TurrĂ³ Cutiller lluis.nosp@m.@tur.nosp@m.ro.or.nosp@m.g

Definition at line 31 of file SQLUtil.java.

Member Function Documentation

◆ applyFullsearchToQuery() [1/3]

static void org.turro.sql.SQLUtil.applyFullsearchToQuery ( String  search,
WhereClause  wc,
String  fields 
)
static

Definition at line 69 of file SQLUtil.java.

69  {
70  applyFullsearchToQuery(search, wc, fields, false, false);
71  }
static void applyFullsearchToQuery(String search, WhereClause wc, String fields)
Definition: SQLUtil.java:69
Here is the caller graph for this function:

◆ applyFullsearchToQuery() [2/3]

static void org.turro.sql.SQLUtil.applyFullsearchToQuery ( String  search,
WhereClause  wc,
String  fields,
boolean  withSynonyms 
)
static

Definition at line 73 of file SQLUtil.java.

73  {
74  applyFullsearchToQuery(search, wc, fields, withSynonyms, false);
75  }
Here is the call graph for this function:

◆ applyFullsearchToQuery() [3/3]

static void org.turro.sql.SQLUtil.applyFullsearchToQuery ( String  search,
WhereClause  wc,
String  fields,
boolean  withSynonyms,
boolean  orEd 
)
static

Definition at line 77 of file SQLUtil.java.

77  {
78  if(withSynonyms) {
79  List<Synonyms> synonyms = Synonyms.getSynonymsByWords(search);
80  if(!synonyms.isEmpty() && synonyms.size() <= MAX_SYNONIMS) {
81  for(Synonyms s : synonyms) {
82  for(String w : s.getWords()) {
83  if(!search.toLowerCase().contains(w.toLowerCase())) {
84  search += " " + w;
85  }
86  }
87  }
88  }
89  }
90  wc.addClause(orEd ? "or (" : "and (");
91  wc.addClause("match(" + fields + ") against (:fsearch01)");
92  wc.setOrderByClause("match(" + fields + ") against (:fsearch01) desc");
93  wc.addNamedValue("fsearch01", search);
94  wc.addClause(")");
95  wc.setUseNative(true);
96  }
static final int MAX_SYNONIMS
Definition: SQLUtil.java:34
Here is the call graph for this function:

◆ applySearchToQuery() [1/3]

static void org.turro.sql.SQLUtil.applySearchToQuery ( String  search,
WhereClause  wc,
List< String >  fields 
)
static

Definition at line 36 of file SQLUtil.java.

36  {
37  applySearchToQuery(search, wc, fields, false, false);
38  }
static void applySearchToQuery(String search, WhereClause wc, List< String > fields)
Definition: SQLUtil.java:36
Here is the caller graph for this function:

◆ applySearchToQuery() [2/3]

static void org.turro.sql.SQLUtil.applySearchToQuery ( String  search,
WhereClause  wc,
List< String >  fields,
boolean  withSynonyms 
)
static

Definition at line 40 of file SQLUtil.java.

40  {
41  applySearchToQuery(search, wc, fields, withSynonyms, false);
42  }
Here is the call graph for this function:

◆ applySearchToQuery() [3/3]

static void org.turro.sql.SQLUtil.applySearchToQuery ( String  search,
WhereClause  wc,
List< String >  fields,
boolean  withSynonyms,
boolean  orEd 
)
static

Definition at line 44 of file SQLUtil.java.

44  {
45  String sep = "";
46  wc.addClause(orEd ? "or (" : "and (");
47  for(String field : fields) {
48  wc.addClause(sep + field + " like :search01");
49  sep = "or ";
50  }
51  wc.addNamedValue("search01", SQLHelper.convertToPartialLike(search));
52  if(withSynonyms) {
53  List<Synonyms> synonyms = Synonyms.getSynonymsByWords(search);
54  if(!synonyms.isEmpty() && synonyms.size() <= MAX_SYNONIMS) {
55  for(Synonyms s : synonyms) {
56  for(String field : fields) {
57  for(String w : s.getWords()) {
58  wc.addClause(sep + field + " like :w" + Strings.identifier(w));
59  sep = "or ";
60  wc.addNamedValue("w" + Strings.identifier(w), SQLHelper.convertToPartialLike(w));
61  }
62  }
63  }
64  }
65  }
66  wc.addClause(")");
67  }
Here is the call graph for this function:

Member Data Documentation

◆ MAX_SYNONIMS

final int org.turro.sql.SQLUtil.MAX_SYNONIMS = 10
static

Definition at line 34 of file SQLUtil.java.


The documentation for this class was generated from the following file: