简体   繁体   English

如何在奏鸣曲中搜索json栏目?

[英]How to search json column in Sonata?

I have column in my db where data looks like this "{"cs":"Lékař","en":"Doctor","_type":"translated"}" I need to perform fulltext search like shown in screenshot and I have no idea how to do it.我的数据库中有列,其中数据看起来像这样 "{"cs":"Lékař","en":"Doctor","_type":"translated"}" 我需要执行全文搜索,如屏幕截图所示,我不知道该怎么做。 Is there any way how to extract data from db and then perform search on this?有什么办法可以从数据库中提取数据,然后对其进行搜索吗? I couldn't find any mention of it in documentation.我在文档中找不到任何提及它的地方。 Maybe there is some simple solution which I can't see, thank you for your help.也许有一些我看不到的简单解决方案,谢谢您的帮助。 在此处输入图像描述

I tried to solve it by raw sql query but sonata for it's filters expects instance of QueryBuilder.我试图通过原始 sql 查询来解决它,但是奏鸣曲的过滤器需要 QueryBuilder 的实例。 I also tried to change column's collation, but it didn't help.我也尝试更改列的排序规则,但没有帮助。

It turned out I'm completely blind.原来我完全瞎了。 If somebody would run into this problem in the future, there is possibility to create custom filter like it is described here.如果将来有人遇到此问题,则可以像此处描述的那样创建自定义过滤器。 https://docs.sonata-project.org/projects/SonataDoctrineORMAdminBundle/en/4.x/reference/filter_field_definition/#jsonlistfilter-and-custom-filters https://docs.sonata-project.org/projects/SonataDoctrineORMAdminBundle/en/4.x/reference/filter_field_definition/#jsonlistfilter-and-custom-filters

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM