Skip to content

Commit

Permalink
builds on windows again
Browse files Browse the repository at this point in the history
git-svn-id: http://sphinxsearch.googlecode.com/svn/trunk@4378 8b96e2b9-35c5-2c16-bc47-5122d61876d4
  • Loading branch information
shodan committed Nov 28, 2013
1 parent 19e5405 commit eab38da
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 38 deletions.
23 changes: 12 additions & 11 deletions src/sphinx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1292,8 +1292,8 @@ class CSphTokenizerIndex : public CSphIndex
virtual bool EarlyReject ( CSphQueryContext * , CSphMatch & ) const { return false; }
virtual const CSphSourceStats & GetStats () const { return g_tTmpDummyStat; }
virtual CSphIndexStatus GetStatus () const { CSphIndexStatus tRes; tRes.m_iDiskUse = 0; tRes.m_iRamUse = 0; return tRes; }
virtual bool MultiQuery ( const CSphQuery * , CSphQueryResult * , int , ISphMatchSorter ** , CSphMultiQueryArgs ) const { return false; }
virtual bool MultiQueryEx ( int , const CSphQuery * , CSphQueryResult ** , ISphMatchSorter ** , CSphMultiQueryArgs ) const { return false; }
virtual bool MultiQuery ( const CSphQuery * , CSphQueryResult * , int , ISphMatchSorter ** , const CSphMultiQueryArgs & ) const { return false; }
virtual bool MultiQueryEx ( int , const CSphQuery * , CSphQueryResult ** , ISphMatchSorter ** , const CSphMultiQueryArgs & ) const { return false; }
virtual bool GetKeywords ( CSphVector <CSphKeywordInfo> & , const char * , bool , CSphString * ) const;
virtual bool FillKeywords ( CSphVector <CSphKeywordInfo> & ) const { return true; }
virtual int UpdateAttributes ( const CSphAttrUpdate & , int , CSphString & , CSphString & ) { return -1; }
Expand Down Expand Up @@ -1370,11 +1370,12 @@ bool CSphTokenizerIndex::GetKeywords ( CSphVector <CSphKeywordInfo> & dKeywords,
}


CSphIndex * sphCreateIndexTemplate ( )
CSphIndex * sphCreateIndexTemplate ( )
{
return new CSphTokenizerIndex();
}


