Skip to content
Permalink
Browse files

fixed #437 crash of daemon on CALL KEYWORDS statement to RT index wit…

…h expansion_limit set; added regressions to test 364
  • Loading branch information
tomatolog committed Sep 6, 2018
1 parent 552646b commit 4a5262e2776aa261e34ba5c914ea60804f59de3f
Showing with 70 additions and 1 deletion.
  1. +3 −1 src/sphinxrt.cpp
  2. +1 −0 test/test_364/model.bin
  3. +66 −0 test/test_364/test.xml
@@ -6121,6 +6121,7 @@ struct DictEntryRtPayload_t
DictEntryRtPayload_t ( bool bPayload, int iSegments )
{
m_bPayload = bPayload;
m_iSegExpansionLimit = iSegments;
if ( bPayload )
{
m_dWordPayload.Reserve ( 1000 );
@@ -6170,7 +6171,7 @@ struct DictEntryRtPayload_t
int iTotalHits = 0;
if ( m_dWordExpand.GetLength() )
{
int iRtExpansionLimit = tArgs.m_iExpansionLimit * m_dSeg.GetLength();
int iRtExpansionLimit = tArgs.m_iExpansionLimit * m_iSegExpansionLimit;
if ( tArgs.m_iExpansionLimit && m_dWordExpand.GetLength()>iRtExpansionLimit )
{
// sort expansions by frequency desc
@@ -6264,6 +6265,7 @@ struct DictEntryRtPayload_t
CSphVector<RtExpandedPayload_t> m_dWordPayload;
CSphVector<BYTE> m_dWordBuf;
CSphVector<Slice_t> m_dSeg;
int m_iSegExpansionLimit = 0;
};


@@ -0,0 +1 @@
a:1:{i:0;a:5:{i:0;a:2:{s:8:"sphinxql";s:87:"INSERT INTO rt (id, gid, title) VALUES ( 1, 1, 'testend for' ), ( 2, 2, 'testat from' )";s:14:"total_affected";i:2;}i:1;a:2:{s:8:"sphinxql";s:87:"INSERT INTO rt (id, gid, title) VALUES ( 3, 3, 'testend far' ), ( 4, 4, 'testem from' )";s:14:"total_affected";i:2;}i:2;a:2:{s:8:"sphinxql";s:87:"INSERT INTO rt (id, gid, title) VALUES ( 5, 5, 'testend far' ), ( 6, 6, 'testat from' )";s:14:"total_affected";i:2;}i:3;a:2:{s:8:"sphinxql";s:85:"INSERT INTO rt (id, gid, title) VALUES ( 7, 7, 'testik me' ), ( 7, 7, 'testup from' )";s:14:"total_affected";i:2;}i:4;a:3:{s:8:"sphinxql";s:64:"CALL KEYWORDS ( 'test*', 'rt', 1 AS stats, 0 AS fold_wildcards )";s:10:"total_rows";i:4;s:4:"rows";a:4:{i:0;a:5:{s:4:"qpos";s:1:"1";s:9:"tokenized";s:5:"test*";s:10:"normalized";s:6:"testat";s:4:"docs";s:1:"2";s:4:"hits";s:1:"2";}i:1;a:5:{s:4:"qpos";s:1:"1";s:9:"tokenized";s:5:"test*";s:10:"normalized";s:6:"testem";s:4:"docs";s:1:"1";s:4:"hits";s:1:"1";}i:2;a:5:{s:4:"qpos";s:1:"1";s:9:"tokenized";s:5:"test*";s:10:"normalized";s:6:"testik";s:4:"docs";s:1:"1";s:4:"hits";s:1:"1";}i:3;a:5:{s:4:"qpos";s:1:"1";s:9:"tokenized";s:5:"test*";s:10:"normalized";s:7:"testend";s:4:"docs";s:1:"3";s:4:"hits";s:1:"3";}}}}}
@@ -0,0 +1,66 @@
<?xml version="1.0" encoding="utf-8"?>
<test>

<name>KEYWORDS with limit</name>

<config>
indexer
{
mem_limit = 16M
}

searchd
{
<searchd_settings/>
expansion_limit = 4
}

source dummy
{
type = mysql
<sql_settings/>
sql_query = select * from test_table
sql_attr_uint = gid
}

index dummy
{
source = dummy
path = <data_path/>/dummy
}

index rt
{
type = rt
path = <data_path/>/rt
docinfo = extern
rt_mem_limit = 128k

rt_field = title
rt_attr_uint = gid

dict = keywords
min_prefix_len = 2
}
</config>
<db_create>
CREATE TABLE `test_table` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`gid` int(11) NOT NULL,
`title` varchar(255) NOT NULL,
PRIMARY KEY (`id`)
)
</db_create>
<db_drop>DROP TABLE IF EXISTS `test_table`;</db_drop>
<db_insert>INSERT INTO `test_table` VALUES ( 1, 1, 'test 1' )</db_insert>

<sphqueries>
<sphinxql>INSERT INTO rt (id, gid, title) VALUES ( 1, 1, 'testend for' ), ( 2, 2, 'testat from' )</sphinxql>
<sphinxql>INSERT INTO rt (id, gid, title) VALUES ( 3, 3, 'testend far' ), ( 4, 4, 'testem from' )</sphinxql>
<sphinxql>INSERT INTO rt (id, gid, title) VALUES ( 5, 5, 'testend far' ), ( 6, 6, 'testat from' )</sphinxql>
<sphinxql>INSERT INTO rt (id, gid, title) VALUES ( 7, 7, 'testik me' ), ( 7, 7, 'testup from' )</sphinxql>

<sphinxql>CALL KEYWORDS ( 'test*', 'rt', 1 AS stats, 0 AS fold_wildcards )</sphinxql>
</sphqueries>

</test>

0 comments on commit 4a5262e

Please sign in to comment.
You can’t perform that action at this time.