blog-post

Mike learning: REPLACE, UPDATE, wordforms

About me

Mike

नमस्ते, यह फिर से Mike है।

मैंने हाल ही में Manticore में एक Developer Advocate के रूप में काम करना शुरू किया है। मैं IT से पूरी तरह दूर नहीं हूँ, लेकिन मैं आधुनिक तकनीकों के साथ पीछे नहीं रह रहा। इस ब्लॉग में, मैं अपने अनुभव और Manticore के बारे में जो मैं सीखता हूं, साझा करूंगा। मैं अपने सफर को एक डायरी प्रारूप में दस्तावेज करने की योजना बनाता हूं, यह बताते हुए कि Manticore क्या है और इसका उपयोग कैसे करें। चलो देखते हैं कि चीजें कैसे मिलती हैं, समस्याओं की पहचान करते हैं, और डेवलपर्स के साथ वास्तविक समय में बातचीत करते हैं।

यह मेरा दूसरा ब्लॉग पोस्ट है। यदि आप मेरे साथ Manticore के बारे में सीखने में रुचि रखते हैं, तो मैं आपको निम्नलिखित में अपडेट रखूंगा:

Step two: REPLACE, UPDATE, wordforms

जब मैं अपना पहला लेख लिख रहा था, तो मेरे पालतू जानवरों की दुकान के दोस्तों ने मुझसे संपर्क किया। वे अपने स्टोर के लिए डेटाबेस का उपयोग करना चाहते हैं, और चूंकि उनका विक्रेता अभी भी पट्टों और हार्नेस के साथ भ्रमित हो रहा है, मैं डेटाबेस की अतिरिक्त सुविधाओं को लागू करना चाहता हूं।

यह लेख पिछले एक का एक विस्तार है और इसी पर आधारित है।

अधिकतर डेटाबेस के विपरीत, Manticore एक उन्नत मॉडल का उपयोग करता है ताकि यह पहचान सके कि वह कौन से टेक्स्ट को संग्रहीत करता है। टेक्स्ट प्रोसेसिंग सिस्टम NLP (Natural Language Processing) समाधानों पर आधारित है।

