turtle search is now working. Next task: update search gui

git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@1078 b45a01b8-16f6-495d-af2f-9b41ad6348cc
This commit is contained in:
csoler 2009-03-15 22:45:40 +00:00
parent 148c918ae1
commit 7b84b125df
26 changed files with 2329 additions and 118 deletions

View file

@ -405,7 +405,7 @@ int FileIndexStore::SearchHash(std::string hash, std::list<FileDetail> &results)
}
int FileIndexStore::SearchKeywords(std::list<std::string> keywords, std::list<FileDetail> &results) const
int FileIndexStore::SearchKeywords(std::list<std::string> keywords, std::list<FileDetail> &results,uint32_t flags) const
{
lockData();
std::map<RsPeerId, FileIndex *>::const_iterator pit;
@ -417,49 +417,52 @@ int FileIndexStore::SearchKeywords(std::list<std::string> keywords, std::list<Fi
#ifdef FIS_DEBUG
std::cerr << "FileIndexStore::SearchKeywords()" << std::endl;
#endif
for(pit = indices.begin(); pit != indices.end(); pit++)
{
firesults.clear();
(pit->second)->searchTerms(keywords, firesults);
/* translate results */
for(rit = firesults.begin(); rit != firesults.end(); rit++)
if(flags & DIR_FLAGS_REMOTE)
for(pit = indices.begin(); pit != indices.end(); pit++)
{
FileDetail fd;
fd.id = pit->first;
fd.name = (*rit)->name;
fd.hash = (*rit)->hash;
fd.path = ""; /* TODO */
fd.size = (*rit)->size;
fd.age = now - (*rit)->modtime;
fd.rank = (*rit)->pop;
firesults.clear();
(pit->second)->searchTerms(keywords, firesults);
/* translate results */
for(rit = firesults.begin(); rit != firesults.end(); rit++)
{
FileDetail fd;
fd.id = pit->first;
fd.name = (*rit)->name;
fd.hash = (*rit)->hash;
fd.path = ""; /* TODO */
fd.size = (*rit)->size;
fd.age = now - (*rit)->modtime;
fd.rank = (*rit)->pop;
results.push_back(fd);
}
results.push_back(fd);
}
}
if (localindex)
{
firesults.clear();
localindex->searchTerms(keywords, firesults);
/* translate results */
for(rit = firesults.begin(); rit != firesults.end(); rit++)
if(flags & DIR_FLAGS_LOCAL)
if (localindex)
{
FileDetail fd;
fd.id = "Local"; //localId;
fd.name = (*rit)->name;
fd.hash = (*rit)->hash;
fd.path = ""; /* TODO */
fd.size = (*rit)->size;
fd.age = now - (*rit)->modtime;
fd.rank = (*rit)->pop;
firesults.clear();
localindex->searchTerms(keywords, firesults);
/* translate results */
for(rit = firesults.begin(); rit != firesults.end(); rit++)
{
FileDetail fd;
fd.id = "Local"; //localId;
fd.name = (*rit)->name;
fd.hash = (*rit)->hash;
fd.path = ""; /* TODO */
fd.size = (*rit)->size;
fd.age = now - (*rit)->modtime;
fd.rank = (*rit)->pop;
results.push_back(fd);
}
results.push_back(fd);
}
}
unlockData();
return results.size();
}

View file

@ -74,7 +74,7 @@ virtual int loadCache(const CacheData &data); /* actual load, once data availa
int SearchHash(std::string hash, std::list<FileDetail> &results) const;
/* Search Interface - For Search Interface */
int SearchKeywords(std::list<std::string> terms, std::list<FileDetail> &results) const;
int SearchKeywords(std::list<std::string> terms, std::list<FileDetail> &results,uint32_t flags) const;
/* Search Interface - for Adv Search Interface */
int searchBoolExp(Expression * exp, std::list<FileDetail> &results) const;