【问题标题】:Is there any way of using match against statement in Propel (ORM)?有什么方法可以在 Propel (ORM) 中使用匹配语句?
【发布时间】:2012-01-29 03:42:09
【问题描述】:

有没有办法在 Propel (ORM) 中使用 match against 语句?奇怪的是我找不到与此相关的任何内容。

【问题讨论】:

    标签: mysql symfony1 propel match-against


    【解决方案1】:

    至少在 Propel 1.7 中,它与 where() 子句一起使用:

    UserQuery::create()->where('MATCH('
    . UserPeer::Name
    . ') AGAINST(?)', $name)->find();
    

    【讨论】:

      【解决方案2】:

      没有直接支持。也许是自定义查询?

      $con = Propel::getConnection(BookPeer::DATABASE_NAME);
      $sql = "SELECT title,category FROM articles WHERE MATCH(title,category) AGAINST (:text); 
      $stmt = $con->prepare($sql);
      $stmt->execute(array(':text' => 'My match text'));
      

      【讨论】:

      • 谢谢。我认为这会有所帮助
      猜你喜欢
      • 2018-02-14
      • 2014-01-23
      • 1970-01-01
      • 2023-02-25
      • 2018-04-21
      • 2023-03-21
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多