यहां सामान्य समझ के लिए तकनीक का थोड़ा सा वर्णन करना गलत नहीं होगा। NLP उस “स्वाभाविक” भाषा को पहचानने के लिए डिज़ाइन किया गया है जिसमें हम संवाद करते हैं। पहली नज़र में, टेक्स्ट मान्यता में कुछ भी जटिल नहीं लग रहा है, तकनीकी रूप से यह मशीन लर्निंग एल्गोरिदम का उपयोग करने वाले टेक्स्ट प्रोसेसिंग समाधानों के आगमन के साथ ऐसा हो गया है। हमारे मामले में, हम इतनी गहराई में नहीं जाएंगे और Manticore Search से तैयार टेक्स्ट प्रोसेसिंग समाधानों का उपयोग करेंगे, जो पहले से ही डेटाबेस में बनाए गए हैं। यह प्रणाली टोकनाइजेशन (पाठ का पृथक्करण) का उपयोग करती है छोटे छोटे हिस्सों में: वाक्यों और व्यक्तिगत शब्दों के अनुसार, जो आपको डेटाबेस में समग्र रूप से इच्छित शब्दों, वाक्यांशों और अनुच्छेदों को जल्दी से खोजने की अनुमति देता है। (डेटा टोकनाइजेशन पर अधिक जानकारी के लिए, इस [लिंक] को देखें। https://manual.manticoresearch.com/Creating_a_table/NLP_and_tokenization/Data_tokenization )

यहां Manticore द्वारा उपयोग की जाने वाली प्रौद्योगिकियों के बारे में कुछ शब्द हैं:

  • स्टेमिंग वह प्रक्रिया है जिसमें शब्दों को उनके मूल रूप में कम किया जाता है। उदाहरण के लिए, “walking,” “walks,” और “walked” सभी “walk” शब्द के स्टेम हैं।
  • लेमाटाइजेशन वह प्रक्रिया है जिसमें एक शब्द के विभिन्न रूपों को उसके प्राथमिक रूप, जिसे लेमा कहा जाता है, में वापस बदल दिया जाता है। उदाहरण के लिए, “eat” शब्द “eating,” “eats,” और “ate” के रूप में प्रकट हो सकता है। इन सभी रूपों के लिए लेमा “eat” है, जो इसका बुनियादी словकोश रूप है।
  • उन्नत खोज की सटीकता और गुणवत्ता को सुधारने के लिए, कार्य में कई अन्य समाधान शामिल होते हैं: वर्ड फॉर्म, अपवाद, और स्टॉप वर्ड।

लेमाटाइज़र और स्टेमर सामान्य रूप से शब्दों को एक समान रूप में सामान्य बनाने का एक सामान्य कार्य करते हैं, लेकिन विभिन्न तरीकों से, जिनमें से प्रत्येक के अपने फायदे और नुकसान होते हैं।

इसके अलावा, चुने हुए भाषा के लिए सामान्य शब्दों की सूचियों के साथ स्टॉपवर्ड फ़ाइलें, जैसे कि लेख, संयोजक, और विस्मयादिबोधक, प्रक्रिया को तेज करने में मदद करती हैं। मूलतः, वे सभी छोटे शब्द जो हमारी भाषा को अच्छा सुनने में मदद करते हैं लेकिन वास्तव में कंप्यूटर के लिए ज्यादा अर्थ नहीं रखते हैं।

यदि मानक फ़ंक्शनों का सेट खोज इंजन के आरामदायक संचालन के लिए पर्याप्त नहीं है, उदाहरण के लिए, जब डेटाबेस में पेशेवर शब्दावली या स्थानीय स्लैंग हो, और शब्दों के बीच अतिरिक्त विचारात्मक संबंध हों, तो आप अतिरिक्त वर्ड फॉर्म फ़ाइलें का उपयोग कर सकते हैं। डेटाबेस प्रशासक फ़ाइल में शब्दों के बीच लिंक जोड़ सकता है जो परिभाषा नियमों के हिसाब से भिन्न होते हैं लेकिन इस डेटाबेस में संदर्भ में समान होते हैं। उदाहरण के लिए, पट्टा और हार्नेस। विभिन्न संदर्भों में, ये दो शब्द समान अर्थ रख सकते हैं या पूरी तरह भिन्न हो सकते हैं।

Using a word forms file in a table

New tables

पालतू जानवरों की दुकान के लड़कों ने बताया कि उनका विक्रेता पट्टों और हार्नेस के बारे में बहुत जानकार नहीं है। वे सुझाव देते हैं कि जब पट्टा पूछने के लिए कहा जाता है, तो हार्नेस के बारे में पूछने पर भी विचार करना चाहिए, और इसके विपरीत।

चूंकि पट्टे और हार्नेस एक ही उत्पाद श्रेणी के अंतर्गत आते हैं और डेटाबेस में उनके समूह को इंगित करने के लिए कोई विशेष क्षेत्र नहीं है, इसलिए वर्ड फॉर्म फ़ाइल का उपयोग फायदेमंद हो सकता है। यह फ़ाइल “पट्टा” को खोजने के समय संबंधित शब्दों को जोड़ने की अनुमति देकर मदद कर सकती है। उदाहरण के लिए, “हैर्नेस” या “फ्लेक्सी” जैसे शब्दों को वर्ड फॉर्म डिक्शनरी में जोड़कर, “पट्टा” के लिए खोज करने पर “हैर्नेस” और “फ्लेक्सी” के लिए भी परिणाम प्राप्त होंगे।

आइए इस पालतू जानवरों की दुकान में उपलब्ध उत्पादों की जांच करते हैं:

TitleDescriptionPriceAvailability
Canvas leash, green, up to 50 kg, 5mमजबूत कैनवास कुत्ते का पट्टा 5 मीटर के लिए, बड़े कुत्तों की नस्लों के लिए उपयुक्त5.00€yes
Elastic leash, pink, up to 10 kg, 3mएक सुंदर पट्टा sofisticated लेडीज़ और उनके चार-पैर वाले साथी के लिए12.00€no
गुलाबी हार्नेस, 10 किलोग्राम तककमरे के गार्ड जिन्हें सड़क पर छोड़ दिया गया और गलती से कुत्ता कहा गया 8.00€हाँ
फ्लेक्सी रिट्रैक्टेबल कुत्ते की पट्टी, 10 किलोग्राम, 5 मीटरकुत्तों के लिए 10 किलोग्राम तक का फ्लेक्सी। लंबाई 5 मीटर है, मालिक के खींचे गए हाथ की लंबाई को ध्यान में रखते हुए7.50€हाँ
कुत्ते का खाना, 1 किलोग्रामआपके पालतू जानवर के लिए सूखा खाना4.30€नहीं
बिल्ली का खाना, 1 किलोग्रामअगर आपकी बिल्ली जोर से चिल्ला रही है और खाना मांग रही है! 2.80€हाँ
बिल्लियों के लिए फ्ली कॉलरबिल्लियों को फ्ली कैरियर्स नहीं होना चाहिए।23.20€हाँ
10 किलोग्राम तक के कुत्तों के लिए फ्ली ड्रॉपआपके रक्षक की त्वचा पर अनचाहे यात्रियों से ड्रॉप14.30€हाँ

हम Title क्षेत्र को केवल एक स्ट्रिंग बनाएंगे, Description का उपयोग फुल-टेक्स्ट सर्च के लिए करेंगे, Price को एक फ्लोटिंग-पॉइंट संख्या के रूप में सेट करेंगे, और Availability को एक बूलियन मान के रूप में।

“पट्टियों,” “हार्नेस,” और “फ्लेक्सी” के बीच एक तार्किक शब्द संबंध बनाने के लिए, हम उन्हें /tmp/wordforms/ में एक फ़ाइल में रखेंगे और सुनिश्चित करेंगे कि यह सिस्टम पर सभी उपयोगकर्ताओं के साथ साझा है।

mkdir /tmp/wordforms
cd /tmp/wordforms
mcedit wf_pet_products.txt

MC में अंतर्निहित संपादक को mcedit कहा जाता है। इसे निष्पादित करने के लिए, टाइप करें mcedit <file name>

आइए हम वहाँ अपने शब्द रूप जोड़ें:

flexi > leash
harness > leash

यदि आप सब कुछ सही करते हैं, तो आपको अपनी टर्मिनल में ऐसा कुछ दिखाई देगा:
Terminal view
F2 सहेजें
Enter पुष्टि करें
F10 बाहर निकलें

अब हमारे पास एक फ़ाइल है जिसके शब्द हम बाद में नई तालिका के साथ उपयोग करेंगे। याद रखें या नोट करें कि इसे कहाँ सहेजा गया है:

/tmp/wordforms/wf_pet_products.txt

अब, डेटाबेस में अधिक परिवर्तन करने के लिए, हमें इससे कनेक्ट करना होगा और अपने कॉलम के साथ एक तालिका सेटअप करनी होगी। फिर, हमें एक स्टेमर और पहले बनाए गए शब्द रूप फ़ाइल को लिंक करना होगा:

mysql -h0 -P9306
CREATE TABLE products (name STRING, info TEXT, price FLOAT, avl BOOL) morphology = 'stem_en' wordforms='/tmp/wordforms/wf_pet_products.txt';

अब चलिए हम चेक करते हैं कि हमारी तालिका में कौन-कौन से फ़ील्ड बनाए गए हैं:

DESC products;

DESC results

सभी फ़ील्ड जो हमनें निर्दिष्ट की हैं मौजूद हैं, लेकिन एक अतिरिक्त फ़ील्ड उभर आई है - id। यह फ़ील्ड मैन्टिकोरे को डेटाबेस में किसी दस्तावेज़ की अनूठी पहचान करने के लिए है, इसलिए इसे स्वचालित रूप से तब बनाया जाता है जब तालिकाएँ आरंभ की जाती हैं, चाहे वह निर्दिष्ट किया गया हो या नहीं। जानकारी फ़ील्ड के पास indexed stored गुण होते हैं, जो इसके फुल-टेक्स्ट सर्च प्रक्रिया में शामिल होने को दर्शाते हैं। ध्यान रखना महत्वपूर्ण है कि फ़ील्ड का क्रम तालिका बनाने के समय निर्दिष्ट अनुक्रम से भिन्न है। इसलिए, तालिका में डेटा भरते समय, इसे ध्यान में रखना होगा, विशेष रूप से जब पूरे पंक्तियों को बिना कमांड में फ़ील्ड अनुक्रम निर्दिष्ट किए अपडेट करना हो। उदाहरण के लिए, REPLACE कमांड में, जिसके बारे में हम थोड़ी देर में चर्चा करेंगे।

अगला, हमें तालिका के सामान्य पैरामीटर को सत्यापित करना चाहिए, जैसे कि शब्द रूप फ़ाइल और पहले से जुड़े स्टेमर। जब तालिका बनाई जाती है, यदि शब्द रूप फ़ाइल का नाम गलत है, तो सिस्टम इसे अनदेखा करेगा और कोई त्रुटियाँ या चेतावनियाँ नहीं देगा।

SHOW TABLE products SETTINGS;

Show table products settings result

उपरोक्त में, आप देख सकते हैं कि यद्यपि हमने /tmp/wordforms/ में फ़ाइल के लिए पथ निर्दिष्ट किया, मैन्टिकोरे ने इसे /var/lib/manticore/products/ में सहेजा है। यह दिखाता है कि मैन्टिकोरे ने तालिका बनाई गई फ़ाइल की एक प्रति संलग्न की है। फ़ाइल अब इस तालिका के अनुक्रमण के लिए स्थिर है। शब्द रूप फ़ाइल को लाइव में बदलना डिज़ाइन द्वारा उपलब्ध नहीं है, क्योंकि इससे पूरी तालिका को पुनः अनुक्रमित करने की आवश्यकता होगी, जो यदि आपके पास बहुत बड़ी तालिका है तो यह वांछनीय नहीं हो सकता है। हम बाद में चर्चा करेंगे कि ऐसी फ़ाइल को सुरक्षित और पूर्वानुमान योग्य तरीके से कैसे बदला जाए।

यह तालिका सेटअप समाप्त करता है, और अगला कदम आवश्यक डेटा दर्ज करना है। डेटा प्रविष्टि किसी भी SQL डेटाबेस के समान ढंग से की जाती है।

INSERT INTO products (name, price, avl) VALUES ('Canvas leash, green, up to 50 kg, 5m', 5.0, 1);
INSERT INTO products (name, price, avl, info) VALUES ('Elastic leash, pink, up to 10 kg, 3m', 12.00, 0, 'A beautiful leash for sophisticated ladies and their four-legged companions');
INSERT INTO products (name, price, avl, info) VALUES ('Pink harness, up to 10 kg', 8.00, 1, 'For room guards released into the street and mistakenly called a dog');
INSERT INTO products (name, price, avl, info) VALUES ('The flexi retractable dog leash, 10 kg, 5m', 7.50, 1, 'A flexi for dogs up to 10 kg. The length is 5 meters, taking into account the length of the owner\'s pulled out arm');
INSERT INTO products (name, price, avl, info) VALUES ('Dog food, 1kg', 4.30, 0, 'Dry food for your pet');
INSERT INTO products (name, price, avl, info) VALUES ('Cat food, 1kg', 2.80, 1, 'If your cat is yelling loudly and demanding food!');
INSERT INTO products (name, price, avl, info) VALUES ('Flea collar for cats , 1kg', 23.20, 1, 'Cats shouldn\'t be flea carriers.');
INSERT INTO products (name, price, avl, info) VALUES ('Flea drops for dogs up to 10 kg', 14.30, 1, 'Drops from uninvited passengers on the skin of your defender');

अपराधियों के साथ सावधान रहें; पाठ में ऐसे संक्षिप्त रूप हैं जो उनका उपयोग करते हैं, और यह महत्वपूर्ण है कि उन्हें बाकी पाठ से \ के साथ अलग करना हो: 'Isn\'t it'। मैन्टिकोरे डबल कोट्स के लिए समर्थन नहीं करता है, जो एकल अपराधियों को बचाने के लिए उपयोगी होगा।

In the first request above, the info field was intentionally omitted to demonstrate how to update a full-text field. It’s important to note that updating text fields and attribute fields is handled differently. Full-text fields are updated with the REPLACE command, which triggers reindexing of the new values, while the UPDATE command is sufficient for other fields. This is because attribute fields are not involved in the full-text search indexing process.

अब, आइए मौजूदा रिकॉर्ड के कुछ फील्ड में डेटा जोड़ने के लिए REPLACE कमांड का उपयोग करें। इस कमांड का उपयोग करने के लिए, आपको उस पंक्ति की अद्वितीय ID चाहिए जहां हम परिवर्तन करना चाहते हैं या जानकारी जोड़ना चाहते हैं। सबसे पहले, हम SELECT * FROM products का उपयोग करके आवश्यक डेटा प्राप्त करेंगे;

SELECT * FROM products WHERE name = 'Canvas leash, green, up to 50 kg, 5m';

Result of select * from products where name&hellip;

यह सुनिश्चित करें कि आप जानते हैं कि फील्ड कहाँ स्थित हैं। हमें इस जानकारी की बाद में आवश्यकता होगी। इसके अलावा, हमें फील्ड में सभी वर्तमान डेटा की आवश्यकता है क्योंकि रिप्लेस कमांड इस डेटा के साथ पूरे फ़ाइल को अपडेट करेगी। यदि हम सभी डेटा निर्दिष्ट नहीं करते हैं, तो निर्दिष्ट नहीं किए गए फील्ड रिसेट हो जाएंगे। फील्ड स्थानों के आधार पर REPLACE कमांड भरें।

REPLACE INTO products VALUES (<id>, <info>, <avl>, <price>, <name>);

विकास संस्करण में, जो कि जब आप इसे पढ़ रहे होंगे तब पहले से ही जारी हो सकता है, विशिष्ट फील्ड को बदलना संभव है। अधिक जानकारी के लिए, दस्तावेज़ देखें।

REPLACE INTO products VALUES (8217224102746783745, 'Sturdy canvas dog leash for 5 meters, suitable for large dog breeds', 1, 5.0, 'Canvas leash, green, up to 50 kg, 5m');

यहाँ कोड के साथ सावधान रहें, यदि आप लेख से बस कमांड कॉपी करते हैं, तो आपके तालिका में ID फील्ड का मान भिन्न होगा! यदि Manticore निर्दिष्ट ID के साथ कोई रिकॉर्ड नहीं पाता है, तो एक नया रिकॉर्ड बनाया जाएगा।

“attributes” फील्ड को अपडेट करने के लिए, आप UPDATE कमांड का उपयोग कर सकते हैं। बस एक संदर्भ के रूप में, डेटा दर्ज करते समय, हरी पट्टा की कीमत थोड़ी गिर गई थी:

update products set price = 4.6 where id = 8217224102746783745;

आइए परिणाम की जांच करें:

SELECT * FROM products WHERE id = 8217224102746783745;

Printscreen of query &lsquo;where id&rsquo; result

हमने इच्छित परिणाम प्राप्त कर लिया है, अब चलिए खोज करने की कोशिश करें, क्योंकि हम दुकान के लिए उत्पादों का डेटाबेस बना रहे हैं, ताकि विक्रेता के लिए उत्पाद खोजना आसान हो सके। तालिका में खोज करने के लिए उपयोग की जाने वाली कमांड है select * from <table> where match('<query>')

SELECT * FROM products WHERE match('harness');
SELECT * FROM products WHERE match ('leash');

Query result for &lsquo;roulette&rsquo;

अद्भुत, अब डेटाबेस हमारे प्रश्नों के उत्तर दे रहा है, उस कनेक्शन का उपयोग करते हुए जो हमने शब्द फॉर्म फ़ाइल के माध्यम से बनाया था। लेकिन ऐसा लगता है कि आउटपुट में कुछ गायब है? इनडोर गार्ड के लिए गुलाबी पट्टा का प्रवेश कहां है?
info फील्ड में, पट्टा या कॉलर जैसे शब्द नहीं हैं, वे केवल name फील्ड में दिखाई देते हैं, इसलिए वह प्रविष्टि आउटपुट में नहीं आई। चलो इसे ठीक करते हैं:

SELECT * FROM products WHERE name = 'Pink harness, up to 10 kg';

Query result from &ldquo;pink harness&rdquo;

REPLACE INTO products VALUES (8217224102746783747,'Harness for room guards released into the street and mistakenly called a dog', 1, 8.0, 'Pink harness, up to 10 kg');

आइए देखें कि क्या हुआ:

SELECT * FROM products WHERE match('harness');

Query result &lsquo;harness&rsquo; after table update
अब यह रिकॉर्ड आउटपुट में शामिल है। जैसा कि आप उदाहरण से देख सकते हैं, केवल अनुक्रमित फील्ड से संबंधित जानकारी खोज में शामिल होती है; शेष फील्ड अनुक्रमित फील्ड के लिए विशेषताएँ होती हैं।

तालिका का विस्तार

पेट स्टोर में नए सामान लाए गए हैं, अब उनके पास एक्वेरियम उपकरण भी है। यह सुनिश्चित करने के लिए कि हम एक्वेरियम सामान से संबंधित शब्द जैसे पंप या ड्राइव को आसानी से खोज सकें, हमें अपनी शब्द सूची में प्रविष्टियाँ जोड़ने की आवश्यकता है।

TitleDescriptionPriceAvailability
The pump for the aquarium.A pump with a built-in filter for the aquarium. Capacity 150 l/h32.00€yes
Automatic filter for aquariumDisposable drive with filter, capacity 100 l/h.28.00€yes
Fish netAtraumatic aquarium fish net3.00€yes

आइए उन्हें डेटाबेस में जोड़ते हैं:

INSERT INTO products (name, info, price, avl) VALUES ('The pump for the aquarium.', 'Pump with built-in aquarium filter. Capacity 150 l/h', 32, 1), ('Automatic filter for aquarium', 'Disposable drive with filter, capacity 100 l/h', 28.00, 1), ('Fish net', 'Atraumatic aquarium fish net', 3, 1);

यहाँ हमने एक कमांड के साथ एक कट-ऑफ सूची के साथ भराई की, इसलिए आप एक कमांड के साथ कई दस्तावेज़ों का एक बड़ा बैच जोड़ सकते हैं।

आइए खोज की जांच करें:

SELECT * FROM products WHERE match ('pump');
SELECT * FROM products WHERE match ('filter');

Query result &lsquo;pump&rsquo; and &lsquo;filter

ठीक है, इसका मतलब कुछ है। हालांकि, ड्राइव को पंप नहीं माना गया है। इसे हम जिन शब्दों की सूची में जोड़ते हैं, वह जोड़ा जाना चाहिए…
आइए इसे करें।
ओह, यहाँ एक छोटी समस्या है। यह इतना आसान नहीं है…
When we create a search system for text, we place all the words into a table and convert them into tokens to enhance the efficiency of the search. These tokens are not updated subsequently to expedite the search process. Nevertheless, there are cases when we need to update the wordforms file and consequently modify the tokens as well. Let’s update the list of words in our wordforms file and also include the product name in the name field to the search index.

To update the wordforms file in the table, I followed these steps:

  1. Create a dump of this table using mysqldump.
  2. Update the wordforms file.
  3. Drop the old table.
  4. Create a new table with the updated word forms in the morphology section.
  5. Populate the new table from the dump file.
Creating dump file (backup):

In any unclear situation, make a backup of the table to prevent data loss. (This rule can be displayed on the wall as a reminder).
This also helps us reach our goal.
To do this job, we need to disconnect from the SQL connection and use the mysqldump tool.

exit;
mkdir /tmp/manticore_dumps
cd /tmp/manticore_dumps
mysqldump -h0 -P9306 -tc --compact manticore products > products.sql

The flags I used were:

  • -t - to exclude the create table statement from the dump.
  • -c - to specify column names in the INSERT commands.
  • --compact - to perform a database dump in a compact format, which omits procedures for checking the availability of tables, deleting them, creating new ones, prescribing configurations for created tables, and other organizational actions for deployment. In our case, these procedures were not necessary, as we needed to register a new dictionary file in the table.
  • manticore - is the database name for mysqldump, and must always be manticore when using mysqldump with Manticore.
  • products - is the name of our table for which the dump is being created.
  • products.sql - is the name of the file where the dump will be uploaded. The directory for placing the file defaults to the directory from which mysqldump was launched. I recommend specifying /tmp/ to ensure the examples work successfully further. Alternatively, you can type the full path: /tmp/manticore_dumps/products.sql.

Don’t worry if you see: “– Warning: column statistics not supported by the server.” It’s normal when you use this mysql tool with Manticore.

Great, we have our first dump!
Product&rsquo;s dump in folder

Updating wordforms file:

Have you forgotten where the source file for the word forms is located?

cd /tmp/wordforms

If you are using MC and for some reason do not see columns with files, try using the Ctrl + O combination. If nothing changes, perhaps MC is not running.

Wordforms location
Next, use the arrow keys to navigate. When you need to select a file, press F4 to open the selected file.
Add new string: “drive > pump”
Wordforms file with added string
Save & close. F2, Enter, F10.
File updated.

Deleting the table and creating a new one:

Before deleting the table, please make sure that you have the dump and that it definitely contains our data.

cd /tmp/manticore_dumps/

Choose the dump file and press the F3 button to view it.
You can do the same in the console using the command cat /tmp/manticore_dumps/products.sql.

You should see something like this:
Dump view

OK, let’s go ahead and drop our old table and create a new one:

mysql -h0 -P9306
DROP TABLE products;
CREATE TABLE products (name TEXT, info TEXT, price FLOAT, avl BOOL) morphology = 'stem_en' wordforms='/tmp/wordforms/wf_pet_products.txt';

So, we removed this table, and then made it again right away (using the same command as before but with a small change: now the name field is also for text), and now we have to add information to it.

exit;
Repopulating from the dump:
mysql -h0 -P9306 < /tmp/manticore_dumps/products.sql
mysql -h0 -P9306

We filled it out. Let’s check what we have in the end:

SELECT * FROM products WHERE match ('pump');

Great, all working!
Result after update wordforms &ldquo;select * &hellip; mathc(&lsquo;pump&rsquo;)&rdquo;

When updating a table, especially a large one, there is a period when the old table has been deleted and the new one has not yet been created. During this interval, the system may respond to requests with errors. To ensure smooth operations on Manticore, there are several systems in place that help avoid losing user requests. I will learn how to implement that later.

In this article, I showed how I set up and used Manticore Search for a pet store’s inventory. Using wordforms and morphology, Manticore helps improve search results by linking related product names and types. I covered how I added new items, updated existing ones, and ensured data consistency during major updates like changing wordforms files. This helps beginners understand and apply Manticore Search’s features effectively, making data searches more efficient. Future posts will explore more features, so let’s keep experimenting with Manticore together to enhance your projects.

That’s all for today. Mike, signing off.

end photo

मैंटीकोर सर्च इंस्टॉल करें

मैंटीकोर सर्च इंस्टॉल करें