gpt4 book ai didi

MySQL FTS boolean 模式运算符自定义

转载 作者:行者123 更新时间:2023-11-30 23:18:30 28 4
gpt4 key购买 nike

我正在使用 MySQL 5.6.10 的 InnoDB FTS,并且想更改 boolean 运算符的默认行为。

Note In implementing this feature, MySQL uses what is sometimes referred to as implied Boolean logic, in which

[+] stands for AND

[-] stands for NOT

[no operator] implies OR

我想要的行为:

  • [无运算符] 表示 AND
  • [|] 代表或

ft_boolean_syntax

Command-Line Format --ft_boolean_syntax=name Option-File Format ft_boolean_syntax Variable Name ft_boolean_syntax Variable Scope Global Dynamic Variable Yes Permitted Values Type string Default +-><()~*:""& The list of operators supported by boolean full-text searches performed using IN BOOLEAN MODE. See Section 12.9.2, “Boolean Full-Text Searches”.

The default variable value is '+ -><()~*:""&|'. The rules for changing the value are as follows:

Operator function is determined by position within the string.

The replacement value must be 14 characters.

Each character must be an ASCII nonalphanumeric character.

Either the first or second character must be a space.

No duplicates are permitted except the phrase quoting operators in positions 11 and 12. These two characters are not required to be the same, but they are the only two that may be.

Positions 10, 13, and 14 (which by default are set to “:”, “&”, and “|”) are reserved for future extensions.

所以我尝试将 ft_boolean_syntax 更改为 ' |-><()~*:""&+' 但这对我不起作用。没有给定的运算符仍然暗示 OR。

我做错了什么?

最佳答案

似乎 InnoDB FTS 还未完成。对于 MySQL 5.6.10 和 MyISAM,自定义的 ft_boolean_syntax 可以按需要工作。但是, boolean OR 必须表示为 '|word1 |word2',即 'word1 | word2' 将产生一个 AND。

关于MySQL FTS boolean 模式运算符自定义,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16516478/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com