SavageLearning / Machete

A web application for managing a day laborer referral organization. Built using .NET Core MVC, Entity Framework Core, jQuery, Datatables (datatables.net).
GNU General Public License v3.0
16 stars 17 forks source link

Implement Full Text Search Instead of relying on Entity Framework #536

Open chaim1221 opened 5 years ago

chaim1221 commented 5 years ago

Full Text Search allows for a better overall search experience; faster searches, better support for ES & EN specific characteristics, (stem'ing, etc.), reduced reliance of EF...

However, support for FTS in EFCore is not yet ideal. As of EFCore 2.2, searches in the format of

CONTAINS(*, 'some text') 

don't work as expected. The LINQ code necessary to use FTS in EFCore 2.2 is verbose and annoying. Best wait for EFCore 3 and more FTS support.

jcii commented 5 years ago

Useful TSQL: Is FTS installed?

  select SERVERPROPERTY('IsFullTextInstalled')

setting up a FTS index

USE casa_db;
GO
CREATE FULLTEXT CATALOG MacheteActivitiesFTCat;

CREATE FULLTEXT INDEX ON dbo.Activities
(
    teacher Language 1033,
    notes   Language 1033,
    nameEN  Language 1033,
    typeEN  Language 1033
)
KEY INDEX PK_Activities ON MacheteActivitiesFTCat
WITH CHANGE_TRACKING AUTO
GO

select * from Activities where contains(*, 'LnI');

drop fulltext index on dbo.Activities;

https://docs.microsoft.com/en-us/sql/relational-databases/search/get-started-with-full-text-search?view=sql-server-2017 https://docs.microsoft.com/en-us/sql/relational-databases/search/choose-a-language-when-creating-a-full-text-index?view=sql-server-2017

jcii commented 5 years ago

Installation URLS https://docs.microsoft.com/en-us/sql/linux/quickstart-install-connect-docker?view=sql-server-2017&pivots=cs1-bash https://docs.microsoft.com/en-us/sql/linux/sql-server-linux-change-repo?view=sql-server-2017&pivots=ld2-ubuntu https://docs.microsoft.com/en-us/sql/linux/sql-server-linux-setup-full-text-search?view=sql-server-2017