Magento 2.2.5: How Cms Page Search Work? The Next CEO of Stack OverflowHow does Magento 2...
Can I equip Skullclamp on a creature I am sacrificing?
Why is there a PLL in CPU?
Describing a person. What needs to be mentioned?
Are there languages with no euphemisms?
How to write papers efficiently when English isn't my first language?
When airplanes disconnect from a tanker during air to air refueling, why do they bank so sharply to the right?
Return the Closest Prime Number
Rotate a column
Why do remote companies require working in the US?
Fastest way to shutdown Ubuntu Mate 18.10
Implement the Thanos sorting algorithm
Whats the best way to handle refactoring a big file?
Opposite of a diet
Is HostGator storing my password in plaintext?
How long to clear the 'suck zone' of a turbofan after start is initiated?
Why did we only see the N-1 starfighters in one film?
How should I support this large drywall patch?
Why didn't Khan get resurrected in the Genesis Explosion?
Should I tutor a student who I know has cheated on their homework?
Text adventure game code
Why does C# sound extremely flat when saxophone is tuned to G?
Increase performance creating Mandelbrot set in python
Why does standard notation not preserve intervals (visually)
Inappropriate reference requests from Journal reviewers
Magento 2.2.5: How Cms Page Search Work?
The Next CEO of Stack OverflowHow does Magento 2 Search work with '-'?Magento 2.1: Not add table into databaseMagento 2 : How to Fetch CMS Page Content Using SearchMagento 2 Add new field to Magento_User admin formI have created an extension to show Customer Company Name in Order grid. But when creating new order, order is not showing in order gridMagento 2.2.5: Search Wish ListMagento 2.2.5 Product attribute “use in search” RESETTING after index:reindexMagento 2.2.5: How Search In Category Product Work?Magento 2.2.5: About Search FullTextMagento 2.2.5 Fatal Error in Category and Search Page
Like i said in the title, i dont know how the Search in Catalog work.
As far as i know, the Search is render through this code in this ui-component:
C:xampphtdocsmagentovendormagentomodule-cmsviewadminhtmlui_componentcms_page_listing.xml
<filterSearch name="fulltext"/>
And when i copy this code and paste to my ui-component, it doesn't work at all, i can render the search text box, but when i write something and push "Enter", nothing happened.
EDIT 1:
(Here is my ui-component, InstallSchema and UpgradeSchema file)
File : C:xampphtdocsmagentoappcodeAhtBannerSliderviewadminhtmlui_componentbanner_form.xml
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
<argument name="data" xsi:type="array">
<item name="js_config" xsi:type="array">
<item name="provider" xsi:type="string">banner_form.banner_form_data_source</item>
</item>
<item name="label" xsi:type="string" translate="true">General Information</item>
<item name="template" xsi:type="string">templates/form/collapsible</item>
</argument>
<settings>
<buttons>
<button name="save_and_continue" class="AhtBannerSliderBlockAdminhtmlBannerEditSaveAndContinueButton"/>
<button name="save" class="AhtBannerSliderBlockAdminhtmlBannerEditSaveButton"/>
<button name="reset" class="AhtBannerSliderBlockAdminhtmlBannerEditResetButton"/>
<button name="delete" class="AhtBannerSliderBlockAdminhtmlBannerEditDeleteButton"/>
<button name="back" class="AhtBannerSliderBlockAdminhtmlBannerEditBackButton"/>
</buttons>
<namespace>banner_form</namespace>
<dataScope>data</dataScope>
<deps>
<dep>banner_form.banner_form_data_source</dep>
</deps>
</settings>
<dataSource name="banner_form_data_source">
<argument name="data" xsi:type="array">
<item name="js_config" xsi:type="array">
<item name="component" xsi:type="string">Magento_Ui/js/form/provider</item>
</item>
</argument>
<settings>
<submitUrl path="banner/manage/save"/>
</settings>
<dataProvider class="AhtBannerSliderModelBannerDataProvider" name="banner_form_data_source">
<settings>
<requestFieldName>id</requestFieldName>
<primaryFieldName>id</primaryFieldName>
</settings>
</dataProvider>
</dataSource>
<fieldset name="general">
<settings>
<label/>
</settings>
<field name="id" formElement="input">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="source" xsi:type="string">banner</item>
</item>
</argument>
<settings>
<dataType>text</dataType>
<visible>false</visible>
<dataScope>id</dataScope>
</settings>
</field>
<field name="name" sortOrder="20" formElement="input">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="source" xsi:type="string">banner</item>
</item>
</argument>
<settings>
<validation>
<rule name="required-entry" xsi:type="boolean">true</rule>
</validation>
<dataType>text</dataType>
<label translate="true">Banner Name</label>
<dataScope>name</dataScope>
</settings>
</field>
</fieldset>
</form>
File: InstallSchema.php
class InstallSchema implements MagentoFrameworkSetupInstallSchemaInterface
{
public function install(MagentoFrameworkSetupSchemaSetupInterface $setup, MagentoFrameworkSetupModuleContextInterface $context)
{
$installer = $setup;
$installer->startSetup();
if (!$installer->tableExists('banner')) {
$table = $installer->getConnection()->newTable(
$installer->getTable('banner')
)
->addColumn(
'id',
MagentoFrameworkDBDdlTable::TYPE_INTEGER,
null,
[
'identity' => true,
'nullable' => false,
'primary' => true,
'unsigned' => true,
],
'ID'
)
->addColumn(
'name',
MagentoFrameworkDBDdlTable::TYPE_TEXT,
255,
['nullable => false'],
'Name'
)
->addColumn(
'created_at',
MagentoFrameworkDBDdlTable::TYPE_TIMESTAMP,
null,
['nullable' => false, 'default' => MagentoFrameworkDBDdlTable::TIMESTAMP_INIT],
'Created At'
)->addColumn(
'updated_at',
MagentoFrameworkDBDdlTable::TYPE_TIMESTAMP,
null,
['nullable' => false, 'default' => MagentoFrameworkDBDdlTable::TIMESTAMP_INIT_UPDATE],
'Updated At')
->setComment('Banner Table');
$installer->getConnection()->createTable($table);
}
if (!$installer->tableExists('slide')) {
$table = $installer->getConnection()->newTable(
$installer->getTable('slide')
)
->addColumn(
'id',
MagentoFrameworkDBDdlTable::TYPE_INTEGER,
null,
[
'identity' => true,
'nullable' => false,
'primary' => true,
'unsigned' => true,
],
'ID'
)
->addColumn(
'banner_id',
MagentoFrameworkDBDdlTable::TYPE_TEXT,
255,
[],
'Banner Id'
)
->addColumn(
'name',
MagentoFrameworkDBDdlTable::TYPE_TEXT,
255,
['nullable => false'],
'Name'
)
->addColumn(
'url',
MagentoFrameworkDBDdlTable::TYPE_TEXT,
255,
[],
'URL'
)
->addColumn(
'image',
MagentoFrameworkDBDdlTable::TYPE_TEXT,
255,
[],
'Image'
)
->addColumn(
'created_at',
MagentoFrameworkDBDdlTable::TYPE_TIMESTAMP,
null,
['nullable' => false, 'default' => MagentoFrameworkDBDdlTable::TIMESTAMP_INIT],
'Created At'
)->addColumn(
'updated_at',
MagentoFrameworkDBDdlTable::TYPE_TIMESTAMP,
null,
['nullable' => false, 'default' => MagentoFrameworkDBDdlTable::TIMESTAMP_INIT_UPDATE],
'Updated At')
->setComment('Slide Table');
$installer->getConnection()->createTable($table);
}
$installer->endSetup();
}
}
File: UpgradeSchema.php
<?php
namespace AhtBannerSliderSetup;
use MagentoFrameworkSetupUpgradeSchemaInterface;
use MagentoFrameworkSetupSchemaSetupInterface;
use MagentoFrameworkSetupModuleContextInterface;
class UpgradeSchema implements UpgradeSchemaInterface
{
public function upgrade( SchemaSetupInterface $setup, ModuleContextInterface $context ) {
$installer = $setup;
$installer->startSetup();
if(version_compare($context->getVersion(), '1.1.0', '<')) {
if (!$installer->tableExists('banner_slide')) {
$table = $installer->getConnection()->newTable(
$installer->getTable('banner_slide')
)
->addColumn(
'id',
MagentoFrameworkDBDdlTable::TYPE_INTEGER,
null,
[
'identity' => true,
'nullable' => false,
'primary' => true,
'unsigned' => true,
],
'ID'
)
->addColumn(
'banner_id',
MagentoFrameworkDBDdlTable::TYPE_INTEGER,
null,
['nullable => false'],
'Banner ID'
)
->addColumn(
'slide_id',
MagentoFrameworkDBDdlTable::TYPE_INTEGER,
null,
['nullable => false'],
'Slide ID'
)
->addColumn(
'created_at',
MagentoFrameworkDBDdlTable::TYPE_TIMESTAMP,
null,
['nullable' => false, 'default' => MagentoFrameworkDBDdlTable::TIMESTAMP_INIT],
'Created At'
)->addColumn(
'updated_at',
MagentoFrameworkDBDdlTable::TYPE_TIMESTAMP,
null,
['nullable' => false, 'default' => MagentoFrameworkDBDdlTable::TIMESTAMP_INIT_UPDATE],
'Updated At')
->setComment('Banner Slide Table');
$installer->getConnection()->createTable($table);
}
if (!$installer->tableExists('banner_page')) {
$table = $installer->getConnection()->newTable(
$installer->getTable('banner_page')
)
->addColumn(
'id',
MagentoFrameworkDBDdlTable::TYPE_INTEGER,
null,
[
'identity' => true,
'nullable' => false,
'primary' => true,
'unsigned' => true,
],
'ID'
)
->addColumn(
'banner_id',
MagentoFrameworkDBDdlTable::TYPE_INTEGER,
null,
['nullable => false'],
'Banner ID'
)
->addColumn(
'page_url',
MagentoFrameworkDBDdlTable::TYPE_TEXT,
255,
['nullable => false'],
'Page Url'
)
->addColumn(
'created_at',
MagentoFrameworkDBDdlTable::TYPE_TIMESTAMP,
null,
['nullable' => false, 'default' => MagentoFrameworkDBDdlTable::TIMESTAMP_INIT],
'Created At'
)->addColumn(
'updated_at',
MagentoFrameworkDBDdlTable::TYPE_TIMESTAMP,
null,
['nullable' => false, 'default' => MagentoFrameworkDBDdlTable::TIMESTAMP_INIT_UPDATE],
'Updated At')
->setComment('Banner Page Table');
$installer->getConnection()->createTable($table);
}
if ($installer->tableExists('slide')){
$connection = $installer->getConnection();
$tableName = $installer->getTable('slide');
$columnName = 'banner_id';
if($connection->tableColumnExists($tableName,$columnName, $schemaName = null)){
$connection->dropColumn($tableName, $columnName, $schemaName = null);
}
}
}
$installer->endSetup();
}
}
EDIT 2 (fixed in EDIT 3):
I'm following Marius solution.
But it doesn't seem to work. It throw an error when i'm trying "php bin/magento setup:upgrade"
Installing schema... Upgrading schema... SQLSTATE[42S02]: Base table or view not found: 1146 Table 'magento.banner_name' doesn't exist, query was: DESCRIBE BANNER_NAME
So here is what i update to UpdateSchema.php.
if ($installer->tableExists('banner')){
$connection = $installer->getConnection();
$connection->addIndex(
$setup->getIdxName(
$installer->getTable('banner'),
['name'],
AdapterInterface::INDEX_TYPE_FULLTEXT
),
['name'],
['type' => AdapterInterface::INDEX_TYPE_FULLTEXT]
);
}
EDIT 3:
So i was trying Marius solution like this (the difference is i give it a table in "addIndex" function):
if ($installer->tableExists('banner')){
$connection = $installer->getConnection();
$connection->addIndex(
$installer->getTable('banner'),
$setup->getIdxName(
$installer->getTable('banner'),
['name'],
AdapterInterface::INDEX_TYPE_FULLTEXT
),
['name'],
AdapterInterface::INDEX_TYPE_FULLTEXT
);
}
Also, before i do that, i have to clear cache and delete my module in "setup_module" table, and it work
. But for some reason, when i click "x" to clear the search, it throw 2 column exactly like the same( look the image below):
1 more problem is i cant search with "c". I've read some where that "fulltext_search" cant be use with 5 or less character. So there are any solution to fix this?
magento2 cms search magento-2.2.5
|
show 4 more comments
Like i said in the title, i dont know how the Search in Catalog work.
As far as i know, the Search is render through this code in this ui-component:
C:xampphtdocsmagentovendormagentomodule-cmsviewadminhtmlui_componentcms_page_listing.xml
<filterSearch name="fulltext"/>
And when i copy this code and paste to my ui-component, it doesn't work at all, i can render the search text box, but when i write something and push "Enter", nothing happened.
EDIT 1:
(Here is my ui-component, InstallSchema and UpgradeSchema file)
File : C:xampphtdocsmagentoappcodeAhtBannerSliderviewadminhtmlui_componentbanner_form.xml
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
<argument name="data" xsi:type="array">
<item name="js_config" xsi:type="array">
<item name="provider" xsi:type="string">banner_form.banner_form_data_source</item>
</item>
<item name="label" xsi:type="string" translate="true">General Information</item>
<item name="template" xsi:type="string">templates/form/collapsible</item>
</argument>
<settings>
<buttons>
<button name="save_and_continue" class="AhtBannerSliderBlockAdminhtmlBannerEditSaveAndContinueButton"/>
<button name="save" class="AhtBannerSliderBlockAdminhtmlBannerEditSaveButton"/>
<button name="reset" class="AhtBannerSliderBlockAdminhtmlBannerEditResetButton"/>
<button name="delete" class="AhtBannerSliderBlockAdminhtmlBannerEditDeleteButton"/>
<button name="back" class="AhtBannerSliderBlockAdminhtmlBannerEditBackButton"/>
</buttons>
<namespace>banner_form</namespace>
<dataScope>data</dataScope>
<deps>
<dep>banner_form.banner_form_data_source</dep>
</deps>
</settings>
<dataSource name="banner_form_data_source">
<argument name="data" xsi:type="array">
<item name="js_config" xsi:type="array">
<item name="component" xsi:type="string">Magento_Ui/js/form/provider</item>
</item>
</argument>
<settings>
<submitUrl path="banner/manage/save"/>
</settings>
<dataProvider class="AhtBannerSliderModelBannerDataProvider" name="banner_form_data_source">
<settings>
<requestFieldName>id</requestFieldName>
<primaryFieldName>id</primaryFieldName>
</settings>
</dataProvider>
</dataSource>
<fieldset name="general">
<settings>
<label/>
</settings>
<field name="id" formElement="input">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="source" xsi:type="string">banner</item>
</item>
</argument>
<settings>
<dataType>text</dataType>
<visible>false</visible>
<dataScope>id</dataScope>
</settings>
</field>
<field name="name" sortOrder="20" formElement="input">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="source" xsi:type="string">banner</item>
</item>
</argument>
<settings>
<validation>
<rule name="required-entry" xsi:type="boolean">true</rule>
</validation>
<dataType>text</dataType>
<label translate="true">Banner Name</label>
<dataScope>name</dataScope>
</settings>
</field>
</fieldset>
</form>
File: InstallSchema.php
class InstallSchema implements MagentoFrameworkSetupInstallSchemaInterface
{
public function install(MagentoFrameworkSetupSchemaSetupInterface $setup, MagentoFrameworkSetupModuleContextInterface $context)
{
$installer = $setup;
$installer->startSetup();
if (!$installer->tableExists('banner')) {
$table = $installer->getConnection()->newTable(
$installer->getTable('banner')
)
->addColumn(
'id',
MagentoFrameworkDBDdlTable::TYPE_INTEGER,
null,
[
'identity' => true,
'nullable' => false,
'primary' => true,
'unsigned' => true,
],
'ID'
)
->addColumn(
'name',
MagentoFrameworkDBDdlTable::TYPE_TEXT,
255,
['nullable => false'],
'Name'
)
->addColumn(
'created_at',
MagentoFrameworkDBDdlTable::TYPE_TIMESTAMP,
null,
['nullable' => false, 'default' => MagentoFrameworkDBDdlTable::TIMESTAMP_INIT],
'Created At'
)->addColumn(
'updated_at',
MagentoFrameworkDBDdlTable::TYPE_TIMESTAMP,
null,
['nullable' => false, 'default' => MagentoFrameworkDBDdlTable::TIMESTAMP_INIT_UPDATE],
'Updated At')
->setComment('Banner Table');
$installer->getConnection()->createTable($table);
}
if (!$installer->tableExists('slide')) {
$table = $installer->getConnection()->newTable(
$installer->getTable('slide')
)
->addColumn(
'id',
MagentoFrameworkDBDdlTable::TYPE_INTEGER,
null,
[
'identity' => true,
'nullable' => false,
'primary' => true,
'unsigned' => true,
],
'ID'
)
->addColumn(
'banner_id',
MagentoFrameworkDBDdlTable::TYPE_TEXT,
255,
[],
'Banner Id'
)
->addColumn(
'name',
MagentoFrameworkDBDdlTable::TYPE_TEXT,
255,
['nullable => false'],
'Name'
)
->addColumn(
'url',
MagentoFrameworkDBDdlTable::TYPE_TEXT,
255,
[],
'URL'
)
->addColumn(
'image',
MagentoFrameworkDBDdlTable::TYPE_TEXT,
255,
[],
'Image'
)
->addColumn(
'created_at',
MagentoFrameworkDBDdlTable::TYPE_TIMESTAMP,
null,
['nullable' => false, 'default' => MagentoFrameworkDBDdlTable::TIMESTAMP_INIT],
'Created At'
)->addColumn(
'updated_at',
MagentoFrameworkDBDdlTable::TYPE_TIMESTAMP,
null,
['nullable' => false, 'default' => MagentoFrameworkDBDdlTable::TIMESTAMP_INIT_UPDATE],
'Updated At')
->setComment('Slide Table');
$installer->getConnection()->createTable($table);
}
$installer->endSetup();
}
}
File: UpgradeSchema.php
<?php
namespace AhtBannerSliderSetup;
use MagentoFrameworkSetupUpgradeSchemaInterface;
use MagentoFrameworkSetupSchemaSetupInterface;
use MagentoFrameworkSetupModuleContextInterface;
class UpgradeSchema implements UpgradeSchemaInterface
{
public function upgrade( SchemaSetupInterface $setup, ModuleContextInterface $context ) {
$installer = $setup;
$installer->startSetup();
if(version_compare($context->getVersion(), '1.1.0', '<')) {
if (!$installer->tableExists('banner_slide')) {
$table = $installer->getConnection()->newTable(
$installer->getTable('banner_slide')
)
->addColumn(
'id',
MagentoFrameworkDBDdlTable::TYPE_INTEGER,
null,
[
'identity' => true,
'nullable' => false,
'primary' => true,
'unsigned' => true,
],
'ID'
)
->addColumn(
'banner_id',
MagentoFrameworkDBDdlTable::TYPE_INTEGER,
null,
['nullable => false'],
'Banner ID'
)
->addColumn(
'slide_id',
MagentoFrameworkDBDdlTable::TYPE_INTEGER,
null,
['nullable => false'],
'Slide ID'
)
->addColumn(
'created_at',
MagentoFrameworkDBDdlTable::TYPE_TIMESTAMP,
null,
['nullable' => false, 'default' => MagentoFrameworkDBDdlTable::TIMESTAMP_INIT],
'Created At'
)->addColumn(
'updated_at',
MagentoFrameworkDBDdlTable::TYPE_TIMESTAMP,
null,
['nullable' => false, 'default' => MagentoFrameworkDBDdlTable::TIMESTAMP_INIT_UPDATE],
'Updated At')
->setComment('Banner Slide Table');
$installer->getConnection()->createTable($table);
}
if (!$installer->tableExists('banner_page')) {
$table = $installer->getConnection()->newTable(
$installer->getTable('banner_page')
)
->addColumn(
'id',
MagentoFrameworkDBDdlTable::TYPE_INTEGER,
null,
[
'identity' => true,
'nullable' => false,
'primary' => true,
'unsigned' => true,
],
'ID'
)
->addColumn(
'banner_id',
MagentoFrameworkDBDdlTable::TYPE_INTEGER,
null,
['nullable => false'],
'Banner ID'
)
->addColumn(
'page_url',
MagentoFrameworkDBDdlTable::TYPE_TEXT,
255,
['nullable => false'],
'Page Url'
)
->addColumn(
'created_at',
MagentoFrameworkDBDdlTable::TYPE_TIMESTAMP,
null,
['nullable' => false, 'default' => MagentoFrameworkDBDdlTable::TIMESTAMP_INIT],
'Created At'
)->addColumn(
'updated_at',
MagentoFrameworkDBDdlTable::TYPE_TIMESTAMP,
null,
['nullable' => false, 'default' => MagentoFrameworkDBDdlTable::TIMESTAMP_INIT_UPDATE],
'Updated At')
->setComment('Banner Page Table');
$installer->getConnection()->createTable($table);
}
if ($installer->tableExists('slide')){
$connection = $installer->getConnection();
$tableName = $installer->getTable('slide');
$columnName = 'banner_id';
if($connection->tableColumnExists($tableName,$columnName, $schemaName = null)){
$connection->dropColumn($tableName, $columnName, $schemaName = null);
}
}
}
$installer->endSetup();
}
}
EDIT 2 (fixed in EDIT 3):
I'm following Marius solution.
But it doesn't seem to work. It throw an error when i'm trying "php bin/magento setup:upgrade"
Installing schema... Upgrading schema... SQLSTATE[42S02]: Base table or view not found: 1146 Table 'magento.banner_name' doesn't exist, query was: DESCRIBE BANNER_NAME
So here is what i update to UpdateSchema.php.
if ($installer->tableExists('banner')){
$connection = $installer->getConnection();
$connection->addIndex(
$setup->getIdxName(
$installer->getTable('banner'),
['name'],
AdapterInterface::INDEX_TYPE_FULLTEXT
),
['name'],
['type' => AdapterInterface::INDEX_TYPE_FULLTEXT]
);
}
EDIT 3:
So i was trying Marius solution like this (the difference is i give it a table in "addIndex" function):
if ($installer->tableExists('banner')){
$connection = $installer->getConnection();
$connection->addIndex(
$installer->getTable('banner'),
$setup->getIdxName(
$installer->getTable('banner'),
['name'],
AdapterInterface::INDEX_TYPE_FULLTEXT
),
['name'],
AdapterInterface::INDEX_TYPE_FULLTEXT
);
}
Also, before i do that, i have to clear cache and delete my module in "setup_module" table, and it work
. But for some reason, when i click "x" to clear the search, it throw 2 column exactly like the same( look the image below):
1 more problem is i cant search with "c". I've read some where that "fulltext_search" cant be use with 5 or less character. So there are any solution to fix this?
magento2 cms search magento-2.2.5
In which module it's not working?
– Suresh Chikani
Aug 1 '18 at 7:35
Thanks for reply, i'm trying to do the search, so the one is not working is my module. I'll edit the post so you can see my ui-component. :)
– fudu
Aug 1 '18 at 7:47
Edited, please check :D
– fudu
Aug 1 '18 at 7:49
can you post yourInstallSchema.php
file in here ?
– Marius♦
Aug 1 '18 at 7:52
Ok, hold on, i'm editing
– fudu
Aug 1 '18 at 7:56
|
show 4 more comments
Like i said in the title, i dont know how the Search in Catalog work.
As far as i know, the Search is render through this code in this ui-component:
C:xampphtdocsmagentovendormagentomodule-cmsviewadminhtmlui_componentcms_page_listing.xml
<filterSearch name="fulltext"/>
And when i copy this code and paste to my ui-component, it doesn't work at all, i can render the search text box, but when i write something and push "Enter", nothing happened.
EDIT 1:
(Here is my ui-component, InstallSchema and UpgradeSchema file)
File : C:xampphtdocsmagentoappcodeAhtBannerSliderviewadminhtmlui_componentbanner_form.xml
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
<argument name="data" xsi:type="array">
<item name="js_config" xsi:type="array">
<item name="provider" xsi:type="string">banner_form.banner_form_data_source</item>
</item>
<item name="label" xsi:type="string" translate="true">General Information</item>
<item name="template" xsi:type="string">templates/form/collapsible</item>
</argument>
<settings>
<buttons>
<button name="save_and_continue" class="AhtBannerSliderBlockAdminhtmlBannerEditSaveAndContinueButton"/>
<button name="save" class="AhtBannerSliderBlockAdminhtmlBannerEditSaveButton"/>
<button name="reset" class="AhtBannerSliderBlockAdminhtmlBannerEditResetButton"/>
<button name="delete" class="AhtBannerSliderBlockAdminhtmlBannerEditDeleteButton"/>
<button name="back" class="AhtBannerSliderBlockAdminhtmlBannerEditBackButton"/>
</buttons>
<namespace>banner_form</namespace>
<dataScope>data</dataScope>
<deps>
<dep>banner_form.banner_form_data_source</dep>
</deps>
</settings>
<dataSource name="banner_form_data_source">
<argument name="data" xsi:type="array">
<item name="js_config" xsi:type="array">
<item name="component" xsi:type="string">Magento_Ui/js/form/provider</item>
</item>
</argument>
<settings>
<submitUrl path="banner/manage/save"/>
</settings>
<dataProvider class="AhtBannerSliderModelBannerDataProvider" name="banner_form_data_source">
<settings>
<requestFieldName>id</requestFieldName>
<primaryFieldName>id</primaryFieldName>
</settings>
</dataProvider>
</dataSource>
<fieldset name="general">
<settings>
<label/>
</settings>
<field name="id" formElement="input">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="source" xsi:type="string">banner</item>
</item>
</argument>
<settings>
<dataType>text</dataType>
<visible>false</visible>
<dataScope>id</dataScope>
</settings>
</field>
<field name="name" sortOrder="20" formElement="input">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="source" xsi:type="string">banner</item>
</item>
</argument>
<settings>
<validation>
<rule name="required-entry" xsi:type="boolean">true</rule>
</validation>
<dataType>text</dataType>
<label translate="true">Banner Name</label>
<dataScope>name</dataScope>
</settings>
</field>
</fieldset>
</form>
File: InstallSchema.php
class InstallSchema implements MagentoFrameworkSetupInstallSchemaInterface
{
public function install(MagentoFrameworkSetupSchemaSetupInterface $setup, MagentoFrameworkSetupModuleContextInterface $context)
{
$installer = $setup;
$installer->startSetup();
if (!$installer->tableExists('banner')) {
$table = $installer->getConnection()->newTable(
$installer->getTable('banner')
)
->addColumn(
'id',
MagentoFrameworkDBDdlTable::TYPE_INTEGER,
null,
[
'identity' => true,
'nullable' => false,
'primary' => true,
'unsigned' => true,
],
'ID'
)
->addColumn(
'name',
MagentoFrameworkDBDdlTable::TYPE_TEXT,
255,
['nullable => false'],
'Name'
)
->addColumn(
'created_at',
MagentoFrameworkDBDdlTable::TYPE_TIMESTAMP,
null,
['nullable' => false, 'default' => MagentoFrameworkDBDdlTable::TIMESTAMP_INIT],
'Created At'
)->addColumn(
'updated_at',
MagentoFrameworkDBDdlTable::TYPE_TIMESTAMP,
null,
['nullable' => false, 'default' => MagentoFrameworkDBDdlTable::TIMESTAMP_INIT_UPDATE],
'Updated At')
->setComment('Banner Table');
$installer->getConnection()->createTable($table);
}
if (!$installer->tableExists('slide')) {
$table = $installer->getConnection()->newTable(
$installer->getTable('slide')
)
->addColumn(
'id',
MagentoFrameworkDBDdlTable::TYPE_INTEGER,
null,
[
'identity' => true,
'nullable' => false,
'primary' => true,
'unsigned' => true,
],
'ID'
)
->addColumn(
'banner_id',
MagentoFrameworkDBDdlTable::TYPE_TEXT,
255,
[],
'Banner Id'
)
->addColumn(
'name',
MagentoFrameworkDBDdlTable::TYPE_TEXT,
255,
['nullable => false'],
'Name'
)
->addColumn(
'url',
MagentoFrameworkDBDdlTable::TYPE_TEXT,
255,
[],
'URL'
)
->addColumn(
'image',
MagentoFrameworkDBDdlTable::TYPE_TEXT,
255,
[],
'Image'
)
->addColumn(
'created_at',
MagentoFrameworkDBDdlTable::TYPE_TIMESTAMP,
null,
['nullable' => false, 'default' => MagentoFrameworkDBDdlTable::TIMESTAMP_INIT],
'Created At'
)->addColumn(
'updated_at',
MagentoFrameworkDBDdlTable::TYPE_TIMESTAMP,
null,
['nullable' => false, 'default' => MagentoFrameworkDBDdlTable::TIMESTAMP_INIT_UPDATE],
'Updated At')
->setComment('Slide Table');
$installer->getConnection()->createTable($table);
}
$installer->endSetup();
}
}
File: UpgradeSchema.php
<?php
namespace AhtBannerSliderSetup;
use MagentoFrameworkSetupUpgradeSchemaInterface;
use MagentoFrameworkSetupSchemaSetupInterface;
use MagentoFrameworkSetupModuleContextInterface;
class UpgradeSchema implements UpgradeSchemaInterface
{
public function upgrade( SchemaSetupInterface $setup, ModuleContextInterface $context ) {
$installer = $setup;
$installer->startSetup();
if(version_compare($context->getVersion(), '1.1.0', '<')) {
if (!$installer->tableExists('banner_slide')) {
$table = $installer->getConnection()->newTable(
$installer->getTable('banner_slide')
)
->addColumn(
'id',
MagentoFrameworkDBDdlTable::TYPE_INTEGER,
null,
[
'identity' => true,
'nullable' => false,
'primary' => true,
'unsigned' => true,
],
'ID'
)
->addColumn(
'banner_id',
MagentoFrameworkDBDdlTable::TYPE_INTEGER,
null,
['nullable => false'],
'Banner ID'
)
->addColumn(
'slide_id',
MagentoFrameworkDBDdlTable::TYPE_INTEGER,
null,
['nullable => false'],
'Slide ID'
)
->addColumn(
'created_at',
MagentoFrameworkDBDdlTable::TYPE_TIMESTAMP,
null,
['nullable' => false, 'default' => MagentoFrameworkDBDdlTable::TIMESTAMP_INIT],
'Created At'
)->addColumn(
'updated_at',
MagentoFrameworkDBDdlTable::TYPE_TIMESTAMP,
null,
['nullable' => false, 'default' => MagentoFrameworkDBDdlTable::TIMESTAMP_INIT_UPDATE],
'Updated At')
->setComment('Banner Slide Table');
$installer->getConnection()->createTable($table);
}
if (!$installer->tableExists('banner_page')) {
$table = $installer->getConnection()->newTable(
$installer->getTable('banner_page')
)
->addColumn(
'id',
MagentoFrameworkDBDdlTable::TYPE_INTEGER,
null,
[
'identity' => true,
'nullable' => false,
'primary' => true,
'unsigned' => true,
],
'ID'
)
->addColumn(
'banner_id',
MagentoFrameworkDBDdlTable::TYPE_INTEGER,
null,
['nullable => false'],
'Banner ID'
)
->addColumn(
'page_url',
MagentoFrameworkDBDdlTable::TYPE_TEXT,
255,
['nullable => false'],
'Page Url'
)
->addColumn(
'created_at',
MagentoFrameworkDBDdlTable::TYPE_TIMESTAMP,
null,
['nullable' => false, 'default' => MagentoFrameworkDBDdlTable::TIMESTAMP_INIT],
'Created At'
)->addColumn(
'updated_at',
MagentoFrameworkDBDdlTable::TYPE_TIMESTAMP,
null,
['nullable' => false, 'default' => MagentoFrameworkDBDdlTable::TIMESTAMP_INIT_UPDATE],
'Updated At')
->setComment('Banner Page Table');
$installer->getConnection()->createTable($table);
}
if ($installer->tableExists('slide')){
$connection = $installer->getConnection();
$tableName = $installer->getTable('slide');
$columnName = 'banner_id';
if($connection->tableColumnExists($tableName,$columnName, $schemaName = null)){
$connection->dropColumn($tableName, $columnName, $schemaName = null);
}
}
}
$installer->endSetup();
}
}
EDIT 2 (fixed in EDIT 3):
I'm following Marius solution.
But it doesn't seem to work. It throw an error when i'm trying "php bin/magento setup:upgrade"
Installing schema... Upgrading schema... SQLSTATE[42S02]: Base table or view not found: 1146 Table 'magento.banner_name' doesn't exist, query was: DESCRIBE BANNER_NAME
So here is what i update to UpdateSchema.php.
if ($installer->tableExists('banner')){
$connection = $installer->getConnection();
$connection->addIndex(
$setup->getIdxName(
$installer->getTable('banner'),
['name'],
AdapterInterface::INDEX_TYPE_FULLTEXT
),
['name'],
['type' => AdapterInterface::INDEX_TYPE_FULLTEXT]
);
}
EDIT 3:
So i was trying Marius solution like this (the difference is i give it a table in "addIndex" function):
if ($installer->tableExists('banner')){
$connection = $installer->getConnection();
$connection->addIndex(
$installer->getTable('banner'),
$setup->getIdxName(
$installer->getTable('banner'),
['name'],
AdapterInterface::INDEX_TYPE_FULLTEXT
),
['name'],
AdapterInterface::INDEX_TYPE_FULLTEXT
);
}
Also, before i do that, i have to clear cache and delete my module in "setup_module" table, and it work
. But for some reason, when i click "x" to clear the search, it throw 2 column exactly like the same( look the image below):
1 more problem is i cant search with "c". I've read some where that "fulltext_search" cant be use with 5 or less character. So there are any solution to fix this?
magento2 cms search magento-2.2.5
Like i said in the title, i dont know how the Search in Catalog work.
As far as i know, the Search is render through this code in this ui-component:
C:xampphtdocsmagentovendormagentomodule-cmsviewadminhtmlui_componentcms_page_listing.xml
<filterSearch name="fulltext"/>
And when i copy this code and paste to my ui-component, it doesn't work at all, i can render the search text box, but when i write something and push "Enter", nothing happened.
EDIT 1:
(Here is my ui-component, InstallSchema and UpgradeSchema file)
File : C:xampphtdocsmagentoappcodeAhtBannerSliderviewadminhtmlui_componentbanner_form.xml
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<form xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Ui:etc/ui_configuration.xsd">
<argument name="data" xsi:type="array">
<item name="js_config" xsi:type="array">
<item name="provider" xsi:type="string">banner_form.banner_form_data_source</item>
</item>
<item name="label" xsi:type="string" translate="true">General Information</item>
<item name="template" xsi:type="string">templates/form/collapsible</item>
</argument>
<settings>
<buttons>
<button name="save_and_continue" class="AhtBannerSliderBlockAdminhtmlBannerEditSaveAndContinueButton"/>
<button name="save" class="AhtBannerSliderBlockAdminhtmlBannerEditSaveButton"/>
<button name="reset" class="AhtBannerSliderBlockAdminhtmlBannerEditResetButton"/>
<button name="delete" class="AhtBannerSliderBlockAdminhtmlBannerEditDeleteButton"/>
<button name="back" class="AhtBannerSliderBlockAdminhtmlBannerEditBackButton"/>
</buttons>
<namespace>banner_form</namespace>
<dataScope>data</dataScope>
<deps>
<dep>banner_form.banner_form_data_source</dep>
</deps>
</settings>
<dataSource name="banner_form_data_source">
<argument name="data" xsi:type="array">
<item name="js_config" xsi:type="array">
<item name="component" xsi:type="string">Magento_Ui/js/form/provider</item>
</item>
</argument>
<settings>
<submitUrl path="banner/manage/save"/>
</settings>
<dataProvider class="AhtBannerSliderModelBannerDataProvider" name="banner_form_data_source">
<settings>
<requestFieldName>id</requestFieldName>
<primaryFieldName>id</primaryFieldName>
</settings>
</dataProvider>
</dataSource>
<fieldset name="general">
<settings>
<label/>
</settings>
<field name="id" formElement="input">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="source" xsi:type="string">banner</item>
</item>
</argument>
<settings>
<dataType>text</dataType>
<visible>false</visible>
<dataScope>id</dataScope>
</settings>
</field>
<field name="name" sortOrder="20" formElement="input">
<argument name="data" xsi:type="array">
<item name="config" xsi:type="array">
<item name="source" xsi:type="string">banner</item>
</item>
</argument>
<settings>
<validation>
<rule name="required-entry" xsi:type="boolean">true</rule>
</validation>
<dataType>text</dataType>
<label translate="true">Banner Name</label>
<dataScope>name</dataScope>
</settings>
</field>
</fieldset>
</form>
File: InstallSchema.php
class InstallSchema implements MagentoFrameworkSetupInstallSchemaInterface
{
public function install(MagentoFrameworkSetupSchemaSetupInterface $setup, MagentoFrameworkSetupModuleContextInterface $context)
{
$installer = $setup;
$installer->startSetup();
if (!$installer->tableExists('banner')) {
$table = $installer->getConnection()->newTable(
$installer->getTable('banner')
)
->addColumn(
'id',
MagentoFrameworkDBDdlTable::TYPE_INTEGER,
null,
[
'identity' => true,
'nullable' => false,
'primary' => true,
'unsigned' => true,
],
'ID'
)
->addColumn(
'name',
MagentoFrameworkDBDdlTable::TYPE_TEXT,
255,
['nullable => false'],
'Name'
)
->addColumn(
'created_at',
MagentoFrameworkDBDdlTable::TYPE_TIMESTAMP,
null,
['nullable' => false, 'default' => MagentoFrameworkDBDdlTable::TIMESTAMP_INIT],
'Created At'
)->addColumn(
'updated_at',
MagentoFrameworkDBDdlTable::TYPE_TIMESTAMP,
null,
['nullable' => false, 'default' => MagentoFrameworkDBDdlTable::TIMESTAMP_INIT_UPDATE],
'Updated At')
->setComment('Banner Table');
$installer->getConnection()->createTable($table);
}
if (!$installer->tableExists('slide')) {
$table = $installer->getConnection()->newTable(
$installer->getTable('slide')
)
->addColumn(
'id',
MagentoFrameworkDBDdlTable::TYPE_INTEGER,
null,
[
'identity' => true,
'nullable' => false,
'primary' => true,
'unsigned' => true,
],
'ID'
)
->addColumn(
'banner_id',
MagentoFrameworkDBDdlTable::TYPE_TEXT,
255,
[],
'Banner Id'
)
->addColumn(
'name',
MagentoFrameworkDBDdlTable::TYPE_TEXT,
255,
['nullable => false'],
'Name'
)
->addColumn(
'url',
MagentoFrameworkDBDdlTable::TYPE_TEXT,
255,
[],
'URL'
)
->addColumn(
'image',
MagentoFrameworkDBDdlTable::TYPE_TEXT,
255,
[],
'Image'
)
->addColumn(
'created_at',
MagentoFrameworkDBDdlTable::TYPE_TIMESTAMP,
null,
['nullable' => false, 'default' => MagentoFrameworkDBDdlTable::TIMESTAMP_INIT],
'Created At'
)->addColumn(
'updated_at',
MagentoFrameworkDBDdlTable::TYPE_TIMESTAMP,
null,
['nullable' => false, 'default' => MagentoFrameworkDBDdlTable::TIMESTAMP_INIT_UPDATE],
'Updated At')
->setComment('Slide Table');
$installer->getConnection()->createTable($table);
}
$installer->endSetup();
}
}
File: UpgradeSchema.php
<?php
namespace AhtBannerSliderSetup;
use MagentoFrameworkSetupUpgradeSchemaInterface;
use MagentoFrameworkSetupSchemaSetupInterface;
use MagentoFrameworkSetupModuleContextInterface;
class UpgradeSchema implements UpgradeSchemaInterface
{
public function upgrade( SchemaSetupInterface $setup, ModuleContextInterface $context ) {
$installer = $setup;
$installer->startSetup();
if(version_compare($context->getVersion(), '1.1.0', '<')) {
if (!$installer->tableExists('banner_slide')) {
$table = $installer->getConnection()->newTable(
$installer->getTable('banner_slide')
)
->addColumn(
'id',
MagentoFrameworkDBDdlTable::TYPE_INTEGER,
null,
[
'identity' => true,
'nullable' => false,
'primary' => true,
'unsigned' => true,
],
'ID'
)
->addColumn(
'banner_id',
MagentoFrameworkDBDdlTable::TYPE_INTEGER,
null,
['nullable => false'],
'Banner ID'
)
->addColumn(
'slide_id',
MagentoFrameworkDBDdlTable::TYPE_INTEGER,
null,
['nullable => false'],
'Slide ID'
)
->addColumn(
'created_at',
MagentoFrameworkDBDdlTable::TYPE_TIMESTAMP,
null,
['nullable' => false, 'default' => MagentoFrameworkDBDdlTable::TIMESTAMP_INIT],
'Created At'
)->addColumn(
'updated_at',
MagentoFrameworkDBDdlTable::TYPE_TIMESTAMP,
null,
['nullable' => false, 'default' => MagentoFrameworkDBDdlTable::TIMESTAMP_INIT_UPDATE],
'Updated At')
->setComment('Banner Slide Table');
$installer->getConnection()->createTable($table);
}
if (!$installer->tableExists('banner_page')) {
$table = $installer->getConnection()->newTable(
$installer->getTable('banner_page')
)
->addColumn(
'id',
MagentoFrameworkDBDdlTable::TYPE_INTEGER,
null,
[
'identity' => true,
'nullable' => false,
'primary' => true,
'unsigned' => true,
],
'ID'
)
->addColumn(
'banner_id',
MagentoFrameworkDBDdlTable::TYPE_INTEGER,
null,
['nullable => false'],
'Banner ID'
)
->addColumn(
'page_url',
MagentoFrameworkDBDdlTable::TYPE_TEXT,
255,
['nullable => false'],
'Page Url'
)
->addColumn(
'created_at',
MagentoFrameworkDBDdlTable::TYPE_TIMESTAMP,
null,
['nullable' => false, 'default' => MagentoFrameworkDBDdlTable::TIMESTAMP_INIT],
'Created At'
)->addColumn(
'updated_at',
MagentoFrameworkDBDdlTable::TYPE_TIMESTAMP,
null,
['nullable' => false, 'default' => MagentoFrameworkDBDdlTable::TIMESTAMP_INIT_UPDATE],
'Updated At')
->setComment('Banner Page Table');
$installer->getConnection()->createTable($table);
}
if ($installer->tableExists('slide')){
$connection = $installer->getConnection();
$tableName = $installer->getTable('slide');
$columnName = 'banner_id';
if($connection->tableColumnExists($tableName,$columnName, $schemaName = null)){
$connection->dropColumn($tableName, $columnName, $schemaName = null);
}
}
}
$installer->endSetup();
}
}
EDIT 2 (fixed in EDIT 3):
I'm following Marius solution.
But it doesn't seem to work. It throw an error when i'm trying "php bin/magento setup:upgrade"
Installing schema... Upgrading schema... SQLSTATE[42S02]: Base table or view not found: 1146 Table 'magento.banner_name' doesn't exist, query was: DESCRIBE BANNER_NAME
So here is what i update to UpdateSchema.php.
if ($installer->tableExists('banner')){
$connection = $installer->getConnection();
$connection->addIndex(
$setup->getIdxName(
$installer->getTable('banner'),
['name'],
AdapterInterface::INDEX_TYPE_FULLTEXT
),
['name'],
['type' => AdapterInterface::INDEX_TYPE_FULLTEXT]
);
}
EDIT 3:
So i was trying Marius solution like this (the difference is i give it a table in "addIndex" function):
if ($installer->tableExists('banner')){
$connection = $installer->getConnection();
$connection->addIndex(
$installer->getTable('banner'),
$setup->getIdxName(
$installer->getTable('banner'),
['name'],
AdapterInterface::INDEX_TYPE_FULLTEXT
),
['name'],
AdapterInterface::INDEX_TYPE_FULLTEXT
);
}
Also, before i do that, i have to clear cache and delete my module in "setup_module" table, and it work
. But for some reason, when i click "x" to clear the search, it throw 2 column exactly like the same( look the image below):
1 more problem is i cant search with "c". I've read some where that "fulltext_search" cant be use with 5 or less character. So there are any solution to fix this?
magento2 cms search magento-2.2.5
magento2 cms search magento-2.2.5
edited 11 mins ago
Teja Bhagavan Kollepara
3,01241949
3,01241949
asked Aug 1 '18 at 7:03
fudufudu
42311
42311
In which module it's not working?
– Suresh Chikani
Aug 1 '18 at 7:35
Thanks for reply, i'm trying to do the search, so the one is not working is my module. I'll edit the post so you can see my ui-component. :)
– fudu
Aug 1 '18 at 7:47
Edited, please check :D
– fudu
Aug 1 '18 at 7:49
can you post yourInstallSchema.php
file in here ?
– Marius♦
Aug 1 '18 at 7:52
Ok, hold on, i'm editing
– fudu
Aug 1 '18 at 7:56
|
show 4 more comments
In which module it's not working?
– Suresh Chikani
Aug 1 '18 at 7:35
Thanks for reply, i'm trying to do the search, so the one is not working is my module. I'll edit the post so you can see my ui-component. :)
– fudu
Aug 1 '18 at 7:47
Edited, please check :D
– fudu
Aug 1 '18 at 7:49
can you post yourInstallSchema.php
file in here ?
– Marius♦
Aug 1 '18 at 7:52
Ok, hold on, i'm editing
– fudu
Aug 1 '18 at 7:56
In which module it's not working?
– Suresh Chikani
Aug 1 '18 at 7:35
In which module it's not working?
– Suresh Chikani
Aug 1 '18 at 7:35
Thanks for reply, i'm trying to do the search, so the one is not working is my module. I'll edit the post so you can see my ui-component. :)
– fudu
Aug 1 '18 at 7:47
Thanks for reply, i'm trying to do the search, so the one is not working is my module. I'll edit the post so you can see my ui-component. :)
– fudu
Aug 1 '18 at 7:47
Edited, please check :D
– fudu
Aug 1 '18 at 7:49
Edited, please check :D
– fudu
Aug 1 '18 at 7:49
can you post your
InstallSchema.php
file in here ?– Marius♦
Aug 1 '18 at 7:52
can you post your
InstallSchema.php
file in here ?– Marius♦
Aug 1 '18 at 7:52
Ok, hold on, i'm editing
– fudu
Aug 1 '18 at 7:56
Ok, hold on, i'm editing
– fudu
Aug 1 '18 at 7:56
|
show 4 more comments
1 Answer
1
active
oldest
votes
The general search field in the grid works with full text search indexes. Your table does not have any, that's why nothing happens.
You need to add to your table a full text index that indexes all the fields you want searched.
Here is an example from the cms module
->addIndex(
$setup->getIdxName(
$installer->getTable('cms_block'),
['title', 'identifier', 'content'],
AdapterInterface::INDEX_TYPE_FULLTEXT
),
['title', 'identifier', 'content'],
['type' => AdapterInterface::INDEX_TYPE_FULLTEXT]
);
This means that you are creating a full text index on the fields title
, identifier
and content
for the cms block entity.
well , I'm trying to follow your code, but it return an error " Installing schema... Upgrading schema... SQLSTATE[42S02]: Base table or view not found: 1146 Table 'magento.banner_name' doesn't exist, query was: DESCRIBEBANNER_NAME
"
– fudu
Aug 1 '18 at 8:39
I was replaced "cms_block" with "banner" and " 'title', 'identifier', 'content' " with "name". That's all.
– fudu
Aug 1 '18 at 8:40
I've updated the code, please check
– fudu
Aug 1 '18 at 8:52
I have no idea where thatbanner_name
comes from.
– Marius♦
Aug 1 '18 at 8:57
hmmm .. This is weird @@ incase you wanna know the code, i've update the UpgradeSchema.php in my post.
– fudu
Aug 1 '18 at 9:00
|
show 3 more comments
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "479"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f236731%2fmagento-2-2-5-how-cms-page-search-work%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
The general search field in the grid works with full text search indexes. Your table does not have any, that's why nothing happens.
You need to add to your table a full text index that indexes all the fields you want searched.
Here is an example from the cms module
->addIndex(
$setup->getIdxName(
$installer->getTable('cms_block'),
['title', 'identifier', 'content'],
AdapterInterface::INDEX_TYPE_FULLTEXT
),
['title', 'identifier', 'content'],
['type' => AdapterInterface::INDEX_TYPE_FULLTEXT]
);
This means that you are creating a full text index on the fields title
, identifier
and content
for the cms block entity.
well , I'm trying to follow your code, but it return an error " Installing schema... Upgrading schema... SQLSTATE[42S02]: Base table or view not found: 1146 Table 'magento.banner_name' doesn't exist, query was: DESCRIBEBANNER_NAME
"
– fudu
Aug 1 '18 at 8:39
I was replaced "cms_block" with "banner" and " 'title', 'identifier', 'content' " with "name". That's all.
– fudu
Aug 1 '18 at 8:40
I've updated the code, please check
– fudu
Aug 1 '18 at 8:52
I have no idea where thatbanner_name
comes from.
– Marius♦
Aug 1 '18 at 8:57
hmmm .. This is weird @@ incase you wanna know the code, i've update the UpgradeSchema.php in my post.
– fudu
Aug 1 '18 at 9:00
|
show 3 more comments
The general search field in the grid works with full text search indexes. Your table does not have any, that's why nothing happens.
You need to add to your table a full text index that indexes all the fields you want searched.
Here is an example from the cms module
->addIndex(
$setup->getIdxName(
$installer->getTable('cms_block'),
['title', 'identifier', 'content'],
AdapterInterface::INDEX_TYPE_FULLTEXT
),
['title', 'identifier', 'content'],
['type' => AdapterInterface::INDEX_TYPE_FULLTEXT]
);
This means that you are creating a full text index on the fields title
, identifier
and content
for the cms block entity.
well , I'm trying to follow your code, but it return an error " Installing schema... Upgrading schema... SQLSTATE[42S02]: Base table or view not found: 1146 Table 'magento.banner_name' doesn't exist, query was: DESCRIBEBANNER_NAME
"
– fudu
Aug 1 '18 at 8:39
I was replaced "cms_block" with "banner" and " 'title', 'identifier', 'content' " with "name". That's all.
– fudu
Aug 1 '18 at 8:40
I've updated the code, please check
– fudu
Aug 1 '18 at 8:52
I have no idea where thatbanner_name
comes from.
– Marius♦
Aug 1 '18 at 8:57
hmmm .. This is weird @@ incase you wanna know the code, i've update the UpgradeSchema.php in my post.
– fudu
Aug 1 '18 at 9:00
|
show 3 more comments
The general search field in the grid works with full text search indexes. Your table does not have any, that's why nothing happens.
You need to add to your table a full text index that indexes all the fields you want searched.
Here is an example from the cms module
->addIndex(
$setup->getIdxName(
$installer->getTable('cms_block'),
['title', 'identifier', 'content'],
AdapterInterface::INDEX_TYPE_FULLTEXT
),
['title', 'identifier', 'content'],
['type' => AdapterInterface::INDEX_TYPE_FULLTEXT]
);
This means that you are creating a full text index on the fields title
, identifier
and content
for the cms block entity.
The general search field in the grid works with full text search indexes. Your table does not have any, that's why nothing happens.
You need to add to your table a full text index that indexes all the fields you want searched.
Here is an example from the cms module
->addIndex(
$setup->getIdxName(
$installer->getTable('cms_block'),
['title', 'identifier', 'content'],
AdapterInterface::INDEX_TYPE_FULLTEXT
),
['title', 'identifier', 'content'],
['type' => AdapterInterface::INDEX_TYPE_FULLTEXT]
);
This means that you are creating a full text index on the fields title
, identifier
and content
for the cms block entity.
answered Aug 1 '18 at 8:06
Marius♦Marius
167k28319686
167k28319686
well , I'm trying to follow your code, but it return an error " Installing schema... Upgrading schema... SQLSTATE[42S02]: Base table or view not found: 1146 Table 'magento.banner_name' doesn't exist, query was: DESCRIBEBANNER_NAME
"
– fudu
Aug 1 '18 at 8:39
I was replaced "cms_block" with "banner" and " 'title', 'identifier', 'content' " with "name". That's all.
– fudu
Aug 1 '18 at 8:40
I've updated the code, please check
– fudu
Aug 1 '18 at 8:52
I have no idea where thatbanner_name
comes from.
– Marius♦
Aug 1 '18 at 8:57
hmmm .. This is weird @@ incase you wanna know the code, i've update the UpgradeSchema.php in my post.
– fudu
Aug 1 '18 at 9:00
|
show 3 more comments
well , I'm trying to follow your code, but it return an error " Installing schema... Upgrading schema... SQLSTATE[42S02]: Base table or view not found: 1146 Table 'magento.banner_name' doesn't exist, query was: DESCRIBEBANNER_NAME
"
– fudu
Aug 1 '18 at 8:39
I was replaced "cms_block" with "banner" and " 'title', 'identifier', 'content' " with "name". That's all.
– fudu
Aug 1 '18 at 8:40
I've updated the code, please check
– fudu
Aug 1 '18 at 8:52
I have no idea where thatbanner_name
comes from.
– Marius♦
Aug 1 '18 at 8:57
hmmm .. This is weird @@ incase you wanna know the code, i've update the UpgradeSchema.php in my post.
– fudu
Aug 1 '18 at 9:00
well , I'm trying to follow your code, but it return an error " Installing schema... Upgrading schema... SQLSTATE[42S02]: Base table or view not found: 1146 Table 'magento.banner_name' doesn't exist, query was: DESCRIBE
BANNER_NAME
"– fudu
Aug 1 '18 at 8:39
well , I'm trying to follow your code, but it return an error " Installing schema... Upgrading schema... SQLSTATE[42S02]: Base table or view not found: 1146 Table 'magento.banner_name' doesn't exist, query was: DESCRIBE
BANNER_NAME
"– fudu
Aug 1 '18 at 8:39
I was replaced "cms_block" with "banner" and " 'title', 'identifier', 'content' " with "name". That's all.
– fudu
Aug 1 '18 at 8:40
I was replaced "cms_block" with "banner" and " 'title', 'identifier', 'content' " with "name". That's all.
– fudu
Aug 1 '18 at 8:40
I've updated the code, please check
– fudu
Aug 1 '18 at 8:52
I've updated the code, please check
– fudu
Aug 1 '18 at 8:52
I have no idea where that
banner_name
comes from.– Marius♦
Aug 1 '18 at 8:57
I have no idea where that
banner_name
comes from.– Marius♦
Aug 1 '18 at 8:57
hmmm .. This is weird @@ incase you wanna know the code, i've update the UpgradeSchema.php in my post.
– fudu
Aug 1 '18 at 9:00
hmmm .. This is weird @@ incase you wanna know the code, i've update the UpgradeSchema.php in my post.
– fudu
Aug 1 '18 at 9:00
|
show 3 more comments
Thanks for contributing an answer to Magento Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f236731%2fmagento-2-2-5-how-cms-page-search-work%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
In which module it's not working?
– Suresh Chikani
Aug 1 '18 at 7:35
Thanks for reply, i'm trying to do the search, so the one is not working is my module. I'll edit the post so you can see my ui-component. :)
– fudu
Aug 1 '18 at 7:47
Edited, please check :D
– fudu
Aug 1 '18 at 7:49
can you post your
InstallSchema.php
file in here ?– Marius♦
Aug 1 '18 at 7:52
Ok, hold on, i'm editing
– fudu
Aug 1 '18 at 7:56