Manticore offers limited support for PHPStorm. In this article, I will outline the fundamental steps for configuring the IDE to work with Manticore. I am using IDE version 2023.2.4; support may not be available in earlier or later versions.
Initialization
- Launch Manticore Search. For example, let’s use Docker:
docker run -p 9306:9306 --name manticore --rm -d manticoresearch/manticore:dev-6.2.13-cbf9350
- Now we need to configure the data source. For this, we will use the MySQL driver that supports Manticore Search. Open the plugin
Database -> New -> Data Source -> MySQL
and complete thePort
andAuthentication
fields as shown below: - Click on the
Test Connection
button to ensure the source is configured correctly. - After saving the configuration, the database tab will display the interface for working with Manticore Search.
Using Manticore Search in PHPStorm
Create tables
For creating tables, it’s preferable to use the console Ctrl+Shift+F10
create table products(title text, price float) morphology='stem_en';
In case you decide to use the UI, remove the Manticore.products
database from the table creation command, leaving only products
.
INSERT
To insert data into Manticore via PHPStorm, you can use the console and the UI:
Console
insert into products(title, price) values ('Crossbody Bag with Tassel', 19.85), ('microfiber sheet set', 19.99), ('Pet Hair Remover Glove', 7.99);
# 3 rows affected in 18 ms
UI
Set the id
value to 0
instead of the default null
if you want the id to be auto-generated.
Upon opening the table, you can see the data that was just added.
SELECT
It’s better to use the console for SELECTs since the MATCH()
SQL statement has a different format in MySQL, and the UI considers it erroneous.
select * from products where match('pet')
UPDATE
Updates should only be performed in the console.
update products set price=18.5 where id = 8217058505249521668;
# 1 row affected in 12 ms
DELETE
Deletions can only be done through the console.
delete from products where id = 8217058505249521668;
# 1 row affected in 12 ms
PQ
Percolate queries support is also implemented only at the console level.
- Create pq table
CREATE TABLE pq_table(title text, color string) type='pq';
- Populate with data
INSERT INTO pq_table(query) values('@title bag');
INSERT INTO pq_table(query,filters) values('@title shoes', 'color=\'red\'');
INSERT INTO pq_table(query,filters) values('@title shoes', 'color in (\'blue\', \'green\')');
select * from pq_table;
- Run
CALL PQ
command
CALL PQ('pq_table', 'What a nice bag', 0 as docs_json);
Conclusion
In conclusion, integrating Manticore Search with PHPStorm, particularly the 2023.2.4 version, is a straightforward yet nuanced process. It is important to remember that Manticore Search, while accessible through MySQL IDEs like PHPStorm, is not MySQL itself. This distinction brings certain limitations in how the IDE interacts with Manticore Search.