Skip to content

Fulltext count is not the same as original count #5641

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed

Fulltext count is not the same as original count #5641

wants to merge 1 commit into from

Conversation

flancer64
Copy link
Contributor

@flancer64 flancer64 commented Jul 14, 2016

Fulltext results count can be more than original select results count (joinInner is used). Leave $this->_totalRecords empty to initialize later, after actual data have been loaded.

Fulltext results count can be more than original select results count (joinInner is used).
@ghost
Copy link

ghost commented Aug 9, 2016

Opened internal task item MAGETWO-56721

@ghost ghost added the linked label Aug 9, 2016
@vkorotun vkorotun added Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development and removed linked labels Aug 22, 2016
@okorshenko okorshenko assigned okorshenko and unassigned paliarush Mar 17, 2017
@okorshenko okorshenko added this to the March 2017 milestone Mar 17, 2017
@@ -344,8 +344,6 @@ protected function _renderFiltersBefore()
[]
);

$this->_totalRecords = $this->searchResult->getTotalCount();

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fulltext results count can be more than original select results count (joinInner is used). Leave $this->_totalRecords empty to initialize later, after actual data have been loaded.

potentially it can. But in fact join

        $table = $temporaryStorage->storeApiDocuments($this->searchResult->getItems());

        $this->getSelect()->joinInner(
            [
                'search_result' => $table->getName(),
            ],
            'e.entity_id = search_result.' . TemporaryStorage::FIELD_ENTITY_ID,
            []
        );

is just a performance optimization for query
select * from catalog_product_flat where entity_id IN (list_of_10000_ids)
because inner join for temporary table which contains just IDs column with Primary Key on it is much faster than IN clause.

If we will apply additional filter(-s) using Collection Interface which will filter out some data - we will break Layered Navigation. And if we could re-calculate getTotalCount, it's impossible to make that for LN.
So, as for me it's okay to leave everything as is.

@okorshenko okorshenko assigned maghamed and unassigned okorshenko Mar 17, 2017
@maghamed maghamed closed this Mar 17, 2017
@flancer64 flancer64 deleted the patch-3 branch March 21, 2017 05:32
slavvka pushed a commit that referenced this pull request May 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix Component: Search Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants