Git Product home page Git Product logo

Comments (9)

aftabnaveed avatar aftabnaveed commented on July 22, 2024

+1

from mongogento.

southerncomputer avatar southerncomputer commented on July 22, 2024

Because Attributes can come from both mysql and mongodb - you would want to load from both and merge otherwise you will not load all attributes! That is my understanding from using this extension!

from mongogento.

yusrub avatar yusrub commented on July 22, 2024

ok thanks for your reply

we are saving all attributes of product in mongo-db is am right?
that why i am saying that we did not need to load attributes from mysql

from mongogento.

southerncomputer avatar southerncomputer commented on July 22, 2024

public function getSqlAttributesCodes()
{
if (is_null($this->_sqlAttributeCodes)) {
$this->_sqlAttributeCodes = array();
$specialAttributes = array(
'visibility', 'status', 'price', 'tax_class_id', 'name', 'url_key', 'url_path',
'special_price', 'special_from_date', 'special_to_date', 'msrp', 'price_type'
);
$staticFields = $this->_getWriteAdapter()->describeTable($this->getEntityTable());
$this->_sqlAttributeCodes = array_merge($specialAttributes, array_keys($staticFields));
}
return $this->_sqlAttributeCodes;
}

These Attributes are never stored in mongodb!

from mongogento.

aftabnaveed avatar aftabnaveed commented on July 22, 2024

If we are still querying the the MYSQL for Attributes would it not kill purpose of using MongoDB? After all that's the whole purpose of using it and avoid querying EAV tables which in this case we are not, in fact it will slow down further, because we will be querying both EAV and now an additional request is sent to Mongo. The attributes you mentioned are already in Mongo.

from mongogento.

yusrub avatar yusrub commented on July 22, 2024

Hi Southerncomputer,

If you import data from mysql to mongo db using shell script, you will see all these attributes stored in mongo-db
public function getSqlAttributesCodes() { if (is_null($this->_sqlAttributeCodes)) { $this->_sqlAttributeCodes = array(); $specialAttributes = array( 'visibility', 'status', 'price', 'tax_class_id', 'name', 'url_key', 'url_path', 'special_price', 'special_from_date', 'special_to_date', 'msrp', 'price_type' ); $staticFields = $this->_getWriteAdapter()->describeTable($this->getEntityTable()); $this->_sqlAttributeCodes = array_merge($specialAttributes, array_keys($staticFields)); } return $this->_sqlAttributeCodes; }
will you checked and confirm

from mongogento.

romainruaud avatar romainruaud commented on July 22, 2024

Hello everybody. @southerncomputer is right, there is some attributes that are kept into MySQL. These attributes are used when rebuilding Magento indexes, so we make them stay in MySQL to avoid having to rewrite all indexes processes. If you remove this data from MySQL, there won't be any index process running properly on your website, so the site may be broken.

Concerning the fact that we are loading these attributes from MySQL when loading a collection, I agree that it may does nothing.

Let's take a look at this : https://github.com/Smile-SA/mongogento/blob/master/src/app/code/community/Smile/MongoCatalog/Model/Resource/Override/Catalog/Product/Collection.php#L461

addAttributeToSelect is dismantled since we do not care about adding attributes to select one by one (we fetch a full mongo document everytime).

This would mean that when reaching this piece of code : http://doc4dev.net/doc/Magento/1/source-class-Mage_Eav_Model_Entity_Collection_Abstract.html#1076

The variable _selectAttributes should alway be empty : so we never build the query to load data from MySQL.

Feel free to test without the parent calls to _loadAttributes and let me know.

Regards

from mongogento.

yusrub avatar yusrub commented on July 22, 2024

I tested without the parent calls to _loadAttributes and it worked fined for me

from mongogento.

southerncomputer avatar southerncomputer commented on July 22, 2024

Perhaps it was legacy before the attribute migration tool that existed - so you could load attributes from mysql and save them to mongodb!

I remember that being the case before the migration tool existed you had to load each product from mysql and save() it to move the attributes to mongodb.

from mongogento.

Related Issues (19)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.