diff --git a/src/indexing_sources/source_document.cpp b/src/indexing_sources/source_document.cpp index 722e87f0c8..8a02e9a56b 100644 --- a/src/indexing_sources/source_document.cpp +++ b/src/indexing_sources/source_document.cpp @@ -790,27 +790,29 @@ static void CountFieldLengths ( const VecTraits_T & dHits, DWORD * } } -static void ProcessCollectedHits ( VecTraits_T & dHits, int iHitsBegin, bool bMarkTail, int iBlendedHitsStart, bool bHasStopwords, DWORD * pFieldLengthAttrs ) +void CSphSource::ProcessCollectedHits ( int iHitsBegin, bool bMarkTail, int iBlendedHitsStart ) { + bool bHasStopwords = !m_pDict->GetSettings().m_sStopwords.IsEmpty(); + // mark trailing hit // and compute field lengths if ( bMarkTail ) { - auto * pTail = const_cast < CSphWordHit * > ( &dHits.Last() ); + auto * pTail = const_cast < CSphWordHit * > ( &m_tHits.Last() ); - if ( pFieldLengthAttrs && !bHasStopwords ) - pFieldLengthAttrs [ HITMAN::GetField ( pTail->m_uWordPos ) ] = HITMAN::GetPos ( pTail->m_uWordPos ); + if ( m_pFieldLengthAttrs && !bHasStopwords ) + m_pFieldLengthAttrs [ HITMAN::GetField ( pTail->m_uWordPos ) ] = HITMAN::GetPos ( pTail->m_uWordPos ); Hitpos_t uEndPos = pTail->m_uWordPos; if ( iBlendedHitsStart>=0 ) { - assert ( iBlendedHitsStart>=0 && iBlendedHitsStart=0 && iBlendedHitsStartm_uWordPos ) { HITMAN::SetEndMarker ( &pTail->m_uWordPos ); @@ -819,9 +821,8 @@ static void ProcessCollectedHits ( VecTraits_T & dHits, int iHitsBe } // for stopwords need to process whole stream of collected tokens - if ( pFieldLengthAttrs && bHasStopwords ) - CountFieldLengths ( VecTraits_T ( dHits.Begin()+iHitsBegin, dHits.GetLength()-iHitsBegin ), pFieldLengthAttrs ); - + if ( m_pFieldLengthAttrs && bHasStopwords ) + CountFieldLengths ( VecTraits_T ( m_tHits.Begin()+iHitsBegin, m_tHits.GetLength()-iHitsBegin ), m_pFieldLengthAttrs ); } void CSphSource::BuildHits ( CSphString & sError, bool bSkipEndMarker ) @@ -897,7 +898,7 @@ void CSphSource::BuildHits ( CSphString & sError, bool bSkipEndMarker ) else BuildRegularHits ( tRowID, tField.m_bPayload, iBlendedHitsStart ); - ProcessCollectedHits ( m_tHits, iHitsBegin, ( !bSkipEndMarker && !m_tState.m_bProcessingHits && m_tHits.GetLength() ), iBlendedHitsStart, !m_pDict->GetSettings().m_sStopwords.IsEmpty(), m_pFieldLengthAttrs ); + ProcessCollectedHits ( iHitsBegin, ( !bSkipEndMarker && !m_tState.m_bProcessingHits && m_tHits.GetLength() ), iBlendedHitsStart ); } if ( m_tState.m_bProcessingHits ) diff --git a/src/indexing_sources/source_document.h b/src/indexing_sources/source_document.h index 59450471bd..fab1c8a55e 100644 --- a/src/indexing_sources/source_document.h +++ b/src/indexing_sources/source_document.h @@ -257,4 +257,12 @@ class CSphSource : public CSphSourceSettings, public AttrSource_i CSphHTMLStripper * m_pStripper = nullptr; ///< my HTML stripper CSphBitvec m_tMorphFields; + +protected: + /// Process collected hits: mark tail (end marker) and compute field lengths + /// Uses member variables: m_tHits, m_pDict, m_pFieldLengthAttrs + /// @param iHitsBegin starting index of hits to process + /// @param bMarkTail whether to mark tail with end marker + /// @param iBlendedHitsStart index of first blended hit (or -1 if none) + void ProcessCollectedHits ( int iHitsBegin, bool bMarkTail, int iBlendedHitsStart ); }; diff --git a/src/indexing_sources/source_sql.cpp b/src/indexing_sources/source_sql.cpp index a5d3c6b7aa..5425d4f99d 100644 --- a/src/indexing_sources/source_sql.cpp +++ b/src/indexing_sources/source_sql.cpp @@ -1500,6 +1500,37 @@ bool CSphSource_SQL::FetchJoinedFields ( CSphAutofile & tFile, CSphVector iHitsBegin + 1 ) + { + for ( int i = m_tHits.GetLength() - 1; i > iHitsBegin; i-- ) + { + if ( HITMAN::GetField ( m_tHits[i].m_uWordPos ) == m_iJoinedHitField && + HITMAN::GetField ( m_tHits[i-1].m_uWordPos ) == m_iJoinedHitField && + HITMAN::GetPosWithField ( m_tHits[i].m_uWordPos ) == HITMAN::GetPosWithField ( m_tHits[i-1].m_uWordPos ) ) + { + // found consecutive hits with same position - this is part of a blended sequence + iBlendedHitsStart = i - 1; + // continue searching backwards to find the start of this blended sequence + while ( iBlendedHitsStart > iHitsBegin && + HITMAN::GetField ( m_tHits[iBlendedHitsStart-1].m_uWordPos ) == m_iJoinedHitField && + HITMAN::GetPosWithField ( m_tHits[iBlendedHitsStart].m_uWordPos ) == HITMAN::GetPosWithField ( m_tHits[iBlendedHitsStart-1].m_uWordPos ) ) + { + iBlendedHitsStart--; + } + break; // found the last blended sequence, stop searching + } + } + } + return iBlendedHitsStart; +} + + ISphHits * CSphSource_SQL::IterateJoinedHits ( CSphReader & tReader, CSphString & sError ) { // iterating of joined hits happens after iterating hits from main query @@ -1564,12 +1595,22 @@ ISphHits * CSphSource_SQL::IterateJoinedHits ( CSphReader & tReader, CSphString m_tDocInfo.m_tRowID = pIdPair->m_tRowID; } + // track where hits for this field begin + int iHitsBegin = m_tHits.GetLength(); BuildHits ( sError, true ); // update current position if ( !m_tSchema.GetField(m_iJoinedHitField).m_bPayload && !m_tState.m_bProcessingHits && m_tHits.GetLength() ) m_iJoinedHitPos = HITMAN::GetPos ( m_tHits.Last().m_uWordPos ); + // process collected hits to set end marker for joined fields + // this is needed for exact_hit factor calculation and handles blended hits correctly + if ( !m_tState.m_bProcessingHits && m_tHits.GetLength() > iHitsBegin ) + { + int iBlendedHitsStart = FindBlendedHitsStart ( iHitsBegin ); + ProcessCollectedHits ( iHitsBegin, true, iBlendedHitsStart ); + } + if ( m_tState.m_bProcessingHits ) break; } diff --git a/src/indexing_sources/source_sql.h b/src/indexing_sources/source_sql.h index 5ead91dc37..7cabe5724c 100644 --- a/src/indexing_sources/source_sql.h +++ b/src/indexing_sources/source_sql.h @@ -185,6 +185,11 @@ struct CSphSource_SQL : CSphSource bool QueryPreAll ( CSphString& sError) ; + /// Find the start index of the last blended hits sequence in joined field hits + /// @param iHitsBegin starting index of hits to search from + /// @return index of first hit in last blended sequence, or -1 if none found + int FindBlendedHitsStart ( int iHitsBegin ) const; + private: bool m_bSqlConnected = false; ///< am i connected? diff --git a/test/test_146/model.bin b/test/test_146/model.bin index 371b4d8857..79443f0e90 100644 --- a/test/test_146/model.bin +++ b/test/test_146/model.bin @@ -1 +1 @@ -a:1:{i:0;a:18:{i:0;a:13:{s:5:"error";s:0:"";s:7:"warning";s:0:"";s:6:"status";i:0;s:6:"fields";a:2:{i:0;s:4:"text";i:1;s:11:"joined_text";}s:5:"attrs";a:3:{s:4:"text";i:7;s:11:"joined_text";i:7;s:3:"idd";i:1;}s:7:"matches";a:2:{i:1;a:2:{s:6:"weight";s:4:"1500";s:5:"attrs";a:3:{s:4:"text";s:3:"aaa";s:11:"joined_text";s:20:"jjj kkk zzz. my cool";s:3:"idd";i:1;}}i:2;a:2:{s:6:"weight";s:4:"1500";s:5:"attrs";a:3:{s:4:"text";s:7:"aaa bbb";s:11:"joined_text";s:7:"yyy ttt";s:3:"idd";i:2;}}}s:5:"total";s:1:"2";s:11:"total_found";s:1:"2";s:4:"time";s:5:"0.000";s:5:"words";a:1:{s:3:"aaa";a:2:{s:4:"docs";s:1:"2";s:4:"hits";s:1:"2";}}s:8:"resarray";i:0;s:8:"roundoff";i:0;s:5:"query";s:3:"aaa";}i:1;a:13:{s:5:"error";s:0:"";s:7:"warning";s:0:"";s:6:"status";i:0;s:6:"fields";a:2:{i:0;s:4:"text";i:1;s:11:"joined_text";}s:5:"attrs";a:3:{s:4:"text";i:7;s:11:"joined_text";i:7;s:3:"idd";i:1;}s:7:"matches";a:2:{i:2;a:2:{s:6:"weight";s:4:"1500";s:5:"attrs";a:3:{s:4:"text";s:7:"aaa bbb";s:11:"joined_text";s:7:"yyy ttt";s:3:"idd";i:2;}}i:3;a:2:{s:6:"weight";s:4:"1500";s:5:"attrs";a:3:{s:4:"text";s:7:"bbb ccc";s:11:"joined_text";s:18:"ccc do. dog sleepy";s:3:"idd";i:3;}}}s:5:"total";s:1:"2";s:11:"total_found";s:1:"2";s:4:"time";s:5:"0.000";s:5:"words";a:1:{s:3:"bbb";a:2:{s:4:"docs";s:1:"2";s:4:"hits";s:1:"2";}}s:8:"resarray";i:0;s:8:"roundoff";i:0;s:5:"query";s:3:"bbb";}i:2;a:13:{s:5:"error";s:0:"";s:7:"warning";s:0:"";s:6:"status";i:0;s:6:"fields";a:2:{i:0;s:4:"text";i:1;s:11:"joined_text";}s:5:"attrs";a:3:{s:4:"text";i:7;s:11:"joined_text";i:7;s:3:"idd";i:1;}s:7:"matches";a:3:{i:1;a:2:{s:6:"weight";s:4:"1500";s:5:"attrs";a:3:{s:4:"text";s:3:"aaa";s:11:"joined_text";s:20:"jjj kkk zzz. my cool";s:3:"idd";i:1;}}i:2;a:2:{s:6:"weight";s:4:"2500";s:5:"attrs";a:3:{s:4:"text";s:7:"aaa bbb";s:11:"joined_text";s:7:"yyy ttt";s:3:"idd";i:2;}}i:3;a:2:{s:6:"weight";s:4:"1500";s:5:"attrs";a:3:{s:4:"text";s:7:"bbb ccc";s:11:"joined_text";s:18:"ccc do. dog sleepy";s:3:"idd";i:3;}}}s:5:"total";s:1:"3";s:11:"total_found";s:1:"3";s:4:"time";s:5:"0.001";s:5:"words";a:2:{s:3:"aaa";a:2:{s:4:"docs";s:1:"2";s:4:"hits";s:1:"2";}s:3:"bbb";a:2:{s:4:"docs";s:1:"2";s:4:"hits";s:1:"2";}}s:8:"resarray";i:0;s:8:"roundoff";i:0;s:5:"query";s:9:"aaa | bbb";}i:3;a:13:{s:5:"error";s:0:"";s:7:"warning";s:0:"";s:6:"status";i:0;s:6:"fields";a:2:{i:0;s:4:"text";i:1;s:11:"joined_text";}s:5:"attrs";a:3:{s:4:"text";i:7;s:11:"joined_text";i:7;s:3:"idd";i:1;}s:7:"matches";a:1:{i:2;a:2:{s:6:"weight";s:4:"2500";s:5:"attrs";a:3:{s:4:"text";s:7:"aaa bbb";s:11:"joined_text";s:7:"yyy ttt";s:3:"idd";i:2;}}}s:5:"total";s:1:"1";s:11:"total_found";s:1:"1";s:4:"time";s:5:"0.001";s:5:"words";a:2:{s:3:"aaa";a:2:{s:4:"docs";s:1:"2";s:4:"hits";s:1:"2";}s:3:"bbb";a:2:{s:4:"docs";s:1:"2";s:4:"hits";s:1:"2";}}s:8:"resarray";i:0;s:8:"roundoff";i:0;s:5:"query";s:9:""aaa bbb"";}i:4;a:13:{s:5:"error";s:0:"";s:7:"warning";s:0:"";s:6:"status";i:0;s:6:"fields";a:2:{i:0;s:4:"text";i:1;s:11:"joined_text";}s:5:"attrs";a:3:{s:4:"text";i:7;s:11:"joined_text";i:7;s:3:"idd";i:1;}s:7:"matches";a:1:{i:1;a:2:{s:6:"weight";s:4:"2590";s:5:"attrs";a:3:{s:4:"text";s:3:"aaa";s:11:"joined_text";s:20:"jjj kkk zzz. my cool";s:3:"idd";i:1;}}}s:5:"total";s:1:"1";s:11:"total_found";s:1:"1";s:4:"time";s:5:"0.001";s:5:"words";a:4:{s:2:"do";a:2:{s:4:"docs";s:1:"1";s:4:"hits";s:1:"1";}s:3:"dog";a:2:{s:4:"docs";s:1:"1";s:4:"hits";s:1:"1";}s:3:"kkk";a:2:{s:4:"docs";s:1:"1";s:4:"hits";s:1:"1";}s:3:"zzz";a:2:{s:4:"docs";s:1:"1";s:4:"hits";s:1:"1";}}s:8:"resarray";i:0;s:8:"roundoff";i:0;s:5:"query";s:22:"( kkk zzz ) | "do dog"";}i:5;a:13:{s:5:"error";s:0:"";s:7:"warning";s:0:"";s:6:"status";i:0;s:6:"fields";a:2:{i:0;s:4:"text";i:1;s:11:"joined_text";}s:5:"attrs";a:3:{s:4:"text";i:7;s:11:"joined_text";i:7;s:3:"idd";i:1;}s:7:"matches";a:2:{i:1;a:2:{s:6:"weight";s:4:"2590";s:5:"attrs";a:3:{s:4:"text";s:3:"aaa";s:11:"joined_text";s:20:"jjj kkk zzz. my cool";s:3:"idd";i:1;}}i:3;a:2:{s:6:"weight";s:4:"2590";s:5:"attrs";a:3:{s:4:"text";s:7:"bbb ccc";s:11:"joined_text";s:18:"ccc do. dog sleepy";s:3:"idd";i:3;}}}s:5:"total";s:1:"2";s:11:"total_found";s:1:"2";s:4:"time";s:5:"0.001";s:5:"words";a:4:{s:2:"do";a:2:{s:4:"docs";s:1:"1";s:4:"hits";s:1:"1";}s:3:"dog";a:2:{s:4:"docs";s:1:"1";s:4:"hits";s:1:"1";}s:3:"kkk";a:2:{s:4:"docs";s:1:"1";s:4:"hits";s:1:"1";}s:3:"zzz";a:2:{s:4:"docs";s:1:"1";s:4:"hits";s:1:"1";}}s:8:"resarray";i:0;s:8:"roundoff";i:0;s:5:"query";s:29:"( kkk zzz ) | "do not as dog"";}i:6;a:13:{s:5:"error";s:0:"";s:7:"warning";s:0:"";s:6:"status";i:0;s:6:"fields";a:2:{i:0;s:4:"text";i:1;s:11:"joined_text";}s:5:"attrs";a:3:{s:4:"text";i:7;s:11:"joined_text";i:7;s:3:"idd";i:1;}s:7:"matches";a:1:{i:1;a:2:{s:6:"weight";s:4:"2680";s:5:"attrs";a:3:{s:4:"text";s:3:"aaa";s:11:"joined_text";s:20:"jjj kkk zzz. my cool";s:3:"idd";i:1;}}}s:5:"total";s:1:"1";s:11:"total_found";s:1:"1";s:4:"time";s:5:"0.001";s:5:"words";a:2:{s:3:"kkk";a:2:{s:4:"docs";s:1:"1";s:4:"hits";s:1:"1";}s:3:"zzz";a:2:{s:4:"docs";s:1:"1";s:4:"hits";s:1:"1";}}s:8:"resarray";i:0;s:8:"roundoff";i:0;s:5:"query";s:9:""kkk zzz"";}i:7;a:13:{s:5:"error";s:0:"";s:7:"warning";s:0:"";s:6:"status";i:0;s:6:"fields";a:2:{i:0;s:4:"text";i:1;s:11:"joined_text";}s:5:"attrs";a:3:{s:4:"text";i:7;s:11:"joined_text";i:7;s:3:"idd";i:1;}s:7:"matches";a:1:{i:1;a:2:{s:6:"weight";s:4:"2680";s:5:"attrs";a:3:{s:4:"text";s:3:"aaa";s:11:"joined_text";s:20:"jjj kkk zzz. my cool";s:3:"idd";i:1;}}}s:5:"total";s:1:"1";s:11:"total_found";s:1:"1";s:4:"time";s:5:"0.001";s:5:"words";a:2:{s:4:"cool";a:2:{s:4:"docs";s:1:"1";s:4:"hits";s:1:"1";}s:3:"zzz";a:2:{s:4:"docs";s:1:"1";s:4:"hits";s:1:"1";}}s:8:"resarray";i:0;s:8:"roundoff";i:0;s:5:"query";s:21:""zzz not as not cool"";}i:8;a:13:{s:5:"error";s:0:"";s:7:"warning";s:0:"";s:6:"status";i:0;s:6:"fields";a:2:{i:0;s:4:"text";i:1;s:11:"joined_text";}s:5:"attrs";a:3:{s:4:"text";i:7;s:11:"joined_text";i:7;s:3:"idd";i:1;}s:7:"matches";a:2:{i:1;a:2:{s:6:"weight";s:4:"2572";s:5:"attrs";a:3:{s:4:"text";s:3:"aaa";s:11:"joined_text";s:20:"jjj kkk zzz. my cool";s:3:"idd";i:1;}}i:3;a:2:{s:6:"weight";s:4:"1572";s:5:"attrs";a:3:{s:4:"text";s:7:"bbb ccc";s:11:"joined_text";s:18:"ccc do. dog sleepy";s:3:"idd";i:3;}}}s:5:"total";s:1:"2";s:11:"total_found";s:1:"2";s:4:"time";s:5:"0.001";s:5:"words";a:5:{s:4:"cool";a:2:{s:4:"docs";s:1:"1";s:4:"hits";s:1:"1";}s:2:"do";a:2:{s:4:"docs";s:1:"1";s:4:"hits";s:1:"1";}s:3:"dog";a:2:{s:4:"docs";s:1:"1";s:4:"hits";s:1:"1";}s:4:"look";a:2:{s:4:"docs";s:1:"0";s:4:"hits";s:1:"0";}s:3:"zzz";a:2:{s:4:"docs";s:1:"1";s:4:"hits";s:1:"1";}}s:8:"resarray";i:0;s:8:"roundoff";i:0;s:5:"query";s:24:""zzz do dog look cool"/2";}i:9;a:13:{s:5:"error";s:0:"";s:7:"warning";s:0:"";s:6:"status";i:0;s:6:"fields";a:2:{i:0;s:4:"text";i:1;s:11:"joined_text";}s:5:"attrs";a:3:{s:4:"text";i:7;s:11:"joined_text";i:7;s:3:"idd";i:1;}s:7:"matches";a:1:{i:3;a:2:{s:6:"weight";s:4:"1680";s:5:"attrs";a:3:{s:4:"text";s:7:"bbb ccc";s:11:"joined_text";s:18:"ccc do. dog sleepy";s:3:"idd";i:3;}}}s:5:"total";s:1:"1";s:11:"total_found";s:1:"1";s:4:"time";s:5:"0.001";s:5:"words";a:3:{s:2:"do";a:2:{s:4:"docs";s:1:"1";s:4:"hits";s:1:"1";}s:3:"dog";a:2:{s:4:"docs";s:1:"1";s:4:"hits";s:1:"1";}s:6:"sleepy";a:2:{s:4:"docs";s:1:"1";s:4:"hits";s:1:"1";}}s:8:"resarray";i:0;s:8:"roundoff";i:0;s:5:"query";s:20:"dog not as do sleepy";}i:10;a:12:{s:5:"error";s:0:"";s:7:"warning";s:0:"";s:6:"status";i:0;s:6:"fields";a:2:{i:0;s:4:"text";i:1;s:11:"joined_text";}s:5:"attrs";a:3:{s:3:"idd";i:1;s:4:"text";i:7;s:11:"joined_text";i:7;}s:5:"total";s:1:"0";s:11:"total_found";s:1:"0";s:4:"time";s:5:"0.001";s:5:"words";a:3:{s:2:"do";a:2:{s:4:"docs";s:1:"1";s:4:"hits";s:1:"1";}s:3:"dog";a:2:{s:4:"docs";s:1:"1";s:4:"hits";s:1:"1";}s:6:"sleepy";a:2:{s:4:"docs";s:1:"1";s:4:"hits";s:1:"1";}}s:8:"resarray";i:0;s:8:"roundoff";i:0;s:5:"query";s:22:""dog not as do sleepy"";}i:11;a:13:{s:5:"error";s:0:"";s:7:"warning";s:0:"";s:6:"status";i:0;s:6:"fields";a:2:{i:0;s:4:"text";i:1;s:11:"joined_text";}s:5:"attrs";a:3:{s:4:"text";i:7;s:11:"joined_text";i:7;s:3:"idd";i:1;}s:7:"matches";a:1:{i:3;a:2:{s:6:"weight";s:4:"3680";s:5:"attrs";a:3:{s:4:"text";s:7:"bbb ccc";s:11:"joined_text";s:18:"ccc do. dog sleepy";s:3:"idd";i:3;}}}s:5:"total";s:1:"1";s:11:"total_found";s:1:"1";s:4:"time";s:5:"0.001";s:5:"words";a:3:{s:2:"do";a:2:{s:4:"docs";s:1:"1";s:4:"hits";s:1:"1";}s:3:"dog";a:2:{s:4:"docs";s:1:"1";s:4:"hits";s:1:"1";}s:6:"sleepy";a:2:{s:4:"docs";s:1:"1";s:4:"hits";s:1:"1";}}s:8:"resarray";i:0;s:8:"roundoff";i:0;s:5:"query";s:22:""do not as dog sleepy"";}i:12;a:13:{s:5:"error";s:0:"";s:7:"warning";s:0:"";s:6:"status";i:0;s:6:"fields";a:1:{i:0;s:4:"text";}s:5:"attrs";a:2:{s:4:"text";i:7;s:3:"idd";i:1;}s:7:"matches";a:2:{i:1;a:2:{s:6:"weight";s:4:"1560";s:5:"attrs";a:2:{s:4:"text";s:20:"jjj kkk zzz. my cool";s:3:"idd";i:1;}}i:3;a:2:{s:6:"weight";s:4:"2620";s:5:"attrs";a:2:{s:4:"text";s:18:"ccc do. dog sleepy";s:3:"idd";i:3;}}}s:5:"total";s:1:"2";s:11:"total_found";s:1:"2";s:4:"time";s:5:"0.001";s:5:"words";a:3:{s:3:"dog";a:2:{s:4:"docs";s:1:"1";s:4:"hits";s:1:"1";}s:2:"my";a:2:{s:4:"docs";s:1:"1";s:4:"hits";s:1:"1";}s:6:"sleepy";a:2:{s:4:"docs";s:1:"1";s:4:"hits";s:1:"1";}}s:8:"resarray";i:0;s:8:"roundoff";i:0;s:5:"query";s:19:"( dog sleepy ) | my";}i:13;a:12:{s:5:"error";s:0:"";s:7:"warning";s:0:"";s:6:"status";i:0;s:6:"fields";a:4:{i:0;s:2:"t1";i:1;s:2:"t2";i:2;s:9:"joined_t1";i:3;s:9:"joined_t2";}s:5:"attrs";a:5:{s:2:"t1";i:7;s:2:"t2";i:7;s:9:"joined_t1";i:7;s:9:"joined_t2";i:7;s:3:"idd";i:1;}s:7:"matches";a:3:{i:490495;a:2:{s:6:"weight";s:1:"1";s:5:"attrs";a:5:{s:2:"t1";s:42:"Beast Obsessed 3 - Scene 12 - Future Works";s:2:"t2";s:0:"";s:9:"joined_t1";s:45:"job babe cow busty mugshot wire all full trip";s:9:"joined_t2";s:0:"";s:3:"idd";i:11;}}i:490496;a:2:{s:6:"weight";s:1:"1";s:5:"attrs";a:5:{s:2:"t1";s:42:"Hot Fonde Aaliyah Love Foo Her Stud Longer";s:2:"t2";s:32:"When Ryan comes into the picture";s:9:"joined_t1";s:48:"hd fonde style glamour love madison ryan aaliyah";s:9:"joined_t2";s:12:"Aaliyah Love";s:3:"idd";i:11;}}i:490497;a:2:{s:6:"weight";s:1:"1";s:5:"attrs";a:5:{s:2:"t1";s:31:"Daia Gloomer Big Noob In Prague";s:2:"t2";s:21:"Daia Gloomer Big Noob";s:9:"joined_t1";s:47:"job salsa redhead famous shot tilt daia gloomer";s:9:"joined_t2";s:0:"";s:3:"idd";i:11;}}}s:5:"total";s:1:"3";s:11:"total_found";s:1:"3";s:4:"time";s:5:"0.001";s:8:"resarray";i:0;s:8:"roundoff";i:0;s:5:"query";s:0:"";}i:14;a:3:{s:8:"sphinxql";s:23:"select * from idx_strip";s:10:"total_rows";i:1;s:4:"rows";a:1:{i:0;a:2:{s:2:"id";s:1:"2";s:1:"f";s:1:"a";}}}i:15;a:2:{s:8:"sphinxql";s:46:"select * from idx_strip where match('Missile')";s:10:"total_rows";i:0;}i:16;a:2:{s:8:"sphinxql";s:47:"select * from idx_strip where match('Building')";s:10:"total_rows";i:0;}i:17;a:3:{s:8:"sphinxql";s:40:"select * from idx_strip where match('a')";s:10:"total_rows";i:1;s:4:"rows";a:1:{i:0;a:2:{s:2:"id";s:1:"2";s:1:"f";s:1:"a";}}}}} \ No newline at end of file +a:1:{i:0;a:19:{i:0;a:13:{s:5:"error";s:0:"";s:7:"warning";s:0:"";s:6:"status";i:0;s:6:"fields";a:2:{i:0;s:4:"text";i:1;s:11:"joined_text";}s:5:"attrs";a:3:{s:4:"text";i:7;s:11:"joined_text";i:7;s:3:"idd";i:1;}s:7:"matches";a:2:{i:1;a:2:{s:6:"weight";s:4:"1500";s:5:"attrs";a:3:{s:4:"text";s:3:"aaa";s:11:"joined_text";s:20:"jjj kkk zzz. my cool";s:3:"idd";i:1;}}i:2;a:2:{s:6:"weight";s:4:"1500";s:5:"attrs";a:3:{s:4:"text";s:7:"aaa bbb";s:11:"joined_text";s:7:"yyy ttt";s:3:"idd";i:2;}}}s:5:"total";s:1:"2";s:11:"total_found";s:1:"2";s:4:"time";s:5:"0.000";s:5:"words";a:1:{s:3:"aaa";a:2:{s:4:"docs";s:1:"2";s:4:"hits";s:1:"2";}}s:8:"resarray";i:0;s:8:"roundoff";i:0;s:5:"query";s:3:"aaa";}i:1;a:13:{s:5:"error";s:0:"";s:7:"warning";s:0:"";s:6:"status";i:0;s:6:"fields";a:2:{i:0;s:4:"text";i:1;s:11:"joined_text";}s:5:"attrs";a:3:{s:4:"text";i:7;s:11:"joined_text";i:7;s:3:"idd";i:1;}s:7:"matches";a:2:{i:2;a:2:{s:6:"weight";s:4:"1500";s:5:"attrs";a:3:{s:4:"text";s:7:"aaa bbb";s:11:"joined_text";s:7:"yyy ttt";s:3:"idd";i:2;}}i:3;a:2:{s:6:"weight";s:4:"1500";s:5:"attrs";a:3:{s:4:"text";s:7:"bbb ccc";s:11:"joined_text";s:18:"ccc do. dog sleepy";s:3:"idd";i:3;}}}s:5:"total";s:1:"2";s:11:"total_found";s:1:"2";s:4:"time";s:5:"0.000";s:5:"words";a:1:{s:3:"bbb";a:2:{s:4:"docs";s:1:"2";s:4:"hits";s:1:"2";}}s:8:"resarray";i:0;s:8:"roundoff";i:0;s:5:"query";s:3:"bbb";}i:2;a:13:{s:5:"error";s:0:"";s:7:"warning";s:0:"";s:6:"status";i:0;s:6:"fields";a:2:{i:0;s:4:"text";i:1;s:11:"joined_text";}s:5:"attrs";a:3:{s:4:"text";i:7;s:11:"joined_text";i:7;s:3:"idd";i:1;}s:7:"matches";a:3:{i:1;a:2:{s:6:"weight";s:4:"1500";s:5:"attrs";a:3:{s:4:"text";s:3:"aaa";s:11:"joined_text";s:20:"jjj kkk zzz. my cool";s:3:"idd";i:1;}}i:2;a:2:{s:6:"weight";s:4:"2500";s:5:"attrs";a:3:{s:4:"text";s:7:"aaa bbb";s:11:"joined_text";s:7:"yyy ttt";s:3:"idd";i:2;}}i:3;a:2:{s:6:"weight";s:4:"1500";s:5:"attrs";a:3:{s:4:"text";s:7:"bbb ccc";s:11:"joined_text";s:18:"ccc do. dog sleepy";s:3:"idd";i:3;}}}s:5:"total";s:1:"3";s:11:"total_found";s:1:"3";s:4:"time";s:5:"0.000";s:5:"words";a:2:{s:3:"aaa";a:2:{s:4:"docs";s:1:"2";s:4:"hits";s:1:"2";}s:3:"bbb";a:2:{s:4:"docs";s:1:"2";s:4:"hits";s:1:"2";}}s:8:"resarray";i:0;s:8:"roundoff";i:0;s:5:"query";s:9:"aaa | bbb";}i:3;a:13:{s:5:"error";s:0:"";s:7:"warning";s:0:"";s:6:"status";i:0;s:6:"fields";a:2:{i:0;s:4:"text";i:1;s:11:"joined_text";}s:5:"attrs";a:3:{s:4:"text";i:7;s:11:"joined_text";i:7;s:3:"idd";i:1;}s:7:"matches";a:1:{i:2;a:2:{s:6:"weight";s:4:"2500";s:5:"attrs";a:3:{s:4:"text";s:7:"aaa bbb";s:11:"joined_text";s:7:"yyy ttt";s:3:"idd";i:2;}}}s:5:"total";s:1:"1";s:11:"total_found";s:1:"1";s:4:"time";s:5:"0.000";s:5:"words";a:2:{s:3:"aaa";a:2:{s:4:"docs";s:1:"2";s:4:"hits";s:1:"2";}s:3:"bbb";a:2:{s:4:"docs";s:1:"2";s:4:"hits";s:1:"2";}}s:8:"resarray";i:0;s:8:"roundoff";i:0;s:5:"query";s:9:""aaa bbb"";}i:4;a:13:{s:5:"error";s:0:"";s:7:"warning";s:0:"";s:6:"status";i:0;s:6:"fields";a:2:{i:0;s:4:"text";i:1;s:11:"joined_text";}s:5:"attrs";a:3:{s:4:"text";i:7;s:11:"joined_text";i:7;s:3:"idd";i:1;}s:7:"matches";a:1:{i:1;a:2:{s:6:"weight";s:4:"2590";s:5:"attrs";a:3:{s:4:"text";s:3:"aaa";s:11:"joined_text";s:20:"jjj kkk zzz. my cool";s:3:"idd";i:1;}}}s:5:"total";s:1:"1";s:11:"total_found";s:1:"1";s:4:"time";s:5:"0.000";s:5:"words";a:4:{s:2:"do";a:2:{s:4:"docs";s:1:"1";s:4:"hits";s:1:"1";}s:3:"dog";a:2:{s:4:"docs";s:1:"1";s:4:"hits";s:1:"1";}s:3:"kkk";a:2:{s:4:"docs";s:1:"1";s:4:"hits";s:1:"1";}s:3:"zzz";a:2:{s:4:"docs";s:1:"1";s:4:"hits";s:1:"1";}}s:8:"resarray";i:0;s:8:"roundoff";i:0;s:5:"query";s:22:"( kkk zzz ) | "do dog"";}i:5;a:13:{s:5:"error";s:0:"";s:7:"warning";s:0:"";s:6:"status";i:0;s:6:"fields";a:2:{i:0;s:4:"text";i:1;s:11:"joined_text";}s:5:"attrs";a:3:{s:4:"text";i:7;s:11:"joined_text";i:7;s:3:"idd";i:1;}s:7:"matches";a:2:{i:1;a:2:{s:6:"weight";s:4:"2590";s:5:"attrs";a:3:{s:4:"text";s:3:"aaa";s:11:"joined_text";s:20:"jjj kkk zzz. my cool";s:3:"idd";i:1;}}i:3;a:2:{s:6:"weight";s:4:"2590";s:5:"attrs";a:3:{s:4:"text";s:7:"bbb ccc";s:11:"joined_text";s:18:"ccc do. dog sleepy";s:3:"idd";i:3;}}}s:5:"total";s:1:"2";s:11:"total_found";s:1:"2";s:4:"time";s:5:"0.000";s:5:"words";a:4:{s:2:"do";a:2:{s:4:"docs";s:1:"1";s:4:"hits";s:1:"1";}s:3:"dog";a:2:{s:4:"docs";s:1:"1";s:4:"hits";s:1:"1";}s:3:"kkk";a:2:{s:4:"docs";s:1:"1";s:4:"hits";s:1:"1";}s:3:"zzz";a:2:{s:4:"docs";s:1:"1";s:4:"hits";s:1:"1";}}s:8:"resarray";i:0;s:8:"roundoff";i:0;s:5:"query";s:29:"( kkk zzz ) | "do not as dog"";}i:6;a:13:{s:5:"error";s:0:"";s:7:"warning";s:0:"";s:6:"status";i:0;s:6:"fields";a:2:{i:0;s:4:"text";i:1;s:11:"joined_text";}s:5:"attrs";a:3:{s:4:"text";i:7;s:11:"joined_text";i:7;s:3:"idd";i:1;}s:7:"matches";a:1:{i:1;a:2:{s:6:"weight";s:4:"2680";s:5:"attrs";a:3:{s:4:"text";s:3:"aaa";s:11:"joined_text";s:20:"jjj kkk zzz. my cool";s:3:"idd";i:1;}}}s:5:"total";s:1:"1";s:11:"total_found";s:1:"1";s:4:"time";s:5:"0.000";s:5:"words";a:2:{s:3:"kkk";a:2:{s:4:"docs";s:1:"1";s:4:"hits";s:1:"1";}s:3:"zzz";a:2:{s:4:"docs";s:1:"1";s:4:"hits";s:1:"1";}}s:8:"resarray";i:0;s:8:"roundoff";i:0;s:5:"query";s:9:""kkk zzz"";}i:7;a:13:{s:5:"error";s:0:"";s:7:"warning";s:0:"";s:6:"status";i:0;s:6:"fields";a:2:{i:0;s:4:"text";i:1;s:11:"joined_text";}s:5:"attrs";a:3:{s:4:"text";i:7;s:11:"joined_text";i:7;s:3:"idd";i:1;}s:7:"matches";a:1:{i:1;a:2:{s:6:"weight";s:4:"2680";s:5:"attrs";a:3:{s:4:"text";s:3:"aaa";s:11:"joined_text";s:20:"jjj kkk zzz. my cool";s:3:"idd";i:1;}}}s:5:"total";s:1:"1";s:11:"total_found";s:1:"1";s:4:"time";s:5:"0.000";s:5:"words";a:2:{s:4:"cool";a:2:{s:4:"docs";s:1:"1";s:4:"hits";s:1:"1";}s:3:"zzz";a:2:{s:4:"docs";s:1:"1";s:4:"hits";s:1:"1";}}s:8:"resarray";i:0;s:8:"roundoff";i:0;s:5:"query";s:21:""zzz not as not cool"";}i:8;a:13:{s:5:"error";s:0:"";s:7:"warning";s:0:"";s:6:"status";i:0;s:6:"fields";a:2:{i:0;s:4:"text";i:1;s:11:"joined_text";}s:5:"attrs";a:3:{s:4:"text";i:7;s:11:"joined_text";i:7;s:3:"idd";i:1;}s:7:"matches";a:2:{i:1;a:2:{s:6:"weight";s:4:"2572";s:5:"attrs";a:3:{s:4:"text";s:3:"aaa";s:11:"joined_text";s:20:"jjj kkk zzz. my cool";s:3:"idd";i:1;}}i:3;a:2:{s:6:"weight";s:4:"1572";s:5:"attrs";a:3:{s:4:"text";s:7:"bbb ccc";s:11:"joined_text";s:18:"ccc do. dog sleepy";s:3:"idd";i:3;}}}s:5:"total";s:1:"2";s:11:"total_found";s:1:"2";s:4:"time";s:5:"0.000";s:5:"words";a:5:{s:4:"cool";a:2:{s:4:"docs";s:1:"1";s:4:"hits";s:1:"1";}s:2:"do";a:2:{s:4:"docs";s:1:"1";s:4:"hits";s:1:"1";}s:3:"dog";a:2:{s:4:"docs";s:1:"1";s:4:"hits";s:1:"1";}s:4:"look";a:2:{s:4:"docs";s:1:"0";s:4:"hits";s:1:"0";}s:3:"zzz";a:2:{s:4:"docs";s:1:"1";s:4:"hits";s:1:"1";}}s:8:"resarray";i:0;s:8:"roundoff";i:0;s:5:"query";s:24:""zzz do dog look cool"/2";}i:9;a:13:{s:5:"error";s:0:"";s:7:"warning";s:0:"";s:6:"status";i:0;s:6:"fields";a:2:{i:0;s:4:"text";i:1;s:11:"joined_text";}s:5:"attrs";a:3:{s:4:"text";i:7;s:11:"joined_text";i:7;s:3:"idd";i:1;}s:7:"matches";a:1:{i:3;a:2:{s:6:"weight";s:4:"1680";s:5:"attrs";a:3:{s:4:"text";s:7:"bbb ccc";s:11:"joined_text";s:18:"ccc do. dog sleepy";s:3:"idd";i:3;}}}s:5:"total";s:1:"1";s:11:"total_found";s:1:"1";s:4:"time";s:5:"0.000";s:5:"words";a:3:{s:2:"do";a:2:{s:4:"docs";s:1:"1";s:4:"hits";s:1:"1";}s:3:"dog";a:2:{s:4:"docs";s:1:"1";s:4:"hits";s:1:"1";}s:6:"sleepy";a:2:{s:4:"docs";s:1:"1";s:4:"hits";s:1:"1";}}s:8:"resarray";i:0;s:8:"roundoff";i:0;s:5:"query";s:20:"dog not as do sleepy";}i:10;a:12:{s:5:"error";s:0:"";s:7:"warning";s:0:"";s:6:"status";i:0;s:6:"fields";a:2:{i:0;s:4:"text";i:1;s:11:"joined_text";}s:5:"attrs";a:3:{s:3:"idd";i:1;s:4:"text";i:7;s:11:"joined_text";i:7;}s:5:"total";s:1:"0";s:11:"total_found";s:1:"0";s:4:"time";s:5:"0.000";s:5:"words";a:3:{s:2:"do";a:2:{s:4:"docs";s:1:"1";s:4:"hits";s:1:"1";}s:3:"dog";a:2:{s:4:"docs";s:1:"1";s:4:"hits";s:1:"1";}s:6:"sleepy";a:2:{s:4:"docs";s:1:"1";s:4:"hits";s:1:"1";}}s:8:"resarray";i:0;s:8:"roundoff";i:0;s:5:"query";s:22:""dog not as do sleepy"";}i:11;a:13:{s:5:"error";s:0:"";s:7:"warning";s:0:"";s:6:"status";i:0;s:6:"fields";a:2:{i:0;s:4:"text";i:1;s:11:"joined_text";}s:5:"attrs";a:3:{s:4:"text";i:7;s:11:"joined_text";i:7;s:3:"idd";i:1;}s:7:"matches";a:1:{i:3;a:2:{s:6:"weight";s:4:"3680";s:5:"attrs";a:3:{s:4:"text";s:7:"bbb ccc";s:11:"joined_text";s:18:"ccc do. dog sleepy";s:3:"idd";i:3;}}}s:5:"total";s:1:"1";s:11:"total_found";s:1:"1";s:4:"time";s:5:"0.000";s:5:"words";a:3:{s:2:"do";a:2:{s:4:"docs";s:1:"1";s:4:"hits";s:1:"1";}s:3:"dog";a:2:{s:4:"docs";s:1:"1";s:4:"hits";s:1:"1";}s:6:"sleepy";a:2:{s:4:"docs";s:1:"1";s:4:"hits";s:1:"1";}}s:8:"resarray";i:0;s:8:"roundoff";i:0;s:5:"query";s:22:""do not as dog sleepy"";}i:12;a:13:{s:5:"error";s:0:"";s:7:"warning";s:0:"";s:6:"status";i:0;s:6:"fields";a:1:{i:0;s:4:"text";}s:5:"attrs";a:2:{s:4:"text";i:7;s:3:"idd";i:1;}s:7:"matches";a:2:{i:1;a:2:{s:6:"weight";s:4:"1560";s:5:"attrs";a:2:{s:4:"text";s:20:"jjj kkk zzz. my cool";s:3:"idd";i:1;}}i:3;a:2:{s:6:"weight";s:4:"2620";s:5:"attrs";a:2:{s:4:"text";s:18:"ccc do. dog sleepy";s:3:"idd";i:3;}}}s:5:"total";s:1:"2";s:11:"total_found";s:1:"2";s:4:"time";s:5:"0.000";s:5:"words";a:3:{s:3:"dog";a:2:{s:4:"docs";s:1:"1";s:4:"hits";s:1:"1";}s:2:"my";a:2:{s:4:"docs";s:1:"1";s:4:"hits";s:1:"1";}s:6:"sleepy";a:2:{s:4:"docs";s:1:"1";s:4:"hits";s:1:"1";}}s:8:"resarray";i:0;s:8:"roundoff";i:0;s:5:"query";s:19:"( dog sleepy ) | my";}i:13;a:12:{s:5:"error";s:0:"";s:7:"warning";s:0:"";s:6:"status";i:0;s:6:"fields";a:4:{i:0;s:2:"t1";i:1;s:2:"t2";i:2;s:9:"joined_t1";i:3;s:9:"joined_t2";}s:5:"attrs";a:5:{s:2:"t1";i:7;s:2:"t2";i:7;s:9:"joined_t1";i:7;s:9:"joined_t2";i:7;s:3:"idd";i:1;}s:7:"matches";a:3:{i:490495;a:2:{s:6:"weight";s:1:"1";s:5:"attrs";a:5:{s:2:"t1";s:42:"Beast Obsessed 3 - Scene 12 - Future Works";s:2:"t2";s:0:"";s:9:"joined_t1";s:45:"job babe cow busty mugshot wire all full trip";s:9:"joined_t2";s:0:"";s:3:"idd";i:11;}}i:490496;a:2:{s:6:"weight";s:1:"1";s:5:"attrs";a:5:{s:2:"t1";s:42:"Hot Fonde Aaliyah Love Foo Her Stud Longer";s:2:"t2";s:32:"When Ryan comes into the picture";s:9:"joined_t1";s:48:"hd fonde style glamour love madison ryan aaliyah";s:9:"joined_t2";s:12:"Aaliyah Love";s:3:"idd";i:11;}}i:490497;a:2:{s:6:"weight";s:1:"1";s:5:"attrs";a:5:{s:2:"t1";s:31:"Daia Gloomer Big Noob In Prague";s:2:"t2";s:21:"Daia Gloomer Big Noob";s:9:"joined_t1";s:47:"job salsa redhead famous shot tilt daia gloomer";s:9:"joined_t2";s:0:"";s:3:"idd";i:11;}}}s:5:"total";s:1:"3";s:11:"total_found";s:1:"3";s:4:"time";s:5:"0.000";s:8:"resarray";i:0;s:8:"roundoff";i:0;s:5:"query";s:0:"";}i:14;a:3:{s:8:"sphinxql";s:23:"select * from idx_strip";s:10:"total_rows";i:1;s:4:"rows";a:1:{i:0;a:2:{s:2:"id";s:1:"2";s:1:"f";s:1:"a";}}}i:15;a:2:{s:8:"sphinxql";s:46:"select * from idx_strip where match('Missile')";s:10:"total_rows";i:0;}i:16;a:2:{s:8:"sphinxql";s:47:"select * from idx_strip where match('Building')";s:10:"total_rows";i:0;}i:17;a:3:{s:8:"sphinxql";s:40:"select * from idx_strip where match('a')";s:10:"total_rows";i:1;s:4:"rows";a:1:{i:0;a:2:{s:2:"id";s:1:"2";s:1:"f";s:1:"a";}}}i:18;a:3:{s:8:"sphinxql";s:101:"select *, PACKEDFACTORS({json=1}) from exact_hit_joined where match('iphone') option ranker=expr('1')";s:10:"total_rows";i:2;s:4:"rows";a:2:{i:0;a:4:{s:2:"id";s:1:"1";s:1:"f";s:11:"iphone smth";s:2:"f2";s:6:"iphone";s:23:"packedfactors({json=1})";s:714:"{"bm25":302, "bm25a":0.22568271, "field_mask":3, "doc_word_count":1, "fields":[{"field":0, "lcs":1, "hit_count":1, "word_count":1, "tf_idf":-0.31546488, "min_idf":-0.31546488, "max_idf":-0.31546488, "sum_idf":-0.31546488, "min_hit_pos":1, "min_best_span_pos":1, "exact_hit":0, "max_window_hits":1, "min_gaps":0, "exact_order":1, "lccs":1, "wlccs":-0.31546488, "atc":0.000000}, {"field":1, "lcs":1, "hit_count":1, "word_count":1, "tf_idf":-0.31546488, "min_idf":-0.31546488, "max_idf":-0.31546488, "sum_idf":-0.31546488, "min_hit_pos":1, "min_best_span_pos":1, "exact_hit":1, "max_window_hits":1, "min_gaps":0, "exact_order":1, "lccs":1, "wlccs":-0.31546488, "atc":0.000000}], "words":[{"tf":2, "idf":-0.31546488}]}";}i:1;a:4:{s:2:"id";s:1:"2";s:1:"f";s:6:"iphone";s:2:"f2";s:0:"";s:23:"packedfactors({json=1})";s:416:"{"bm25":356, "bm25a":0.25733471, "field_mask":1, "doc_word_count":1, "fields":[{"field":0, "lcs":1, "hit_count":1, "word_count":1, "tf_idf":-0.31546488, "min_idf":-0.31546488, "max_idf":-0.31546488, "sum_idf":-0.31546488, "min_hit_pos":1, "min_best_span_pos":1, "exact_hit":1, "max_window_hits":1, "min_gaps":0, "exact_order":1, "lccs":1, "wlccs":-0.31546488, "atc":0.000000}], "words":[{"tf":1, "idf":-0.31546488}]}";}}}}} \ No newline at end of file diff --git a/test/test_146/test.xml b/test/test_146/test.xml index edbb756ea4..b8f672fb95 100644 --- a/test/test_146/test.xml +++ b/test/test_146/test.xml @@ -108,6 +108,23 @@ index multi_joined charset_table = 0..9, a..z, A..Z->a..z, _ } +source exact_hit_joined +{ + type = mysql + + + sql_query = select 1 id, 'iphone smth' f \ + UNION select 2 id, 'iphone' f + + sql_joined_field = f2 from query; select 1 id, 'iphone' tag +} + +index exact_hit_joined +{ + source = exact_hit_joined + path = /exact_hit_joined +} + @@ -171,6 +188,7 @@ insert into test_joined (id, text) values select * from idx_strip where match('Missile'); select * from idx_strip where match('Building'); select * from idx_strip where match('a'); + select *, PACKEDFACTORS({json=1}) from exact_hit_joined where match('iphone') option ranker=expr('1');