/// this is my actual VLN-compressed phrase index implementation
class CSphIndex_VLN : public CSphIndex
{
Expand Down Expand Up @@ -1415,8 +1416,8 @@ class CSphIndex_VLN : public CSphIndex
virtual void Unlock ();
virtual void PostSetup() {}

virtual bool MultiQuery ( const CSphQuery * pQuery, CSphQueryResult * pResult, int iSorters, ISphMatchSorter ** ppSorters, CSphMultiQueryArgs tArgs ) const;
virtual bool MultiQueryEx ( int iQueries, const CSphQuery * pQueries, CSphQueryResult ** ppResults, ISphMatchSorter ** ppSorters, CSphMultiQueryArgs tArgs ) const;
virtual bool MultiQuery ( const CSphQuery * pQuery, CSphQueryResult * pResult, int iSorters, ISphMatchSorter ** ppSorters, const CSphMultiQueryArgs & tArgs ) const;
virtual bool MultiQueryEx ( int iQueries, const CSphQuery * pQueries, CSphQueryResult ** ppResults, ISphMatchSorter ** ppSorters, const CSphMultiQueryArgs & tArgs ) const;
virtual bool GetKeywords ( CSphVector <CSphKeywordInfo> & dKeywords, const char * szQuery, bool bGetStats, CSphString * pError ) const;
template <class Qword> bool DoGetKeywords ( CSphVector <CSphKeywordInfo> & dKeywords, const char * szQuery, bool bGetStats, bool bFillOnly, CSphString * pError ) const;
virtual bool FillKeywords ( CSphVector <CSphKeywordInfo> & dKeywords ) const;
Expand Down Expand Up @@ -1525,8 +1526,8 @@ class CSphIndex_VLN : public CSphIndex
private:
CSphString GetIndexFileName ( const char * sExt ) const;

bool ParsedMultiQuery ( const CSphQuery * pQuery, CSphQueryResult * pResult, int iSorters, ISphMatchSorter ** ppSorters, const XQQuery_t & tXQ, CSphDict * pDict, CSphMultiQueryArgs tArgs, CSphQueryNodeCache * pNodeCache ) const;
bool MultiScan ( const CSphQuery * pQuery, CSphQueryResult * pResult, int iSorters, ISphMatchSorter ** ppSorters, CSphMultiQueryArgs tArgs ) const;
bool ParsedMultiQuery ( const CSphQuery * pQuery, CSphQueryResult * pResult, int iSorters, ISphMatchSorter ** ppSorters, const XQQuery_t & tXQ, CSphDict * pDict, const CSphMultiQueryArgs & tArgs, CSphQueryNodeCache * pNodeCache ) const;
bool MultiScan ( const CSphQuery * pQuery, CSphQueryResult * pResult, int iSorters, ISphMatchSorter ** ppSorters, const CSphMultiQueryArgs & tArgs ) const;
void MatchExtended ( CSphQueryContext * pCtx, const CSphQuery * pQuery, int iSorters, ISphMatchSorter ** ppSorters, ISphRanker * pRanker, int iTag, int iIndexWeight, const CSphVector<SphDocID_t> & dKillList ) const;

const DWORD * FindDocinfo ( SphDocID_t uDocID ) const;
Expand Down Expand Up @@ -15132,7 +15133,7 @@ struct SphFinalMatchCalc_t : ISphMatchProcessor, ISphNoncopyable


bool CSphIndex_VLN::MultiScan ( const CSphQuery * pQuery, CSphQueryResult * pResult,
int iSorters, ISphMatchSorter ** ppSorters, CSphMultiQueryArgs tArgs ) const
int iSorters, ISphMatchSorter ** ppSorters, const CSphMultiQueryArgs & tArgs ) const
{
assert ( pQuery->m_sQuery.IsEmpty() );
assert ( tArgs.m_iTag>=0 );
Expand Down Expand Up @@ -18198,7 +18199,7 @@ struct CmpPSortersByRandom_fn

/// one regular query vs many sorters
bool CSphIndex_VLN::MultiQuery ( const CSphQuery * pQuery, CSphQueryResult * pResult,
int iSorters, ISphMatchSorter ** ppSorters, CSphMultiQueryArgs tArgs ) const
int iSorters, ISphMatchSorter ** ppSorters, const CSphMultiQueryArgs & tArgs ) const
{
assert ( pQuery );
CSphQueryProfile * pProfile = pResult->m_pProfile;
Expand Down Expand Up @@ -18297,7 +18298,7 @@ bool CSphIndex_VLN::MultiQuery ( const CSphQuery * pQuery, CSphQueryResult * pRe
/// many regular queries with one sorter attached to each query.
/// returns true if at least one query succeeded. The failed queries indicated with pResult->m_iMultiplier==-1
bool CSphIndex_VLN::MultiQueryEx ( int iQueries, const CSphQuery * pQueries,
CSphQueryResult ** ppResults, ISphMatchSorter ** ppSorters, CSphMultiQueryArgs tArgs ) const
CSphQueryResult ** ppResults, ISphMatchSorter ** ppSorters, const CSphMultiQueryArgs & tArgs ) const
{
// ensure we have multiple queries
assert ( ppResults );
Expand Down Expand Up @@ -18424,7 +18425,7 @@ bool CSphIndex_VLN::MultiQueryEx ( int iQueries, const CSphQuery * pQueries,

bool CSphIndex_VLN::ParsedMultiQuery ( const CSphQuery * pQuery, CSphQueryResult * pResult,
int iSorters, ISphMatchSorter ** ppSorters, const XQQuery_t & tXQ, CSphDict * pDict,
CSphMultiQueryArgs tArgs, CSphQueryNodeCache * pNodeCache ) const
const CSphMultiQueryArgs & tArgs, CSphQueryNodeCache * pNodeCache ) const
{
assert ( pQuery );
assert ( pResult );
Expand Down
6 changes: 3 additions & 3 deletions src/sphinx.h
Original file line number Diff line number Diff line change
Expand Up @@ -3165,7 +3165,7 @@ struct CSphIndexStatus
};


struct CSphMultiQueryArgs
struct CSphMultiQueryArgs : public ISphNoncopyable
{
const CSphVector<SphDocID_t> & m_dKillList;
const int m_iIndexWeight;
Expand Down Expand Up @@ -3273,8 +3273,8 @@ class CSphIndex : public ISphKeywordsStat
public:
virtual bool EarlyReject ( CSphQueryContext * pCtx, CSphMatch & tMatch ) const = 0;
void SetCacheSize ( int iMaxCachedDocs, int iMaxCachedHits );
virtual bool MultiQuery ( const CSphQuery * pQuery, CSphQueryResult * pResult, int iSorters, ISphMatchSorter ** ppSorters, CSphMultiQueryArgs tArgs ) const = 0;
virtual bool MultiQueryEx ( int iQueries, const CSphQuery * ppQueries, CSphQueryResult ** ppResults, ISphMatchSorter ** ppSorters, CSphMultiQueryArgs tArgs ) const = 0;
virtual bool MultiQuery ( const CSphQuery * pQuery, CSphQueryResult * pResult, int iSorters, ISphMatchSorter ** ppSorters, const CSphMultiQueryArgs & tArgs ) const = 0;
virtual bool MultiQueryEx ( int iQueries, const CSphQuery * ppQueries, CSphQueryResult ** ppResults, ISphMatchSorter ** ppSorters, const CSphMultiQueryArgs & tArgs ) const = 0;
virtual bool GetKeywords ( CSphVector <CSphKeywordInfo> & dKeywords, const char * szQuery, bool bGetStats, CSphString * pError ) const = 0;
virtual bool FillKeywords ( CSphVector <CSphKeywordInfo> & dKeywords ) const = 0;

Expand Down
8 changes: 4 additions & 4 deletions src/sphinxrt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1136,8 +1136,8 @@ struct RtIndex_t : public ISphRtIndex, public ISphNoncopyable, public ISphWordli
virtual const CSphSourceStats & GetStats () const { return m_tStats; }
virtual CSphIndexStatus GetStatus () const;

virtual bool MultiQuery ( const CSphQuery * pQuery, CSphQueryResult * pResult, int iSorters, ISphMatchSorter ** ppSorters, CSphMultiQueryArgs tArgs ) const;
virtual bool MultiQueryEx ( int iQueries, const CSphQuery * ppQueries, CSphQueryResult ** ppResults, ISphMatchSorter ** ppSorters, CSphMultiQueryArgs tArgs ) const;
virtual bool MultiQuery ( const CSphQuery * pQuery, CSphQueryResult * pResult, int iSorters, ISphMatchSorter ** ppSorters, const CSphMultiQueryArgs & tArgs ) const;
virtual bool MultiQueryEx ( int iQueries, const CSphQuery * ppQueries, CSphQueryResult ** ppResults, ISphMatchSorter ** ppSorters, const CSphMultiQueryArgs & tArgs ) const;
bool DoGetKeywords ( CSphVector <CSphKeywordInfo> & dKeywords, const char * szQuery, bool bGetStats, bool bFillOnly, CSphString * pError ) const;
virtual bool GetKeywords ( CSphVector <CSphKeywordInfo> & dKeywords, const char * szQuery, bool bGetStats, CSphString * pError ) const;
virtual bool FillKeywords ( CSphVector <CSphKeywordInfo> & dKeywords ) const;
Expand Down Expand Up @@ -5990,7 +5990,7 @@ struct SphFinalArenaCopy_t : ISphMatchProcessor
// FIXME? any chance to factor out common backend agnostic code?
// FIXME? do we need to support pExtraFilters?
bool RtIndex_t::MultiQuery ( const CSphQuery * pQuery, CSphQueryResult * pResult, int iSorters,
ISphMatchSorter ** ppSorters, CSphMultiQueryArgs tArgs ) const
ISphMatchSorter ** ppSorters, const CSphMultiQueryArgs & tArgs ) const
{
assert ( ppSorters );
assert ( pResult );
Expand Down Expand Up @@ -6607,7 +6607,7 @@ bool RtIndex_t::MultiQuery ( const CSphQuery * pQuery, CSphQueryResult * pResult
}

bool RtIndex_t::MultiQueryEx ( int iQueries, const CSphQuery * ppQueries, CSphQueryResult ** ppResults,
ISphMatchSorter ** ppSorters, CSphMultiQueryArgs tArgs ) const
ISphMatchSorter ** ppSorters, const CSphMultiQueryArgs & tArgs ) const
{
// FIXME! OPTIMIZE! implement common subtree cache here
bool bResult = false;
Expand Down
29 changes: 14 additions & 15 deletions src/sphinxutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2295,7 +2295,9 @@ const char * sphGetRankerName ( ESphRankMode eRanker )
return g_dRankerNames[eRanker];
}

void CSphDynamicLibrary::FillError ( const char* sMessage )
#if HAVE_DLOPEN

void CSphDynamicLibrary::FillError ( const char * sMessage )
{
const char* sDlerror = dlerror();
if ( sMessage )
Expand All @@ -2304,9 +2306,8 @@ void CSphDynamicLibrary::FillError ( const char* sMessage )
m_sError.SetSprintf ( "%s", sDlerror ? sDlerror : "(null)" );
}

bool CSphDynamicLibrary::Init ( const char* sPath, bool bGlobal )
bool CSphDynamicLibrary::Init ( const char * sPath, bool bGlobal )
{
#if HAVE_DLOPEN
if ( m_pLibrary )
return true;
int iFlags = bGlobal?(RTLD_NOW | RTLD_GLOBAL):(RTLD_LAZY|RTLD_LOCAL);
Expand All @@ -2319,35 +2320,28 @@ bool CSphDynamicLibrary::Init ( const char* sPath, bool bGlobal )
sphLogDebug ( "dlopen(%s)=%p", sPath, m_pLibrary );
m_bReady = true;
return m_bReady;
#else
return false;
#endif
}

bool CSphDynamicLibrary::LoadSymbol ( const char* sName, void** ppFunc )
{
#if HAVE_DLOPEN
if ( !m_pLibrary )
return false;

if ( !m_bReady )
return false;

void* pResult = dlsym ( m_pLibrary, sName );
void * pResult = dlsym ( m_pLibrary, sName );
if ( !pResult )
{
FillError ( "Symbol not found" );
return false;
}
*ppFunc = pResult;
return true;
#else
return false;
#endif
}

bool CSphDynamicLibrary::LoadSymbols ( const char** sNames, void*** pppFuncs, int iNum )
{
#if HAVE_DLOPEN
if ( !m_pLibrary )
return false;

Expand All @@ -2372,11 +2366,16 @@ bool CSphDynamicLibrary::LoadSymbols ( const char** sNames, void*** pppFuncs, in
}

return true;
#else
return false;
#endif
};

#else

void CSphDynamicLibrary::FillError ( const char * e ) { m_sError = e; }
bool CSphDynamicLibrary::Init ( const char *, bool ) { return false; }
bool CSphDynamicLibrary::LoadSymbol ( const char *, void ** ) { return false; }
bool CSphDynamicLibrary::LoadSymbols ( const char **, void ***, int ) { return false; }

#endif

//
// $Id$
Expand Down
2 changes: 0 additions & 2 deletions src/sphinxutils.h
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,6 @@ class CSphDynamicLibrary : public ISphNoncopyable
void FillError ( const char* sMessage=NULL );
};



#endif // _sphinxutils_

//
Expand Down
3 changes: 2 additions & 1 deletion src/testrt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ void DoSearch ( CSphIndex * pIndex )

CSphQuery tQuery;
CSphQueryResult tResult;
CSphMultiQueryArgs tArgs ( NULL, 1 );
CSphVector<SphDocID_t> dDummyKlist;
CSphMultiQueryArgs tArgs ( dDummyKlist, 1 );
tQuery.m_sQuery = "@title cat";

SphQueueSettings_t tQueueSettings ( tQuery, pIndex->GetMatchSchema(), tResult.m_sError, NULL );
Expand Down
4 changes: 2 additions & 2 deletions src/tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -979,8 +979,8 @@ class CSphDummyIndex : public CSphIndex
virtual bool EarlyReject ( CSphQueryContext * , CSphMatch & ) const { return false; }
virtual const CSphSourceStats & GetStats () const { return g_tTmpDummyStat; }
virtual CSphIndexStatus GetStatus () const { CSphIndexStatus tRes; tRes.m_iDiskUse = 0; tRes.m_iRamUse = 0; return tRes; }
virtual bool MultiQuery ( const CSphQuery * , CSphQueryResult * , int , ISphMatchSorter ** , CSphMultiQueryArgs ) const { return false; }
virtual bool MultiQueryEx ( int , const CSphQuery * , CSphQueryResult ** , ISphMatchSorter ** , CSphMultiQueryArgs ) const { return false; }
virtual bool MultiQuery ( const CSphQuery * , CSphQueryResult * , int , ISphMatchSorter ** , const CSphMultiQueryArgs & ) const { return false; }
virtual bool MultiQueryEx ( int , const CSphQuery * , CSphQueryResult ** , ISphMatchSorter ** , const CSphMultiQueryArgs & ) const { return false; }
virtual bool GetKeywords ( CSphVector <CSphKeywordInfo> & , const char * , bool , CSphString * ) const { return false; }
virtual bool FillKeywords ( CSphVector <CSphKeywordInfo> & dKeywords ) const;
virtual int UpdateAttributes ( const CSphAttrUpdate & , int , CSphString &, CSphString & ) { return -1; }
Expand Down

0 comments on commit eab38da

Please sign in to comment.