mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
Full text search in natural language #6371
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @o-alquimista on GitHub (Dec 17, 2019).
Support Question
I use Symfony and Doctrine in my applications, and they have search functionality. Using full text index I can get results ordered by relevancy, so I decided to implement it.
I tried using the query builder and DQL, but it gives me an error saying it doesn't recognize the MATCH function. I didn't find anything about this in the documentation. All I could find online is people using plain SQL queries to achieve this type of search. In another source they said Doctrine doesn't support this because it is "vendor-specific", so I have to ask if that's true.
Right now I'm successfully performing the query with a prepared statement (without Doctrine):
Is there a way to perform this query with Doctrine?
My database is MySQL 5.7.
@SenseException commented on GitHub (Dec 28, 2019):
There is no full-text search query in DQL for the ORM like the other source you mention is saying. Databases that are supporting full-text search are handling their features differently. While there is a standard for SQL, full-text was outsourced into the independent SQL/MM standard and most of the available RDBMS are to this day not on the same level as the defined standards, which makes it harder to implement database compatibility into ORM.
Your current solution seems to be a fitting one to your project. You could try to create yourself a custom DQL function for your needs, that is creating the MySQL syntax for your search though.