I'm stuck in a simple problem, I'd like to add a new custom restriction in NHibernate. I want to write a simple QueryOver with a fulltext index, an example with a Projections is here How to use Full Text Search for any property with QueryOver API
But I need a more flexibility so I'd like something like
criteria = criteria.WhereRestrictionOn(() => table.COLUMN_WITHFULLTEXTINDEX).Contains(valueToCheck);
Is it possible? I'm trying in the latest to days surfing over the NHibernate source code but I could't get anything usefull.
Thanks
Since I must manage two different dbs dialect (SQL SERVER and ORACLE) I made the following.
A class that has all the custom criterions, now only one for full text
Then a class who have to manage custom criterion
FullTextCriterion isn't strictly necessary but the ORACLE syntax is
CONTAINS (a, b)>0
So I must to add the ">0".
DbUtil build the syntax by the dialect, e.g. in ORACLE
public SqlString GetFullText(SqlString[] columnNames) {
Without using FullTextCriterion for ORACLE dialect I could use more simplest solutions that use custom projection instead custom criterion: NHibernate QueryOver Coalesce a property to another property
In addition, another simplest solution is to call the template as explained here http://www.andrewwhitaker.com/blog/2014/08/15/queryover-series-part-7-using-sql-functions/ and call it directly in ProcessFullTextSearch method. In this another solution it can write only a dummy ProjectionAsCriterion class which get only
The template it could be written into the dialect class as