NHibernate extension to support custom connections for full-text search

We have a .NET application based on the NHibernate data access level using the Criteria and QueryOver APIs to query a SQL Server 2008 database. The requirement is to implement some query filters based on Microsoft SQL Server’s native FullText ranking capabilities .

By translating this into SQL, we have something like this.

SELECT * FROM entities INNER JOIN FREETEXTTABLE(entities, ft_column, "some ft query") ft_tbl ON entities.Id = ft_tbl.[KEY] ORDER BY ft_tbl.[RANK] DESC 

I emphasize that we need to use the table function FREETEXT , not scalar FREETEXT.

We cannot use the subquery criterion because we need to paginate results sorted by rank.

Now, how can I extend NHibernate to implement support for such user connections in the Criteria and QueryOver APIs?

I moved to the sources of NHibernate, collecting the best extension point for this, as was already done in the past, but this time I did not succeed, therefore I turn to NHibernate experts.

Thanks in advance.

+4
source share

Source: https://habr.com/ru/post/1495554/


All Articles