mirror of
https://github.com/xiaoyifang/goldendict-ng.git
synced 2024-11-27 19:24:08 +00:00
Fix bug in full-text search in "RegExp" mode
This commit is contained in:
parent
38adb08ea9
commit
e037533424
|
@ -42,6 +42,7 @@ bool parseSearchString( QString const & str, QStringList & indexWords,
|
||||||
QRegExp spacesRegExp( "\\W+" );
|
QRegExp spacesRegExp( "\\W+" );
|
||||||
QRegExp wordRegExp( QString( "\\w{" ) + QString::number( FTS::MinimumWordSize ) + ",}" );
|
QRegExp wordRegExp( QString( "\\w{" ) + QString::number( FTS::MinimumWordSize ) + ",}" );
|
||||||
QRegExp setsRegExp( "\\[[^\\]]+\\]", Qt::CaseInsensitive, QRegExp::RegExp2 );
|
QRegExp setsRegExp( "\\[[^\\]]+\\]", Qt::CaseInsensitive, QRegExp::RegExp2 );
|
||||||
|
QRegExp regexRegExp( "\\\\[afnrtvdDwWsSbB]|\\\\x([0-9A-Fa-f]{4})|\\\\0([0-7]{3})", Qt::CaseSensitive, QRegExp::RegExp2 );
|
||||||
|
|
||||||
hasCJK = false;
|
hasCJK = false;
|
||||||
for( int x = 0; x < str.size(); x++ )
|
for( int x = 0; x < str.size(); x++ )
|
||||||
|
@ -100,6 +101,10 @@ bool parseSearchString( QString const & str, QStringList & indexWords,
|
||||||
|
|
||||||
QString tmp = str;
|
QString tmp = str;
|
||||||
|
|
||||||
|
// Remove RegExp commands
|
||||||
|
if( searchMode == FTS::RegExp )
|
||||||
|
tmp.replace( regexRegExp, " " );
|
||||||
|
|
||||||
// Remove all symbol sets
|
// Remove all symbol sets
|
||||||
tmp.replace( setsRegExp, " " );
|
tmp.replace( setsRegExp, " " );
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue