Skip to content

Commit

Permalink
fixed duplicate rows in RT indexes, removed unused variable, fixed an…
Browse files Browse the repository at this point in the history
…noying warning

git-svn-id: http://sphinxsearch.googlecode.com/svn/trunk@4410 8b96e2b9-35c5-2c16-bc47-5122d61876d4
  • Loading branch information
kevg committed Dec 12, 2013
1 parent d9197c8 commit 613ead5
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 7 deletions.
1 change: 0 additions & 1 deletion src/sphinxint.h
Original file line number Diff line number Diff line change
Expand Up @@ -1704,7 +1704,6 @@ struct ExpansionContext_t
const ISphWordlist * m_pWordlist;
BYTE * m_pBuf;
CSphQueryResultMeta * m_pResult;
int m_iFD;
int m_iMinPrefixLen;
int m_iMinInfixLen;
int m_iExpansionLimit;
Expand Down
11 changes: 6 additions & 5 deletions src/sphinxrt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2871,12 +2871,14 @@ void RtIndex_t::CommitReplayable ( RtSegment_t * pNewSeg, CSphVector<SphDocID_t>
if ( sphBinarySearch ( m_dDiskChunkKlist.Begin(), m_dDiskChunkKlist.Begin()+m_dDiskChunkKlist.GetLength()-1, uRef ) )
break;

for ( int j=m_pDiskChunks.GetLength()-1; j>=0 && !bSavedOrDiskAlive; --j )
for ( int j=m_pDiskChunks.GetLength()-1; j>=0; --j )
{
// killed in this disk chunk?
bSavedOrDiskAlive = m_pDiskChunks[j]->HasDocid ( uDocid );
if ( bSavedOrDiskAlive )
break;
// killed in previous disk chunks?
if ( sphBinarySearch ( m_pDiskChunks[j]->GetKillList(), m_pDiskChunks[j]->GetKillList()+m_pDiskChunks[j]->GetKillListSize()-1, uRef ) )
break;
bSavedOrDiskAlive = m_pDiskChunks[j]->HasDocid ( uDocid );
}

break;
Expand Down Expand Up @@ -3788,7 +3790,7 @@ void RtIndex_t::SaveDiskChunk ( int64_t iTID, const CSphVector<RtSegment_t *> &
// abandon .ram file
CSphString sChunk;
sChunk.SetSprintf ( "%s.ram", m_sPath.cstr() );
if ( ::unlink ( sChunk.cstr() ) )
if ( sphIsReadable ( sChunk.cstr() ) && ::unlink ( sChunk.cstr() ) )
sphWarning ( "failed to unlink ram chunk (file=%s, errno=%d, error=%s)",
sChunk.cstr(), errno, strerror(errno) );

Expand Down Expand Up @@ -6256,7 +6258,6 @@ bool RtIndex_t::MultiQuery ( const CSphQuery * pQuery, CSphQueryResult * pResult
tExpCtx.m_pWordlist = this;
tExpCtx.m_pBuf = NULL;
tExpCtx.m_pResult = pResult;
tExpCtx.m_iFD = -1;
tExpCtx.m_iMinPrefixLen = m_tSettings.m_iMinPrefixLen;
tExpCtx.m_iMinInfixLen = m_tSettings.m_iMinInfixLen;
tExpCtx.m_iExpansionLimit = m_iExpansionLimit;
Expand Down
2 changes: 1 addition & 1 deletion test/test_215/model.bin
Original file line number Diff line number Diff line change
@@ -1 +1 @@
a:2:{i:0;a:9:{i:0;a:3:{s:8:"sphinxql";s:56:"select remove_repeats((select * from dist1), gid, 0, 10)";s:10:"total_rows";i:1;s:4:"rows";a:1:{i:0;a:3:{s:2:"id";s:1:"1";s:3:"gid";s:1:"1";s:3:"iid";s:1:"1";}}}i:1;a:3:{s:8:"sphinxql";s:56:"select remove_repeats((select * from dist1), iid, 0, 10)";s:10:"total_rows";i:10;s:4:"rows";a:10:{i:0;a:3:{s:2:"id";s:1:"1";s:3:"gid";s:1:"1";s:3:"iid";s:1:"1";}i:1;a:3:{s:2:"id";s:1:"2";s:3:"gid";s:1:"1";s:3:"iid";s:1:"2";}i:2;a:3:{s:2:"id";s:1:"3";s:3:"gid";s:1:"1";s:3:"iid";s:1:"1";}i:3;a:3:{s:2:"id";s:1:"4";s:3:"gid";s:1:"1";s:3:"iid";s:1:"2";}i:4;a:3:{s:2:"id";s:1:"5";s:3:"gid";s:1:"1";s:3:"iid";s:1:"1";}i:5;a:3:{s:2:"id";s:1:"6";s:3:"gid";s:1:"1";s:3:"iid";s:1:"2";}i:6;a:3:{s:2:"id";s:1:"7";s:3:"gid";s:1:"1";s:3:"iid";s:1:"1";}i:7;a:3:{s:2:"id";s:1:"8";s:3:"gid";s:1:"1";s:3:"iid";s:1:"2";}i:8;a:3:{s:2:"id";s:1:"9";s:3:"gid";s:1:"1";s:3:"iid";s:1:"1";}i:9;a:3:{s:2:"id";s:2:"10";s:3:"gid";s:1:"1";s:3:"iid";s:1:"2";}}}i:2;a:3:{s:8:"sphinxql";s:70:"select * from dist1 where match('one|three|four|five') order by id asc";s:10:"total_rows";i:4;s:4:"rows";a:4:{i:0;a:3:{s:2:"id";s:1:"1";s:3:"gid";s:1:"1";s:3:"iid";s:1:"1";}i:1;a:3:{s:2:"id";s:1:"3";s:3:"gid";s:1:"1";s:3:"iid";s:1:"1";}i:2;a:3:{s:2:"id";s:1:"4";s:3:"gid";s:1:"1";s:3:"iid";s:1:"2";}i:3;a:3:{s:2:"id";s:1:"5";s:3:"gid";s:1:"1";s:3:"iid";s:1:"1";}}}i:3;a:3:{s:8:"sphinxql";s:107:"select remove_repeats((select * from dist1 where match('one|three|four|five') order by id asc), iid, 0, 10)";s:10:"total_rows";i:3;s:4:"rows";a:3:{i:0;a:3:{s:2:"id";s:1:"1";s:3:"gid";s:1:"1";s:3:"iid";s:1:"1";}i:1;a:3:{s:2:"id";s:1:"4";s:3:"gid";s:1:"1";s:3:"iid";s:1:"2";}i:2;a:3:{s:2:"id";s:1:"5";s:3:"gid";s:1:"1";s:3:"iid";s:1:"1";}}}i:4;a:3:{s:8:"sphinxql";s:106:"select remove_repeats((select * from dist1 where match('one|three|four|five') order by id asc), iid, 0, 2)";s:10:"total_rows";i:2;s:4:"rows";a:2:{i:0;a:3:{s:2:"id";s:1:"1";s:3:"gid";s:1:"1";s:3:"iid";s:1:"1";}i:1;a:3:{s:2:"id";s:1:"4";s:3:"gid";s:1:"1";s:3:"iid";s:1:"2";}}}i:5;a:3:{s:8:"sphinxql";s:107:"select remove_repeats((select * from dist2 where match('one|three|four|five') order by id asc), iid, 0, 10)";s:10:"total_rows";i:3;s:4:"rows";a:3:{i:0;a:3:{s:2:"id";s:1:"1";s:3:"gid";s:1:"1";s:3:"iid";s:1:"1";}i:1;a:3:{s:2:"id";s:1:"4";s:3:"gid";s:1:"1";s:3:"iid";s:1:"2";}i:2;a:3:{s:2:"id";s:1:"5";s:3:"gid";s:1:"1";s:3:"iid";s:1:"1";}}}i:6;a:3:{s:8:"sphinxql";s:106:"select remove_repeats((select * from dist2 where match('one|three|four|five') order by id asc), iid, 0, 2)";s:10:"total_rows";i:2;s:4:"rows";a:2:{i:0;a:3:{s:2:"id";s:1:"1";s:3:"gid";s:1:"1";s:3:"iid";s:1:"1";}i:1;a:3:{s:2:"id";s:1:"4";s:3:"gid";s:1:"1";s:3:"iid";s:1:"2";}}}i:7;a:3:{s:8:"sphinxql";s:99:"select * from (select *, weight() w from dist2 where match('test') order by id asc) order by w desc";s:10:"total_rows";i:5;s:4:"rows";a:5:{i:0;a:4:{s:2:"id";s:1:"2";s:3:"gid";s:1:"1";s:3:"iid";s:1:"2";s:1:"w";s:4:"1587";}i:1;a:4:{s:2:"id";s:1:"4";s:3:"gid";s:1:"1";s:3:"iid";s:1:"2";s:1:"w";s:4:"1587";}i:2;a:4:{s:2:"id";s:1:"1";s:3:"gid";s:1:"1";s:3:"iid";s:1:"1";s:1:"w";s:4:"1500";}i:3;a:4:{s:2:"id";s:1:"3";s:3:"gid";s:1:"1";s:3:"iid";s:1:"1";s:1:"w";s:4:"1500";}i:4;a:4:{s:2:"id";s:1:"5";s:3:"gid";s:1:"1";s:3:"iid";s:1:"1";s:1:"w";s:4:"1500";}}}i:8;a:3:{s:8:"sphinxql";s:135:"select remove_repeats((select * from (select *, weight() w from dist2 where match('test') order by id asc) order by w desc), iid, 0, 2)";s:10:"total_rows";i:2;s:4:"rows";a:2:{i:0;a:4:{s:2:"id";s:1:"2";s:3:"gid";s:1:"1";s:3:"iid";s:1:"2";s:1:"w";s:4:"1587";}i:1;a:4:{s:2:"id";s:1:"1";s:3:"gid";s:1:"1";s:3:"iid";s:1:"1";s:1:"w";s:4:"1500";}}}}i:1;a:9:{i:0;a:3:{s:8:"sphinxql";s:56:"select remove_repeats((select * from dist1), gid, 0, 10)";s:10:"total_rows";i:1;s:4:"rows";a:1:{i:0;a:3:{s:2:"id";s:1:"1";s:3:"gid";s:1:"1";s:3:"iid";s:1:"1";}}}i:1;a:3:{s:8:"sphinxql";s:56:"select remove_repeats((select * from dist1), iid, 0, 10)";s:10:"total_rows";i:10;s:4:"rows";a:10:{i:0;a:3:{s:2:"id";s:1:"1";s:3:"gid";s:1:"1";s:3:"iid";s:1:"1";}i:1;a:3:{s:2:"id";s:1:"2";s:3:"gid";s:1:"1";s:3:"iid";s:1:"2";}i:2;a:3:{s:2:"id";s:1:"3";s:3:"gid";s:1:"1";s:3:"iid";s:1:"1";}i:3;a:3:{s:2:"id";s:1:"4";s:3:"gid";s:1:"1";s:3:"iid";s:1:"2";}i:4;a:3:{s:2:"id";s:1:"5";s:3:"gid";s:1:"1";s:3:"iid";s:1:"1";}i:5;a:3:{s:2:"id";s:1:"6";s:3:"gid";s:1:"1";s:3:"iid";s:1:"2";}i:6;a:3:{s:2:"id";s:1:"7";s:3:"gid";s:1:"1";s:3:"iid";s:1:"1";}i:7;a:3:{s:2:"id";s:1:"8";s:3:"gid";s:1:"1";s:3:"iid";s:1:"2";}i:8;a:3:{s:2:"id";s:1:"9";s:3:"gid";s:1:"1";s:3:"iid";s:1:"1";}i:9;a:3:{s:2:"id";s:2:"10";s:3:"gid";s:1:"1";s:3:"iid";s:1:"2";}}}i:2;a:3:{s:8:"sphinxql";s:70:"select * from dist1 where match('one|three|four|five') order by id asc";s:10:"total_rows";i:4;s:4:"rows";a:4:{i:0;a:3:{s:2:"id";s:1:"1";s:3:"gid";s:1:"1";s:3:"iid";s:1:"1";}i:1;a:3:{s:2:"id";s:1:"3";s:3:"gid";s:1:"1";s:3:"iid";s:1:"1";}i:2;a:3:{s:2:"id";s:1:"4";s:3:"gid";s:1:"1";s:3:"iid";s:1:"2";}i:3;a:3:{s:2:"id";s:1:"5";s:3:"gid";s:1:"1";s:3:"iid";s:1:"1";}}}i:3;a:3:{s:8:"sphinxql";s:107:"select remove_repeats((select * from dist1 where match('one|three|four|five') order by id asc), iid, 0, 10)";s:10:"total_rows";i:3;s:4:"rows";a:3:{i:0;a:3:{s:2:"id";s:1:"1";s:3:"gid";s:1:"1";s:3:"iid";s:1:"1";}i:1;a:3:{s:2:"id";s:1:"4";s:3:"gid";s:1:"1";s:3:"iid";s:1:"2";}i:2;a:3:{s:2:"id";s:1:"5";s:3:"gid";s:1:"1";s:3:"iid";s:1:"1";}}}i:4;a:3:{s:8:"sphinxql";s:106:"select remove_repeats((select * from dist1 where match('one|three|four|five') order by id asc), iid, 0, 2)";s:10:"total_rows";i:2;s:4:"rows";a:2:{i:0;a:3:{s:2:"id";s:1:"1";s:3:"gid";s:1:"1";s:3:"iid";s:1:"1";}i:1;a:3:{s:2:"id";s:1:"4";s:3:"gid";s:1:"1";s:3:"iid";s:1:"2";}}}i:5;a:3:{s:8:"sphinxql";s:107:"select remove_repeats((select * from dist2 where match('one|three|four|five') order by id asc), iid, 0, 10)";s:10:"total_rows";i:3;s:4:"rows";a:3:{i:0;a:3:{s:2:"id";s:1:"1";s:3:"gid";s:1:"1";s:3:"iid";s:1:"1";}i:1;a:3:{s:2:"id";s:1:"4";s:3:"gid";s:1:"1";s:3:"iid";s:1:"2";}i:2;a:3:{s:2:"id";s:1:"5";s:3:"gid";s:1:"1";s:3:"iid";s:1:"1";}}}i:6;a:3:{s:8:"sphinxql";s:106:"select remove_repeats((select * from dist2 where match('one|three|four|five') order by id asc), iid, 0, 2)";s:10:"total_rows";i:2;s:4:"rows";a:2:{i:0;a:3:{s:2:"id";s:1:"1";s:3:"gid";s:1:"1";s:3:"iid";s:1:"1";}i:1;a:3:{s:2:"id";s:1:"4";s:3:"gid";s:1:"1";s:3:"iid";s:1:"2";}}}i:7;a:3:{s:8:"sphinxql";s:99:"select * from (select *, weight() w from dist2 where match('test') order by id asc) order by w desc";s:10:"total_rows";i:5;s:4:"rows";a:5:{i:0;a:4:{s:2:"id";s:1:"2";s:3:"gid";s:1:"1";s:3:"iid";s:1:"2";s:1:"w";s:4:"1587";}i:1;a:4:{s:2:"id";s:1:"4";s:3:"gid";s:1:"1";s:3:"iid";s:1:"2";s:1:"w";s:4:"1587";}i:2;a:4:{s:2:"id";s:1:"1";s:3:"gid";s:1:"1";s:3:"iid";s:1:"1";s:1:"w";s:4:"1500";}i:3;a:4:{s:2:"id";s:1:"3";s:3:"gid";s:1:"1";s:3:"iid";s:1:"1";s:1:"w";s:4:"1500";}i:4;a:4:{s:2:"id";s:1:"5";s:3:"gid";s:1:"1";s:3:"iid";s:1:"1";s:1:"w";s:4:"1500";}}}i:8;a:3:{s:8:"sphinxql";s:135:"select remove_repeats((select * from (select *, weight() w from dist2 where match('test') order by id asc) order by w desc), iid, 0, 2)";s:10:"total_rows";i:2;s:4:"rows";a:2:{i:0;a:4:{s:2:"id";s:1:"2";s:3:"gid";s:1:"1";s:3:"iid";s:1:"2";s:1:"w";s:4:"1587";}i:1;a:4:{s:2:"id";s:1:"1";s:3:"gid";s:1:"1";s:3:"iid";s:1:"1";s:1:"w";s:4:"1500";}}}}}
a:2:{i:0;a:16:{i:0;a:3:{s:8:"sphinxql";s:56:"select remove_repeats((select * from dist1), gid, 0, 10)";s:10:"total_rows";i:1;s:4:"rows";a:1:{i:0;a:3:{s:2:"id";s:1:"1";s:3:"gid";s:1:"1";s:3:"iid";s:1:"1";}}}i:1;a:3:{s:8:"sphinxql";s:56:"select remove_repeats((select * from dist1), iid, 0, 10)";s:10:"total_rows";i:10;s:4:"rows";a:10:{i:0;a:3:{s:2:"id";s:1:"1";s:3:"gid";s:1:"1";s:3:"iid";s:1:"1";}i:1;a:3:{s:2:"id";s:1:"2";s:3:"gid";s:1:"1";s:3:"iid";s:1:"2";}i:2;a:3:{s:2:"id";s:1:"3";s:3:"gid";s:1:"1";s:3:"iid";s:1:"1";}i:3;a:3:{s:2:"id";s:1:"4";s:3:"gid";s:1:"1";s:3:"iid";s:1:"2";}i:4;a:3:{s:2:"id";s:1:"5";s:3:"gid";s:1:"1";s:3:"iid";s:1:"1";}i:5;a:3:{s:2:"id";s:1:"6";s:3:"gid";s:1:"1";s:3:"iid";s:1:"2";}i:6;a:3:{s:2:"id";s:1:"7";s:3:"gid";s:1:"1";s:3:"iid";s:1:"1";}i:7;a:3:{s:2:"id";s:1:"8";s:3:"gid";s:1:"1";s:3:"iid";s:1:"2";}i:8;a:3:{s:2:"id";s:1:"9";s:3:"gid";s:1:"1";s:3:"iid";s:1:"1";}i:9;a:3:{s:2:"id";s:2:"10";s:3:"gid";s:1:"1";s:3:"iid";s:1:"2";}}}i:2;a:3:{s:8:"sphinxql";s:70:"select * from dist1 where match('one|three|four|five') order by id asc";s:10:"total_rows";i:4;s:4:"rows";a:4:{i:0;a:3:{s:2:"id";s:1:"1";s:3:"gid";s:1:"1";s:3:"iid";s:1:"1";}i:1;a:3:{s:2:"id";s:1:"3";s:3:"gid";s:1:"1";s:3:"iid";s:1:"1";}i:2;a:3:{s:2:"id";s:1:"4";s:3:"gid";s:1:"1";s:3:"iid";s:1:"2";}i:3;a:3:{s:2:"id";s:1:"5";s:3:"gid";s:1:"1";s:3:"iid";s:1:"1";}}}i:3;a:3:{s:8:"sphinxql";s:107:"select remove_repeats((select * from dist1 where match('one|three|four|five') order by id asc), iid, 0, 10)";s:10:"total_rows";i:3;s:4:"rows";a:3:{i:0;a:3:{s:2:"id";s:1:"1";s:3:"gid";s:1:"1";s:3:"iid";s:1:"1";}i:1;a:3:{s:2:"id";s:1:"4";s:3:"gid";s:1:"1";s:3:"iid";s:1:"2";}i:2;a:3:{s:2:"id";s:1:"5";s:3:"gid";s:1:"1";s:3:"iid";s:1:"1";}}}i:4;a:3:{s:8:"sphinxql";s:106:"select remove_repeats((select * from dist1 where match('one|three|four|five') order by id asc), iid, 0, 2)";s:10:"total_rows";i:2;s:4:"rows";a:2:{i:0;a:3:{s:2:"id";s:1:"1";s:3:"gid";s:1:"1";s:3:"iid";s:1:"1";}i:1;a:3:{s:2:"id";s:1:"4";s:3:"gid";s:1:"1";s:3:"iid";s:1:"2";}}}i:5;a:3:{s:8:"sphinxql";s:107:"select remove_repeats((select * from dist2 where match('one|three|four|five') order by id asc), iid, 0, 10)";s:10:"total_rows";i:3;s:4:"rows";a:3:{i:0;a:3:{s:2:"id";s:1:"1";s:3:"gid";s:1:"1";s:3:"iid";s:1:"1";}i:1;a:3:{s:2:"id";s:1:"4";s:3:"gid";s:1:"1";s:3:"iid";s:1:"2";}i:2;a:3:{s:2:"id";s:1:"5";s:3:"gid";s:1:"1";s:3:"iid";s:1:"1";}}}i:6;a:3:{s:8:"sphinxql";s:106:"select remove_repeats((select * from dist2 where match('one|three|four|five') order by id asc), iid, 0, 2)";s:10:"total_rows";i:2;s:4:"rows";a:2:{i:0;a:3:{s:2:"id";s:1:"1";s:3:"gid";s:1:"1";s:3:"iid";s:1:"1";}i:1;a:3:{s:2:"id";s:1:"4";s:3:"gid";s:1:"1";s:3:"iid";s:1:"2";}}}i:7;a:3:{s:8:"sphinxql";s:99:"select * from (select *, weight() w from dist2 where match('test') order by id asc) order by w desc";s:10:"total_rows";i:5;s:4:"rows";a:5:{i:0;a:4:{s:2:"id";s:1:"2";s:3:"gid";s:1:"1";s:3:"iid";s:1:"2";s:1:"w";s:4:"1587";}i:1;a:4:{s:2:"id";s:1:"4";s:3:"gid";s:1:"1";s:3:"iid";s:1:"2";s:1:"w";s:4:"1587";}i:2;a:4:{s:2:"id";s:1:"1";s:3:"gid";s:1:"1";s:3:"iid";s:1:"1";s:1:"w";s:4:"1500";}i:3;a:4:{s:2:"id";s:1:"3";s:3:"gid";s:1:"1";s:3:"iid";s:1:"1";s:1:"w";s:4:"1500";}i:4;a:4:{s:2:"id";s:1:"5";s:3:"gid";s:1:"1";s:3:"iid";s:1:"1";s:1:"w";s:4:"1500";}}}i:8;a:3:{s:8:"sphinxql";s:135:"select remove_repeats((select * from (select *, weight() w from dist2 where match('test') order by id asc) order by w desc), iid, 0, 2)";s:10:"total_rows";i:2;s:4:"rows";a:2:{i:0;a:4:{s:2:"id";s:1:"2";s:3:"gid";s:1:"1";s:3:"iid";s:1:"2";s:1:"w";s:4:"1587";}i:1;a:4:{s:2:"id";s:1:"1";s:3:"gid";s:1:"1";s:3:"iid";s:1:"1";s:1:"w";s:4:"1500";}}}i:9;a:2:{s:8:"sphinxql";s:47:"REPLACE INTO rt_killlist VALUES (1, 'asdf', 11)";s:14:"total_affected";i:1;}i:10;a:2:{s:8:"sphinxql";s:26:"FLUSH RAMCHUNK rt_killlist";s:14:"total_affected";i:0;}i:11;a:2:{s:8:"sphinxql";s:47:"REPLACE INTO rt_killlist VALUES (1, 'asdf', 11)";s:14:"total_affected";i:1;}i:12;a:2:{s:8:"sphinxql";s:26:"FLUSH RAMCHUNK rt_killlist";s:14:"total_affected";i:0;}i:13;a:2:{s:8:"sphinxql";s:47:"REPLACE INTO rt_killlist VALUES (1, 'asdf', 11)";s:14:"total_affected";i:1;}i:14;a:2:{s:8:"sphinxql";s:26:"FLUSH RAMCHUNK rt_killlist";s:14:"total_affected";i:0;}i:15;a:3:{s:8:"sphinxql";s:25:"SELECT * FROM rt_killlist";s:10:"total_rows";i:1;s:4:"rows";a:1:{i:0;a:2:{s:2:"id";s:1:"1";s:3:"gid";s:2:"11";}}}}i:1;a:16:{i:0;a:3:{s:8:"sphinxql";s:56:"select remove_repeats((select * from dist1), gid, 0, 10)";s:10:"total_rows";i:1;s:4:"rows";a:1:{i:0;a:3:{s:2:"id";s:1:"1";s:3:"gid";s:1:"1";s:3:"iid";s:1:"1";}}}i:1;a:3:{s:8:"sphinxql";s:56:"select remove_repeats((select * from dist1), iid, 0, 10)";s:10:"total_rows";i:10;s:4:"rows";a:10:{i:0;a:3:{s:2:"id";s:1:"1";s:3:"gid";s:1:"1";s:3:"iid";s:1:"1";}i:1;a:3:{s:2:"id";s:1:"2";s:3:"gid";s:1:"1";s:3:"iid";s:1:"2";}i:2;a:3:{s:2:"id";s:1:"3";s:3:"gid";s:1:"1";s:3:"iid";s:1:"1";}i:3;a:3:{s:2:"id";s:1:"4";s:3:"gid";s:1:"1";s:3:"iid";s:1:"2";}i:4;a:3:{s:2:"id";s:1:"5";s:3:"gid";s:1:"1";s:3:"iid";s:1:"1";}i:5;a:3:{s:2:"id";s:1:"6";s:3:"gid";s:1:"1";s:3:"iid";s:1:"2";}i:6;a:3:{s:2:"id";s:1:"7";s:3:"gid";s:1:"1";s:3:"iid";s:1:"1";}i:7;a:3:{s:2:"id";s:1:"8";s:3:"gid";s:1:"1";s:3:"iid";s:1:"2";}i:8;a:3:{s:2:"id";s:1:"9";s:3:"gid";s:1:"1";s:3:"iid";s:1:"1";}i:9;a:3:{s:2:"id";s:2:"10";s:3:"gid";s:1:"1";s:3:"iid";s:1:"2";}}}i:2;a:3:{s:8:"sphinxql";s:70:"select * from dist1 where match('one|three|four|five') order by id asc";s:10:"total_rows";i:4;s:4:"rows";a:4:{i:0;a:3:{s:2:"id";s:1:"1";s:3:"gid";s:1:"1";s:3:"iid";s:1:"1";}i:1;a:3:{s:2:"id";s:1:"3";s:3:"gid";s:1:"1";s:3:"iid";s:1:"1";}i:2;a:3:{s:2:"id";s:1:"4";s:3:"gid";s:1:"1";s:3:"iid";s:1:"2";}i:3;a:3:{s:2:"id";s:1:"5";s:3:"gid";s:1:"1";s:3:"iid";s:1:"1";}}}i:3;a:3:{s:8:"sphinxql";s:107:"select remove_repeats((select * from dist1 where match('one|three|four|five') order by id asc), iid, 0, 10)";s:10:"total_rows";i:3;s:4:"rows";a:3:{i:0;a:3:{s:2:"id";s:1:"1";s:3:"gid";s:1:"1";s:3:"iid";s:1:"1";}i:1;a:3:{s:2:"id";s:1:"4";s:3:"gid";s:1:"1";s:3:"iid";s:1:"2";}i:2;a:3:{s:2:"id";s:1:"5";s:3:"gid";s:1:"1";s:3:"iid";s:1:"1";}}}i:4;a:3:{s:8:"sphinxql";s:106:"select remove_repeats((select * from dist1 where match('one|three|four|five') order by id asc), iid, 0, 2)";s:10:"total_rows";i:2;s:4:"rows";a:2:{i:0;a:3:{s:2:"id";s:1:"1";s:3:"gid";s:1:"1";s:3:"iid";s:1:"1";}i:1;a:3:{s:2:"id";s:1:"4";s:3:"gid";s:1:"1";s:3:"iid";s:1:"2";}}}i:5;a:3:{s:8:"sphinxql";s:107:"select remove_repeats((select * from dist2 where match('one|three|four|five') order by id asc), iid, 0, 10)";s:10:"total_rows";i:3;s:4:"rows";a:3:{i:0;a:3:{s:2:"id";s:1:"1";s:3:"gid";s:1:"1";s:3:"iid";s:1:"1";}i:1;a:3:{s:2:"id";s:1:"4";s:3:"gid";s:1:"1";s:3:"iid";s:1:"2";}i:2;a:3:{s:2:"id";s:1:"5";s:3:"gid";s:1:"1";s:3:"iid";s:1:"1";}}}i:6;a:3:{s:8:"sphinxql";s:106:"select remove_repeats((select * from dist2 where match('one|three|four|five') order by id asc), iid, 0, 2)";s:10:"total_rows";i:2;s:4:"rows";a:2:{i:0;a:3:{s:2:"id";s:1:"1";s:3:"gid";s:1:"1";s:3:"iid";s:1:"1";}i:1;a:3:{s:2:"id";s:1:"4";s:3:"gid";s:1:"1";s:3:"iid";s:1:"2";}}}i:7;a:3:{s:8:"sphinxql";s:99:"select * from (select *, weight() w from dist2 where match('test') order by id asc) order by w desc";s:10:"total_rows";i:5;s:4:"rows";a:5:{i:0;a:4:{s:2:"id";s:1:"2";s:3:"gid";s:1:"1";s:3:"iid";s:1:"2";s:1:"w";s:4:"1587";}i:1;a:4:{s:2:"id";s:1:"4";s:3:"gid";s:1:"1";s:3:"iid";s:1:"2";s:1:"w";s:4:"1587";}i:2;a:4:{s:2:"id";s:1:"1";s:3:"gid";s:1:"1";s:3:"iid";s:1:"1";s:1:"w";s:4:"1500";}i:3;a:4:{s:2:"id";s:1:"3";s:3:"gid";s:1:"1";s:3:"iid";s:1:"1";s:1:"w";s:4:"1500";}i:4;a:4:{s:2:"id";s:1:"5";s:3:"gid";s:1:"1";s:3:"iid";s:1:"1";s:1:"w";s:4:"1500";}}}i:8;a:3:{s:8:"sphinxql";s:135:"select remove_repeats((select * from (select *, weight() w from dist2 where match('test') order by id asc) order by w desc), iid, 0, 2)";s:10:"total_rows";i:2;s:4:"rows";a:2:{i:0;a:4:{s:2:"id";s:1:"2";s:3:"gid";s:1:"1";s:3:"iid";s:1:"2";s:1:"w";s:4:"1587";}i:1;a:4:{s:2:"id";s:1:"1";s:3:"gid";s:1:"1";s:3:"iid";s:1:"1";s:1:"w";s:4:"1500";}}}i:9;a:2:{s:8:"sphinxql";s:47:"REPLACE INTO rt_killlist VALUES (1, 'asdf', 11)";s:14:"total_affected";i:1;}i:10;a:2:{s:8:"sphinxql";s:26:"FLUSH RAMCHUNK rt_killlist";s:14:"total_affected";i:0;}i:11;a:2:{s:8:"sphinxql";s:47:"REPLACE INTO rt_killlist VALUES (1, 'asdf', 11)";s:14:"total_affected";i:1;}i:12;a:2:{s:8:"sphinxql";s:26:"FLUSH RAMCHUNK rt_killlist";s:14:"total_affected";i:0;}i:13;a:2:{s:8:"sphinxql";s:47:"REPLACE INTO rt_killlist VALUES (1, 'asdf', 11)";s:14:"total_affected";i:1;}i:14;a:2:{s:8:"sphinxql";s:26:"FLUSH RAMCHUNK rt_killlist";s:14:"total_affected";i:0;}i:15;a:3:{s:8:"sphinxql";s:25:"SELECT * FROM rt_killlist";s:10:"total_rows";i:1;s:4:"rows";a:1:{i:0;a:2:{s:2:"id";s:1:"1";s:3:"gid";s:2:"11";}}}}}
17 changes: 17 additions & 0 deletions test/test_215/test.xml
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,14 @@ index dist2
agent = <my_address/>:test1
agent = <my_address/>:test2
}

index rt_killlist
{
type = rt
path = <data_path/>/rt_killlist
rt_field = text
rt_attr_uint = gid
}
</config>

<db_create>
Expand Down Expand Up @@ -96,6 +104,15 @@ CREATE TABLE test_table
<sphinxql>select remove_repeats((select * from dist2 where match('one|three|four|five') order by id asc), iid, 0, 2)</sphinxql>
<sphinxql>select * from (select *, weight() w from dist2 where match('test') order by id asc) order by w desc</sphinxql>
<sphinxql>select remove_repeats((select * from (select *, weight() w from dist2 where match('test') order by id asc) order by w desc), iid, 0, 2)</sphinxql>

<!-- incorrect kill list handling (duplicates in result set) test -->
<sphinxql>REPLACE INTO rt_killlist VALUES (1, 'asdf', 11)</sphinxql>
<sphinxql>FLUSH RAMCHUNK rt_killlist</sphinxql>
<sphinxql>REPLACE INTO rt_killlist VALUES (1, 'asdf', 11)</sphinxql>
<sphinxql>FLUSH RAMCHUNK rt_killlist</sphinxql>
<sphinxql>REPLACE INTO rt_killlist VALUES (1, 'asdf', 11)</sphinxql>
<sphinxql>FLUSH RAMCHUNK rt_killlist</sphinxql>
<sphinxql>SELECT * FROM rt_killlist</sphinxql>
</sphqueries>

</test>

0 comments on commit 613ead5

Please sign in to comment.