Fulltext query in MySQL with TypeORM
See original GitHub issueIssue type:
[x] question [ ] bug report [ ] feature request [ ] documentation issue
Database system/driver:
[ ] cordova
[ ] mongodb
[ ] mssql
[x] mysql / mariadb
[ ] oracle
[ ] postgres
[ ] sqlite
[ ] sqljs
[ ] react-native
[ ] expo
TypeORM version:
[x] latest
[ ] @next
[ ] 0.x.x (or put your version here)
How can I do a fulltext query in MySQL?
I want to search all the people that has a determinate word or phrase. For example, in the table “People” has:
@Column("varchar")
name: string;
@Column("varchar")
lastname: string;
@Column("text")
personalDescription: string;
So with the word “Programmer” or “I am a programmer in javascript” I want to find who have that info through the functionality “Full-text” of MySQL among the name, lastname, and personalDescription of an user.
Thanks.
Issue Analytics
- State:
- Created 5 years ago
- Comments:11 (5 by maintainers)
Top Results From Across the Web
TypeORM FullText Search - Techiediaries
In this short article, we'll see how to use the builtin full-text search in MySQL and PostgreSQL databases with TypeORM.
Read more >Postgresql full text search with TypeOrm - Stack Overflow
There is some way to handle full text search with Postgres and TypeOrm. I've seen some examples but they only work with Mysql....
Read more >Postgresql full text search with TypeOrm - iTecNote
There is some way to handle full text search with Postgres and TypeOrm. I've seen some examples but they only work with Mysql....
Read more >12.10 Full-Text Search Functions - MySQL :: Developer Zone
A full-text index in MySQL is an index of type FULLTEXT . Full-text indexes can be used only with InnoDB or MyISAM tables,...
Read more >Perform Full-text Searches in MySQL (Part 2) - Navicat
Leave the Index method blank as it is not required for a FULLTEXT index. Finally, click the Save button to create the index....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I do not have much experience with mysql fulltext. But my simple test is running.
Entity:
Select using query builder:
If you need more advanced fulltext search you have to check mysql documentation.
You should write
findlike this:This is just simple example with
LIKE.I do not have experience with mysql fulltext feature, but if you want to use it you have to define fulltext index with
@Index({ fulltext: true })and use query builder to write own custom query http://typeorm.io/#/select-query-builder/adding-where-expression and use special sql syntax.