# Manticore Search 6.3.0

Manticore Search 6.3.0: Vector search, JOIN, REGEX, 60 improvements, 120+ bugs fixed and more

我们很高兴地宣布Manticore Search 6.3.0的发布！此版本带来了大量增强功能、新功能和更新，使您的搜索引擎更加强大且用户友好。

### 向量搜索

- **浮点向量数据类型**：我们引入了[float_vector](https://manual.manticoresearch.com/Creating_a_table/Data_types#Float-vector)数据类型，允许您存储和查询浮点数数组。这对于需要使用向量搜索执行相似性搜索的应用程序特别有用。
- **向量搜索功能**：结合新的数据类型，向量搜索功能使您能够执行k-最近邻（KNN）向量搜索。这对于构建更直观和响应更快的搜索功能非常理想。在博客文章[向量搜索](/blog/vector-search/)中了解更多。

<a href="/blog/vector-search/"><img src="/images/blog/manticore-search-github-semantic-search-demo.png" alt="向量搜索博客文章" style="max-width: 50%; max-height: 400px; margin: 0; padding: 0;"></a>

### JOIN（测试版）

尽管Manticore Search的JOIN功能仍处于测试版，但它代表了用户执行查询和管理数据关系方式的重大增强。[在文档中了解更多](https://manual.manticoresearch.com/Searching/Joining)。

示例：
```sql
SELECT product, customers.email, customers.name, customers.address
FROM orders
LEFT JOIN customers
ON customers.id = orders.customer_id
WHERE MATCH('maple', customers)
ORDER BY customers.email ASC;

+----------+-------------------+----------------+-------------------+
| product  | customers.email   | customers.name | customers.address |
+----------+-------------------+----------------+-------------------+
| Phone    | NULL              | NULL           | NULL              |
| Monitor  | NULL              | NULL           | NULL              |
| Keyboard | NULL              | NULL           | NULL              |
| Laptop   | alice@example.com | Alice Johnson  | 123 Maple St      |
| Tablet   | alice@example.com | Alice Johnson  | 123 Maple St      |
+----------+-------------------+----------------+-------------------+
5 rows in set (0.00 sec)
```

### REGEX

新的[REGEX运算符](https://manual.manticoresearch.com/Searching/Full_text_matching/Operators#REGEX-operator)显著改进了您搜索复杂文本模式的方式。此功能在需要非常精确搜索结果的领域尤为重要，例如分析专利、审查合同和搜索商标。

例如，在数据分析中，REGEX运算符可以帮助在日志文件或代码中查找特定的错误代码或编程模式。在学术研究中，它使查找使用特定引用样式的文章变得更加容易。对于商标搜索，此工具非常适合发现完全相同或非常相似的商标。此增强功能使Manticore Search在处理详细和复杂搜索时更加强大和精确。

在[博客文章](/blog/regexp/)中了解更多：
<a href="/blog/regexp/"><img src="/images/blog/Regexp_for_blog.png" alt="REGEXP博客文章" style="max-width: 50%; max-height: 400px; margin: 0; padding: 0;"></a>

示例：
```sql
SELECT * FROM brands WHERE MATCH('"REGEX(/(c|sea).*crest/) REGEX(/flo(we|u)r/)"')
+---------------------+-----------------+
| id                  | name            |
+---------------------+-----------------+
| 1515699435999330620 | SeaCrest Flower |
| 1515699435999330621 | C-Crest Flour   |
| 1515699435999330622 | CCrest Flower   |
+---------------------+-----------------+
```

### Range()和histogram()
新的[RANGE函数](https://manual.manticoresearch.com/Searching/Faceted_search#Facet-over-set-of-ranges)增强了聚合、分面和分组功能，通过将值分类到指定的区间中。这些区间使用`range_from`和`range_to`定义，确定值所属的边界。此功能允许根据用户定义的范围对数据进行有效的排序和分析。

示例：
```sql
 select * from test;
+---------------------+-----------+-------+
| id                  | data      | value |
+---------------------+-----------+-------+
| 8217240980223426563 | Product 1 |    12 |
| 8217240980223426564 | Product 2 |    15 |
| 8217240980223426565 | Product 3 |    23 |
| 8217240980223426566 | Product 4 |     3 |
+---------------------+-----------+-------+

SELECT COUNT(*), RANGE(value, {range_to=10},{range_from=10,range_to=25},{range_from=25}) price_range FROM test GROUP BY price_range ORDER BY price_range ASC;
+----------+-------------+
| count(*) | price_range |
+----------+-------------+
|        1 |           0 |
|        3 |           1 |
+----------+-------------+
```

Manticore Search中的[HISTOGRAM()](https://manual.manticoresearch.com/Searching/Faceted_search#Facet-over-histogram-values)函数根据指定的桶大小将数据分类到桶中。它使用`hist_interval`和`hist_offset`参数确定适当的桶，并通过测量从桶起始点的距离（调整为间隔大小）来计算桶键。此功能对于创建直方图特别有用，直方图将数据分组到特定值范围中，以便于分析和可视化。

示例：
```sql
select count(*), histogram (value, {hist_interval=10}) as price_range from test GROUP BY price_range ORDER BY price_range ASC;
+----------+-------------+
| count(*) | price_range |
+----------+-------------+
|        1 |           0 |
|        2 |          10 |
|        1 |          20 |
+----------+-------------+
```

还有[date_range](https://manual.manticoresearch.com/Searching/Faceted_search#Facet-over-set-of-date-ranges)和[date_histogram](https://manual.manticoresearch.com/Searching/Faceted_search#Facet-over-histogram-date-values)用于类似的时间数据聚合。

### 新命令简化数据更新和模式管理

* [ALTER TABLE ... type='distributed'](https://manual.manticoresearch.com/Updating_table_schema_and_settings#Changing-a-distributed-table)允许您在不先删除它的情况下更改分布式表。
* [CREATE TABLE ... LIKE ... WITH DATA](https://manual.manticoresearch.com/Creating_a_table/Local_tables/Real-time_table#CREATE-TABLE-LIKE:)使复制实时表及其所有数据变得容易。
* 使用[REPLACE INTO ... SET](https://manual.manticoresearch.com/Data_creation_and_modification/Updating_documents/REPLACE#SQL-REPLACE)来更新表中记录的部分内容。
* [将一个实时表附加到另一个表](https://manual.manticoresearch.com/Data_creation_and_modification/Adding_data_from_external_storages/Adding_data_to_tables/Attaching_one_table_to_another#Attaching-one-table-to-another)将两个表合并为一个。
* 使用[ALTER TABLE ... RENAME](https://manual.manticoresearch.com/Updating_table_schema_and_settings#Renaming-a-real-time-table)重命名实时表，以保持数据库的整洁。

### 与复制相关的更改

在复制领域进行了重大更改，以改进节点之间数据传输的过程。已修复了传输大文件时的复制错误，添加了重试命令执行的机制，并改进了复制期间的网络管理。还解决了复制期间的阻塞和属性更新问题，并为加入集群的节点添加了跳过复制更新命令的功能。所有这些更改允许在各种使用场景中提高复制过程的效率和可靠性。

有关更改的详细信息，请参见[此处](https://manual.manticoresearch.com/Changelog#Replication-related-changes)。

### 许可证变更和性能优化

我们已将 Manticore Search 的许可证更改为 GPLv3-or-later。这种新许可证为用户提供了更好的法律保障，并且与其他开源许可证的兼容性更好。这一变更体现了我们致力于满足社区需求并保持开源软件强大的决心。在 6.3.0 版本中，我们添加了 Apache 2 许可的 [CCTZ 库](https://github.com/google/cctz)，这使得日期/时间函数的速度大幅提升。请看改进效果：

之前：
```sql
mysql> select count(*),year(time_local) y, month(time_local) m from logs10m where y>2010 and m<5;
+----------+------+------+
| count(*) | y    | m    |
+----------+------+------+
| 10365132 | 2019 |    1 |
+----------+------+------+
1 row in set (8.26 sec)
```

现在：
```sql
mysql> select count(*),year(time_local) y, month(time_local) m from logs10m where y>2010 and m<5;
+----------+------+------+
| count(*) | y    | m    |
+----------+------+------+
| 10365132 | 2019 |    1 |
+----------+------+------+
1 row in set (0.11 sec)
```
查询速度现在提高了 75 倍。

我们还改进了表的压缩方式。以前在合并磁盘块时，Manticore 会从任何包含已删除文档的块中移除这些文档，消耗大量资源。我们已停止使用这种方法。现在，合并块仅由 [progressive_merge](https://manual.manticoresearch.com/Server_settings/Common#progressive_merge) 设置管理，使该过程更简单且对资源消耗更少。

### Ubuntu Noble 24.04
Ubuntu Noble 24.04 现在已获得支持。
<img src="./manticore-search-6-3-0/ubuntu_noble.jpg" alt="Noble" style="max-width: 50%; max-height: 400px; margin: 0; padding: 0;">


### 还有更多
以上提到的更新只是 Manticore 6.3.0 中包含的众多改进中的一部分。请阅读：

🚀 9 项重大变更
✅ 50 多项次要变更
🐞 120 多个错误修复

在 [更新日志](https://manual.manticoresearch.com/Changelog) 中。

我们希望您喜欢 Manticore Search 中的新功能和改进。我们欢迎您提供反馈，并鼓励您通过以下方式与我们互动：

* 在我们的 [社区论坛](https://forum.manticoresearch.com) 上发起讨论
* 在 [GitHub](https://github.com/manticoresoftware/manticoresearch/issues/new/choose) 上报告错误或提出新功能建议
* 加入我们的 [公共 Slack 聊天室](https://slack.manticoresearch.com/)
* 直接通过 `contact@manticoresearch.com` 邮件联系我们
