本文整理汇总了C++中SearchEngineInterface::getResultsCharset方法的典型用法代码示例。如果您正苦于以下问题:C++ SearchEngineInterface::getResultsCharset方法的具体用法?C++ SearchEngineInterface::getResultsCharset怎么用?C++ SearchEngineInterface::getResultsCharset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SearchEngineInterface
的用法示例。
在下文中一共展示了SearchEngineInterface::getResultsCharset方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: doWork
void QueryingThread::doWork(void)
{
// Get the SearchEngine
SearchEngineInterface *engine = SearchEngineFactory::getSearchEngine(m_engineName, m_engineOption);
if (engine == NULL)
{
m_status = _("Couldn't create search engine");
m_status += " ";
m_status += m_engineDisplayableName;
return;
}
// Set the maximum number of results
engine->setMaxResultsCount(m_queryProps.getMaximumResultsCount());
// Run the query
if (engine->runQuery(m_queryProps) == false)
{
m_status = _("Couldn't run query on search engine");
m_status += " ";
m_status += m_engineDisplayableName;
}
else
{
const vector<Result> &resultsList = engine->getResults();
m_resultsList.clear();
m_resultsList.reserve(resultsList.size());
m_resultsCharset = engine->getResultsCharset();
// Copy the results list
for (vector<Result>::const_iterator resultIter = resultsList.begin();
resultIter != resultsList.end(); ++resultIter)
{
string title = _("No title");
string extract = HtmlTokenizer::stripTags(resultIter->getExtract());
// The title may contain formatting
if (resultIter->getTitle().empty() == false)
{
title = HtmlTokenizer::stripTags(resultIter->getTitle());
}
string language = resultIter->getLanguage();
if (language.empty() == true)
{
// Use the query's language
language = m_queryProps.getLanguage();
}
m_resultsList.push_back(Result(resultIter->getLocation(),
title,
extract,
language,
resultIter->getScore()));
}
}
delete engine;
}
示例2: doWork
void QueryingThread::doWork(void)
{
PinotSettings &settings = PinotSettings::getInstance();
// Get the SearchEngine
SearchEngineInterface *pEngine = SearchEngineFactory::getSearchEngine(m_engineName, m_engineOption);
if (pEngine == NULL)
{
m_status = _("Couldn't create search engine");
m_status += " ";
m_status += m_engineDisplayableName;
return;
}
// Set the maximum number of results
pEngine->setMaxResultsCount(m_queryProps.getMaximumResultsCount());
// Set up the proxy
DownloaderInterface *pDownloader = pEngine->getDownloader();
if ((pDownloader != NULL) &&
(settings.m_proxyEnabled == true) &&
(settings.m_proxyAddress.empty() == false))
{
char portStr[64];
pDownloader->setSetting("proxyaddress", settings.m_proxyAddress);
snprintf(portStr, 64, "%u", settings.m_proxyPort);
pDownloader->setSetting("proxyport", portStr);
pDownloader->setSetting("proxytype", settings.m_proxyType);
}
// Run the query
if (pEngine->runQuery(m_queryProps) == false)
{
m_status = _("Couldn't run query on search engine");
m_status += " ";
m_status += m_engineDisplayableName;
}
else
{
IndexInterface *pDocsIndex = NULL;
IndexInterface *pDaemonIndex = NULL;
const vector<Result> &resultsList = pEngine->getResults();
unsigned int indexId = 0;
bool isIndexQuery = false;
m_resultsList.clear();
m_resultsList.reserve(resultsList.size());
m_resultsCharset = pEngine->getResultsCharset();
// Are we querying an index ?
if (m_engineName == "xapian")
{
// Internal index ?
if (m_engineOption == settings.m_docsIndexLocation)
{
indexId = settings.getIndexId(_("My Web Pages"));
isIndexQuery = true;
}
else if (m_engineOption == settings.m_daemonIndexLocation)
{
indexId = settings.getIndexId(_("My Documents"));
isIndexQuery = true;
}
}
// Will we have to query internal indices ?
if (isIndexQuery == false)
{
pDocsIndex = settings.getIndex(settings.m_docsIndexLocation);
pDaemonIndex = settings.getIndex(settings.m_daemonIndexLocation);
}
// Copy the results list
for (vector<Result>::const_iterator resultIter = resultsList.begin();
resultIter != resultsList.end(); ++resultIter)
{
Result current(*resultIter);
string title(_("No title"));
string location(current.getLocation());
string language(current.getLanguage());
unsigned int docId = 0;
// The title may contain formatting
if (current.getTitle().empty() == false)
{
title = FilterUtils::stripMarkup(current.getTitle());
}
current.setTitle(title);
#ifdef DEBUG
cout << "QueryingThread::doWork: title is " << title << endl;
#endif
// Use the query's language if the result's is unknown
if (language.empty() == true)
{
language = m_queryProps.getLanguage();
}
current.setLanguage(language);
//.........这里部分代码省略.........
示例3: doWork
void EngineQueryThread::doWork(void)
{
PinotSettings &settings = PinotSettings::getInstance();
// Get the SearchEngine
SearchEngineInterface *pEngine = SearchEngineFactory::getSearchEngine(m_engineName, m_engineOption);
if (pEngine == NULL)
{
m_errorNum = UNKNOWN_ENGINE;
m_errorParam = m_engineDisplayableName;
return;
}
// Set up the proxy
DownloaderInterface *pDownloader = pEngine->getDownloader();
if ((pDownloader != NULL) &&
(settings.m_proxyEnabled == true) &&
(settings.m_proxyAddress.empty() == false))
{
char portStr[64];
pDownloader->setSetting("proxyaddress", settings.m_proxyAddress);
snprintf(portStr, 64, "%u", settings.m_proxyPort);
pDownloader->setSetting("proxyport", portStr);
pDownloader->setSetting("proxytype", settings.m_proxyType);
}
if (m_listingIndex == false)
{
pEngine->setLimitSet(m_limitToDocsSet);
}
// Run the query
pEngine->setDefaultOperator(SearchEngineInterface::DEFAULT_OP_AND);
if (pEngine->runQuery(m_queryProps, m_startDoc) == false)
{
m_errorNum = QUERY_FAILED;
m_errorParam = m_engineDisplayableName;
}
else
{
const vector<DocumentInfo> &resultsList = pEngine->getResults();
m_documentsList.clear();
m_documentsList.reserve(resultsList.size());
m_documentsCount = pEngine->getResultsCountEstimate();
#ifdef DEBUG
cout << "EngineQueryThread::doWork: " << resultsList.size() << " off " << m_documentsCount
<< " results to process, starting at position " << m_startDoc << endl;
#endif
m_resultsCharset = pEngine->getResultsCharset();
if (m_listingIndex == false)
{
processResults(resultsList);
}
else
{
processResults(resultsList,
PinotSettings::getInstance().getIndexIdByName(m_engineDisplayableName));
}
// Any spelling correction ?
string correctedFreeQuery(pEngine->getSpellingCorrection());
if (correctedFreeQuery.empty() == false)
{
m_correctedSpelling = true;
m_queryProps.setFreeQuery(correctedFreeQuery);
}
}
delete pEngine;
}
示例4: doWork
void QueryingThread::doWork(void)
{
PinotSettings &settings = PinotSettings::getInstance();
// Get the SearchEngine
SearchEngineInterface *pEngine = SearchEngineFactory::getSearchEngine(m_engineName, m_engineOption);
if (pEngine == NULL)
{
m_status = _("Couldn't create search engine");
m_status += " ";
m_status += m_engineDisplayableName;
return;
}
// Set up the proxy
DownloaderInterface *pDownloader = pEngine->getDownloader();
if ((pDownloader != NULL) &&
(settings.m_proxyEnabled == true) &&
(settings.m_proxyAddress.empty() == false))
{
char portStr[64];
pDownloader->setSetting("proxyaddress", settings.m_proxyAddress);
snprintf(portStr, 64, "%u", settings.m_proxyPort);
pDownloader->setSetting("proxyport", portStr);
pDownloader->setSetting("proxytype", settings.m_proxyType);
}
// Run the query
if (pEngine->runQuery(m_queryProps, m_startDoc) == false)
{
m_status = _("Couldn't run query on search engine");
m_status += " ";
m_status += m_engineDisplayableName;
}
else
{
const vector<DocumentInfo> &resultsList = pEngine->getResults();
m_documentsList.clear();
m_documentsList.reserve(resultsList.size());
m_documentsCount = pEngine->getResultsCountEstimate();
#ifdef DEBUG
cout << "QueryingThread::doWork: " << resultsList.size() << " off " << m_documentsCount
<< " results to process, starting at position " << m_startDoc << endl;
#endif
m_resultsCharset = pEngine->getResultsCharset();
if (m_listingIndex == false)
{
processResults(resultsList);
}
else
{
processResults(resultsList,
PinotSettings::getInstance().getIndexId(m_engineDisplayableName));
}
}
delete pEngine;
}