Thanks for your reply Lucas.
I actually ended up creating this as a CustomField<> because i use it in
several selects and conditional checks.
public class TsQueryField<R extends Record> extends CustomField<Boolean> {
private Collection<String> queries;
private TableField<R, Object> queryField;
public TsQueryField(TableField<R, Object> field, Collection<String>
queries) {
super(field.getName(), new DefaultDataType(SQLDialect.POSTGRES,
Boolean.FALSE.getClass(), "Boolean"));
this.queryField = field;
this.queries = queries;
}
public void toSQL(RenderContext context) {
CastMode castMode = context.castMode();
context.castMode(CastMode.NEVER).formatSeparator()
.visit(queryField)
.sql(" @@ ")
.visit(inline(MiscUtils.join(queries, "|")))
.sql("::tsquery")
.castMode(castMode);
}
}
However I am running into a problem when i try to check if this column is
true. for example i am using:
.and(fnameTsQuery.isTrue().or(lnameTsQuery.isTrue()))
where both fnameTsQuery and lnameTsQuery variables are of type TsQueryField
as defined above. This is generating SQL equivalent to the following:
"public"."test"."s_fnames" @@ 'hoover|greg'::tsquery = ?
I am unable to get rid of that ?. Is this a bug or am i doing something
wrong here?
On Wednesday, January 8, 2014 11:31:00 AM UTC-5, Harshith wrote:
>
>
>
> Does Jooq support postgres text/document search functionality using
> tsquery? If so, is there an example that I can look up? I couldn't find
> anything in the manual or web search.
>
> If not, what would be a suggested alternative to a query that uses
> textsearch. For example what would be the easiest way to translate a
> conditional like:
>
> field @@ 'match1|match2|match3:*'::tsquery
>
--
You received this message because you are subscribed to the Google Groups "jOOQ
User Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.