prorm API Reference
    Preparing search index...

    Function matchAgainst

    • Create a full-text search MATCH AGAINST condition (MySQL) SQL: MATCH(columns) AGAINST(searchTerm [IN NATURAL LANGUAGE MODE | IN BOOLEAN MODE])

      Parameters

      Returns { $match: { columns: string[]; mode: "boolean" | "natural" } }

      // Natural language mode search
      import { matchAgainst } from 'orm';
      Article.findAll({
      where: {
      [matchAgainst(['title', 'body'])]: 'database'
      }
      })
      // SQL: WHERE MATCH(title, body) AGAINST('database' IN NATURAL LANGUAGE MODE)

      // Boolean mode search
      Article.findAll({
      where: {
      [matchAgainst(['title', 'body'], { mode: 'boolean' })]: '+mysql -oracle'
      }
      })
      // SQL: WHERE MATCH(title, body) AGAINST('+mysql -oracle' IN BOOLEAN MODE)