Merge pull request #2670 from csoler/v0.6-BugFixing_20

fixed advanced search not using browsable/distant/own files
This commit is contained in:
csoler 2023-01-28 14:16:06 +01:00 committed by GitHub
commit 3dca053fb5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -805,28 +805,29 @@ void SearchDialog::advancedSearch(RsRegularExpression::Expression* expression)
{
advSearchDialog->hide();
/* call to core */
std::list<DirDetails> results;
// send a turtle search request
RsRegularExpression::LinearizedExpression e ;
expression->linearize(e) ;
TurtleRequestId req_id = rsFiles->turtleSearch(e) ;
TurtleRequestId req_id ;
if(ui._anonF2Fsearch_CB->isChecked())
req_id = rsFiles->turtleSearch(e) ;
else
req_id = RSRandom::random_u32() ; // generate a random 32 bits request id
// This will act before turtle results come to the interface, thanks to the signals scheduling policy.
initSearchResult(QString::fromStdString(e.GetStrings()),req_id, ui.FileTypeComboBox->currentIndex(), true) ;
rsFiles -> SearchBoolExp(expression, results, RS_FILE_HINTS_REMOTE);// | DIR_FLAGS_NETWORK_WIDE | DIR_FLAGS_BROWSABLE);
std::list<DirDetails> results;
FileSearchFlags flags(0);
if(ui._ownFiles_CB->isChecked()) flags |= RS_FILE_HINTS_LOCAL;
if(ui._friendListsearch_SB->isChecked()) flags |= RS_FILE_HINTS_REMOTE;
rsFiles -> SearchBoolExp(expression, results, flags);
/* abstraction to allow reusee of tree rendering code */
resultsToTree(advSearchDialog->getSearchAsString(),req_id, results);
// // debug stuff
// Expression *expression2 = LinearizedExpression::toExpr(e) ;
// results.clear() ;
// rsFiles -> SearchBoolExp(expression2, results, DIR_FLAGS_REMOTE | DIR_FLAGS_NETWORK_WIDE | DIR_FLAGS_BROWSABLE);
// resultsToTree((advSearchDialog->getSearchAsString()).toStdString(),req_id+1, results);
}
void SearchDialog::searchKeywords()
@ -1455,7 +1456,6 @@ void SearchDialog::copyResultLink()
{
/* should also be able to handle multi-selection */
QList<QTreeWidgetItem*> itemsForCopy = ui.searchResultWidget->selectedItems();
QTreeWidgetItem * item;
std::set<RsFileHash> already_seen_hashes;
QList<RetroShareLink> urls ;