ciricihq/match-against-bundle

一个针对symfony的搜索包,使用MySQL FULLTEXT MATCH AGAINST

安装次数: 2,988

依赖者: 0

建议者: 0

安全: 0

星标: 7

关注者: 6

分支: 1

开放性问题: 1

类型:symfony-bundle

v1.0.0 2016-04-11 22:07 UTC

This package is auto-updated.

Last update: 2024-09-08 06:27:20 UTC


README

基于https://gist.github.com/ZeBigDuck/1234419

安装

composer require ciricihq/match-against-bundle

使用方法

您必须加载提供的config.yml配置文件,以便使用MATCH_AGAINST MySQL句子

imports:
    - { resource: ../../src/Cirici/MatchAgainstBundle/Resources/config/config.yml }

进行查询

  $qbuilder
      ->select('sti.foreignId')
      ->from('Cirici\MatchAgainstBundle\Entity\SearchTextIndex', 'sti')
      ->where('sti.model = :entityClass')
      ->andWhere('sti.field = :fieldName')
      // ->andWhere("MATCH_AGAINST(sti.content, :text 'IN NATURAL LANGUAGE MODE') > :score")
      ->andWhere("MATCH_AGAINST(sti.content, :text 'IN BOOLEAN MODE') > :score")
      ->setParameter('entityClass', $entity_class)
      ->setParameter('fieldName', $field_name)
      ->setParameter('text', $text)
      ->setParameter('score', $score)
  ;

许可证

许可协议为GNU GPL 2.0。有关更多详细信息,请参阅LICENSE文件。

版权所有 2015 © Cirici New Media