Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-41022

Wildcard term returns no rows when combined with a phrase in boolean search

    XMLWordPrintable

Details

    • Unexpected results

    Description

      In BOOLEAN MODE, an InnoDB full-text query that contains a quoted phrase followed by an un-prefixed wildcard term (for example "zzzz" aut*) fails to match rows whose words are still in the in-memory FTS index cache, i.e. rows inserted or updated since the cache was last synced to the auxiliary index tables. The same rows are matched once they have been flushed to disk (OPTIMIZE TABLE with innodb_optimize_fulltext_only=ON, cache size limit reached, or server restart).

      The bug is triggered by the ordering of the terms only. The following variants of the same query all return the row correctly:

      • the wildcard term placed before the phrase: aut* "zzzz"
      • the wildcard term marked as required: "zzzz" +aut*
      • an exact word instead of a wildcard: "zzzz" auth
      • the wildcard term on its own: aut*

      CREATE TABLE t (id INT AUTO_INCREMENT PRIMARY KEY, txt TEXT, FULLTEXT(txt)) ENGINE=InnoDB;
      INSERT INTO t (txt) VALUES ('auth code out');
      SELECT id FROM t WHERE MATCH(txt) AGAINST('"zzzz" aut*' IN BOOLEAN MODE);   -- empty (wrong)
      SELECT id FROM t WHERE MATCH(txt) AGAINST('aut* "zzzz"' IN BOOLEAN MODE);   -- 1
      SELECT id FROM t WHERE MATCH(txt) AGAINST('"zzzz" +aut*' IN BOOLEAN MODE);  -- 1
      SET GLOBAL innodb_optimize_fulltext_only=ON; OPTIMIZE TABLE t;
      SELECT id FROM t WHERE MATCH(txt) AGAINST('"zzzz" aut*' IN BOOLEAN MODE);   -- 1 once synced to disk
      

      Attachments

        Issue Links

          Activity

            People

              thiru Thirunarayanan Balathandayuthapani
              kieran Kieran Brahney
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0d
                  0d
                  Logged:
                  Time Spent - 2h 20m
                  2h 20m

                  Git Integration

                    Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.