Skip to content

Commit

Permalink
fixed #690 crash of daemon on match mode all and empty full text quer…
Browse files Browse the repository at this point in the history
…y; added regression to gtest
  • Loading branch information
tomatolog committed Feb 26, 2019
1 parent daa88b5 commit 84fe740
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
9 changes: 9 additions & 0 deletions src/gtests_searchd.cpp
Expand Up @@ -251,4 +251,13 @@ TEST ( searchd_stuff, iovec_behaviour )
ASSERT_EQ ( tIO.IOSize (), 1 );
tIO.StepForward (4);
ASSERT_EQ ( tIO.IOSize (), 0 );
}

TEST ( searchd_stuff, prepare_emulation )
{
CSphQuery tQuery;
tQuery.m_eMode = SPH_MATCH_ALL;
PrepareQueryEmulation ( &tQuery );

ASSERT_EQ ( tQuery.m_eRanker, SPH_RANK_PROXIMITY );
}
2 changes: 1 addition & 1 deletion src/searchd.cpp
Expand Up @@ -3756,7 +3756,7 @@ void PrepareQueryEmulation ( CSphQuery * pQuery )
return;

const char * szQuery = pQuery->m_sRawQuery.cstr ();
int iQueryLen = strlen(szQuery);
int iQueryLen = ( szQuery ? strlen(szQuery) : 0 );

pQuery->m_sQuery.Reserve ( iQueryLen*2+8 );
char * szRes = (char*) pQuery->m_sQuery.cstr ();
Expand Down

0 comments on commit 84fe740

Please sign in to comment.