Skip to content
Permalink
Browse files

fixed #741 phrase_boundary settings at RT index; added regressions to…

… test 59
  • Loading branch information...
tomatolog committed Mar 6, 2019
1 parent 3562f65 commit 6a217f6ed82fb10f752213b15617b9cedf1e8533
Showing with 66 additions and 8 deletions.
  1. +1 −3 src/sphinxrt.cpp
  2. +6 −1 test/test_059/model.bin
  3. +59 −4 test/test_059/test.xml
@@ -3859,7 +3859,7 @@ void RtIndex_t::SaveDiskHeader ( const char * sFilename, SphDocID_t iMinDocID, i
tWriter.PutDword ( SPH_HIT_FORMAT_INLINE );
tWriter.PutByte ( m_tSettings.m_bIndexSP ? 1 : 0 ); // m_bIndexSP, v.21+
tWriter.PutString ( m_tSettings.m_sZones ); // m_sZonePrefix, v.22+
tWriter.PutDword ( 0 ); // m_iBoundaryStep, v.23+
tWriter.PutDword ( m_tSettings.m_iBoundaryStep ); // m_iBoundaryStep, v.23+
tWriter.PutDword ( 1 ); // m_iStopwordStep, v.23+
tWriter.PutDword ( 1 ); // m_iOvershortStep
tWriter.PutDword ( m_tSettings.m_iEmbeddedLimit ); // v.30+
@@ -8169,8 +8169,6 @@ bool RtIndex_t::AttachDiskIndex ( CSphIndex * pIndex, CSphString & sError )
// we do not support some of the disk index features in RT just yet
#define LOC_ERROR(_arg) { sError = _arg; return false; }
const CSphIndexSettings & tSettings = pIndex->GetSettings();
if ( tSettings.m_iBoundaryStep!=0 )
LOC_ERROR ( "ATTACH currently requires boundary_step=0 in disk index (RT-side support not implemented yet)" );
if ( tSettings.m_iStopwordStep!=1 )
LOC_ERROR ( "ATTACH currently requires stopword_step=1 in disk index (RT-side support not implemented yet)" );
if ( tSettings.m_eDocinfo!=SPH_DOCINFO_EXTERN )
@@ -1 +1,6 @@
a:1:{i:0;a:4:{i:0;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:0:{}s:7:"matches";a:1:{i:2;a:2:{s:6:"weight";s:4:"1695";s:5:"attrs";a:0:{}}}s:5:"total";s:1:"1";s:11:"total_found";s:1:"1";s:4:"time";s:5:"0.001";s:5:"words";a:1:{s:6:"second";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:7:"^second";}i:1;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:0:{}s:7:"matches";a:1:{i:4;a:2:{s:6:"weight";s:4:"2557";s:5:"attrs";a:0:{}}}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:"one";a:2:{s:4:"docs";s:1:"2";s:4:"hits";s:1:"2";}s:3:"two";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:""one two"";}i:2;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:0:{}s:7:"matches";a:1:{i:4;a:2:{s:6:"weight";s:4:"2557";s:5:"attrs";a:0:{}}}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:"one";a:2:{s:4:"docs";s:1:"2";s:4:"hits";s:1:"2";}s:3:"two";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:12:""one two"~10";}i:3;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:0:{}s:7:"matches";a:2:{i:4;a:2:{s:6:"weight";s:4:"2557";s:5:"attrs";a:0:{}}i:3;a:2:{s:6:"weight";s:4:"1557";s:5:"attrs";a:0:{}}}s:5:"total";s:1:"2";s:11:"total_found";s:1:"2";s:4:"time";s:5:"0.001";s:5:"words";a:2:{s:3:"one";a:2:{s:4:"docs";s:1:"2";s:4:"hits";s:1:"2";}s:3:"two";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:12:""one two"~11";}}}
a:1:{i:0;a:13:{i:0;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:0:{}s:7:"matches";a:1:{i:2;a:2:{s:6:"weight";s:4:"1695";s:5:"attrs";a:0:{}}}s:5:"total";s:1:"1";s:11:"total_found";s:1:"1";s:4:"time";s:5:"0.000";s:5:"words";a:1:{s:6:"second";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:7:"^second";}i:1;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:0:{}s:7:"matches";a:1:{i:4;a:2:{s:6:"weight";s:4:"2557";s:5:"attrs";a:0:{}}}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:"one";a:2:{s:4:"docs";s:1:"2";s:4:"hits";s:1:"2";}s:3:"two";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:""one two"";}i:2;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:0:{}s:7:"matches";a:1:{i:4;a:2:{s:6:"weight";s:4:"2557";s:5:"attrs";a:0:{}}}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:"one";a:2:{s:4:"docs";s:1:"2";s:4:"hits";s:1:"2";}s:3:"two";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:12:""one two"~10";}i:3;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:0:{}s:7:"matches";a:2:{i:4;a:2:{s:6:"weight";s:4:"2557";s:5:"attrs";a:0:{}}i:3;a:2:{s:6:"weight";s:4:"1557";s:5:"attrs";a:0:{}}}s:5:"total";s:1:"2";s:11:"total_found";s:1:"2";s:4:"time";s:5:"0.001";s:5:"words";a:2:{s:3:"one";a:2:{s:4:"docs";s:1:"2";s:4:"hits";s:1:"2";}s:3:"two";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:12:""one two"~11";}i:4;a:2:{s:8:"sphinxql";s:122:"INSERT INTO rt1 VALUES
( 1, 'first.', 11 ),
( 2, ' second', 11 ),
( 3, 'one. two three', 11 ),
( 4, 'one two three', 11 )
";s:14:"total_affected";i:4;}i:5;a:3:{s:8:"sphinxql";s:48:"SELECT * FROM rt1 WHERE MATCH ( '"one two"~10' )";s:10:"total_rows";i:1;s:4:"rows";a:1:{i:0;a:2:{s:2:"id";s:1:"4";s:3:"gid";s:2:"11";}}}i:6;a:3:{s:8:"sphinxql";s:48:"SELECT * FROM rt1 WHERE MATCH ( '"one two"~11' )";s:10:"total_rows";i:2;s:4:"rows";a:2:{i:0;a:2:{s:2:"id";s:1:"4";s:3:"gid";s:2:"11";}i:1;a:2:{s:2:"id";s:1:"3";s:3:"gid";s:2:"11";}}}i:7;a:2:{s:8:"sphinxql";s:18:"FLUSH RAMCHUNK rt1";s:14:"total_affected";i:0;}i:8;a:3:{s:8:"sphinxql";s:48:"SELECT * FROM rt1 WHERE MATCH ( '"one two"~10' )";s:10:"total_rows";i:1;s:4:"rows";a:1:{i:0;a:2:{s:2:"id";s:1:"4";s:3:"gid";s:2:"11";}}}i:9;a:3:{s:8:"sphinxql";s:48:"SELECT * FROM rt1 WHERE MATCH ( '"one two"~11' )";s:10:"total_rows";i:2;s:4:"rows";a:2:{i:0;a:2:{s:2:"id";s:1:"4";s:3:"gid";s:2:"11";}i:1;a:2:{s:2:"id";s:1:"3";s:3:"gid";s:2:"11";}}}i:10;a:2:{s:8:"sphinxql";s:47:"ATTACH INDEX disk1 TO RTINDEX rt1 WITH TRUNCATE";s:14:"total_affected";i:0;}i:11;a:3:{s:8:"sphinxql";s:48:"SELECT * FROM rt1 WHERE MATCH ( '"one two"~10' )";s:10:"total_rows";i:1;s:4:"rows";a:1:{i:0;a:2:{s:2:"id";s:1:"4";s:3:"gid";s:2:"11";}}}i:12;a:3:{s:8:"sphinxql";s:48:"SELECT * FROM rt1 WHERE MATCH ( '"one two"~11' )";s:10:"total_rows";i:2;s:4:"rows";a:2:{i:0;a:2:{s:2:"id";s:1:"4";s:3:"gid";s:2:"11";}i:1;a:2:{s:2:"id";s:1:"3";s:3:"gid";s:2:"11";}}}}}
@@ -3,6 +3,8 @@

<name>phrase boundaries</name>

<requires><non-rt/></requires>

<config>
indexer
{
@@ -29,6 +31,36 @@ index test
phrase_boundary = .
phrase_boundary_step = 10
}


source src1
{
type = mysql
<sql_settings/>
sql_query = SELECT *, 11 as gid FROM test_table
sql_attr_uint = gid
}

index disk1
{
source = src1
path = <data_path/>/disk1

phrase_boundary = .
phrase_boundary_step = 10
}

index rt1
{
type = rt
path = <data_path/>/rt1
rt_field = text
rt_attr_uint = gid
charset_table = a..z, A..Z->a..z, _

phrase_boundary = .
phrase_boundary_step = 10
}
</config>

<db_create>
@@ -52,10 +84,33 @@ INSERT INTO `test_table` VALUES
</db_insert>

<queries>
<query mode="extended2">^second</query>
<query mode="extended2">"one two"</query>
<query mode="extended2">"one two"~10</query>
<query mode="extended2">"one two"~11</query>
<query mode="extended2" index="test">^second</query>
<query mode="extended2" index="test">"one two"</query>
<query mode="extended2" index="test">"one two"~10</query>
<query mode="extended2" index="test">"one two"~11</query>
</queries>

<sphqueries>
<!-- regression rt index phrase_boundary setting -->
<sphinxql>INSERT INTO rt1 VALUES
( 1, 'first.', 11 ),
( 2, ' second', 11 ),
( 3, 'one. two three', 11 ),
( 4, 'one two three', 11 )
</sphinxql>
<!-- RAM part -->
<sphinxql>SELECT * FROM rt1 WHERE MATCH ( '"one two"~10' )</sphinxql>
<sphinxql>SELECT * FROM rt1 WHERE MATCH ( '"one two"~11' )</sphinxql>
<sphinxql>FLUSH RAMCHUNK rt1</sphinxql>
<!-- disk chunk -->
<sphinxql>SELECT * FROM rt1 WHERE MATCH ( '"one two"~10' )</sphinxql>
<sphinxql>SELECT * FROM rt1 WHERE MATCH ( '"one two"~11' )</sphinxql>
<sphinxql>ATTACH INDEX disk1 TO RTINDEX rt1 WITH TRUNCATE</sphinxql>
<!-- plain attached as disk chunk -->
<sphinxql>SELECT * FROM rt1 WHERE MATCH ( '"one two"~10' )</sphinxql>
<sphinxql>SELECT * FROM rt1 WHERE MATCH ( '"one two"~11' )</sphinxql>

</sphqueries>


</test>

0 comments on commit 6a217f6

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