From 0b27de53c6a55e120154ed501b253f27d0988d96 Mon Sep 17 00:00:00 2001 From: javer Date: Wed, 4 Oct 2017 00:04:11 +0300 Subject: [PATCH] Fetch MVAs in the same connection as the main query to respect sql_query_pre --- src/sphinx.cpp | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/sphinx.cpp b/src/sphinx.cpp index 5641d4129..dd9a9aaab 100644 --- a/src/sphinx.cpp +++ b/src/sphinx.cpp @@ -11338,6 +11338,7 @@ int CSphIndex_VLN::Build ( const CSphVector & dSources, int iMemory } bool bHaveFieldMVAs = false; + bool bOnlyFieldMVAs = true; int iFieldLens = m_tSchema.GetAttrId_FirstFieldLen(); CSphVector dMvaIndexes; CSphVector dMvaLocators; @@ -11361,6 +11362,8 @@ int CSphIndex_VLN::Build ( const CSphVector & dSources, int iMemory case SPH_ATTR_UINT32SET: if ( tCol.m_eSrc==SPH_ATTRSRC_FIELD ) bHaveFieldMVAs = true; + else + bOnlyFieldMVAs = false; dMvaIndexes.Add ( i ); dMvaLocators.Add ( tCol.m_tLocator ); break; @@ -11385,6 +11388,8 @@ int CSphIndex_VLN::Build ( const CSphVector & dSources, int iMemory continue; if ( tCol.m_eSrc==SPH_ATTRSRC_FIELD ) bHaveFieldMVAs = true; + else + bOnlyFieldMVAs = false; dMvaIndexes.Add ( i ); dMvaLocators.Add ( tCol.m_tLocator ); } @@ -12120,7 +12125,8 @@ int CSphIndex_VLN::Build ( const CSphVector & dSources, int iMemory } // this source is over, disconnect and update stats - pSource->Disconnect (); + if ( bOnlyFieldMVAs ) + pSource->Disconnect (); m_tStats.m_iTotalDocuments += pSource->GetStats().m_iTotalDocuments; m_tStats.m_iTotalBytes += pSource->GetStats().m_iTotalBytes;