Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

introduce inApps[] filter for search via ajax query #12555

Merged
merged 1 commit into from Dec 15, 2014

Conversation

butonic
Copy link
Member

@butonic butonic commented Dec 2, 2014

Make file results show up in files app only, allows limiting search results to specific apps. see #821

Gracefully handles old apps that don't set the apps option for a search provider.

@PVince81 do we have a JS api to get the currently active app? I currently use var classList = document.getElementById('content').className.split(/\s+/); and grab the first class starting with 'app-' ... but that seems hackish to me.

PRs for contacts, calendar and other apps to follow, as well as a PR to move results to the content area instead of the current tiny dropdown overlay.

@PVince81
Copy link
Contributor

PVince81 commented Dec 2, 2014

@butonic raised ticket to add a proper JS API: #12557

@butonic
Copy link
Member Author

butonic commented Dec 2, 2014

cc @jancborchardt @MTRichards

$this->options = $options;
}

/**
* get a value from the options array or null
* @param string $key
* @return string|array
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

string|null?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hm, mixed actually

@ghost
Copy link

ghost commented Dec 2, 2014

🚀 Test PASSed. 🚀
Refer to this link for build results (access rights to CI server needed):
https://ci.owncloud.org//job/pull-request-analyser-ng-simple/3643/
🚀 Test PASSed. 🚀

@DeepDiver1975
Copy link
Member

squasch? 🙈 👍

@butonic
Copy link
Member Author

butonic commented Dec 3, 2014

another review? @andrewsbrown maybe?

@abrown
Copy link
Member

abrown commented Dec 3, 2014

I like it, 👍 . Side note: What's the rationale for lines 46 and 47 in lib/private/search.php? It looks like backwards compatibility but could you confirm and maybe document? The difference between forApps and inApps wasn't readily apparent...

@ghost
Copy link

ghost commented Dec 3, 2014

🚀 Test PASSed. 🚀
Refer to this link for build results (access rights to CI server needed):
https://ci.owncloud.org//job/pull-request-analyser-ng-simple/3679/
🚀 Test PASSed. 🚀

…s show up in files app only

use more flexible return type

check array with !empty instead of count
@butonic
Copy link
Member Author

butonic commented Dec 10, 2014

@andrewsbrown I moved the code to a documented function in the abstract search provider.
@schiesbn @PVince81 another review?

@ghost
Copy link

ghost commented Dec 10, 2014

🚀 Test PASSed. 🚀
Refer to this link for build results (access rights to CI server needed):
https://ci.owncloud.org//job/pull-request-analyser-ng-simple/4230/
🚀 Test PASSed. 🚀

@scrutinizer-notifier
Copy link

The inspection completed: 7 new issues, 2 updated code elements

@butonic butonic mentioned this pull request Dec 11, 2014
4 tasks
@butonic butonic changed the title introduce inApps[] filter for search via ajax query [WIP] introduce inApps[] filter for search via ajax query Dec 11, 2014
@butonic
Copy link
Member Author

butonic commented Dec 11, 2014

Thinking about moving this to https://github.com/owncloud/apps/tree/master/search

@butonic butonic self-assigned this Dec 15, 2014
@butonic
Copy link
Member Author

butonic commented Dec 15, 2014

Ok, instead of changing everything at once let us merge this. We can move the relevant code to the search app if it makes sense after we decided how to handle search/filter/find. I fear that discussion might take a while so I prefer to get app specific search ready asap. @PVince81 @schiesbn can I get another 👍 ?

@butonic butonic changed the title [WIP] introduce inApps[] filter for search via ajax query introduce inApps[] filter for search via ajax query Dec 15, 2014
$this->initProviders();
$results = array();
foreach($this->providers as $provider) {
/** @var $provider Provider */
$results = array_merge($results, $provider->search($query));
if ($provider->providesResultsFor($inApps)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a unit test that needs updating for this ?

@PVince81
Copy link
Contributor

I'm getting Class 'OC\Search\Provider' not found in /srv/www/htdocs/owncloud/apps3/calendar/lib/search/provider.php because I haven't checked out the branch yet.
At some point we might want to add a try/catch if a provider isn't available, at least we could still display results for the others. Ignoring for now.

@PVince81
Copy link
Contributor

Hmmm... this happened while having inApps[]=files in the URL. Which means that even though we only search in the files provider, we still load the other providers ?

@butonic
Copy link
Member Author

butonic commented Dec 15, 2014

The search providers are registered by the apps themselves. For backwards compatibility I only query selected providers when both a) the provider has been registered for a specific type and b) the query was for a specific type. Otherwise I fall back to querying all providers, in order to not loose results from old search providers.

@PVince81
Copy link
Contributor

Got it, makes sense 👍

butonic added a commit that referenced this pull request Dec 15, 2014
introduce inApps[] filter for search via ajax query
@butonic butonic merged commit 6602d3a into master Dec 15, 2014
@butonic butonic deleted the app_specific_search branch December 15, 2014 15:14
@lock lock bot locked as resolved and limited conversation to collaborators Aug 15, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants