blog-post

Manticore Search PHPStorm support

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

  1. 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
  1. 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 the Port and Authentication fields as shown below:
    Fill data source
  2. Click on the Test Connection button to ensure the source is configured correctly.
    Check Connection
  3. After saving the configuration, the database tab will display the interface for working with Manticore Search.
    Database after source configuration

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.
Insert via ui

Upon opening the table, you can see the data that was just added.
Inserted data example.png

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')

Select with match operator

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.

  1. Create pq table
CREATE TABLE pq_table(title text, color string) type='pq';
  1. 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;

PQ select

  1. Run CALL PQ command
CALL PQ('pq_table', 'What a nice bag', 0 as docs_json);

Call PQ

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.

Install Manticore Search

Install Manticore Search