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

Predefined search functionality for Everything plugin #94

Closed
psistorm opened this issue Jul 13, 2016 · 4 comments
Closed

Predefined search functionality for Everything plugin #94

psistorm opened this issue Jul 13, 2016 · 4 comments

Comments

@psistorm
Copy link

psistorm commented Jul 13, 2016

I have added some functionality to the Everything plugin which allows the user to define some searches like in WebSearch plugin linked to a specific keyword. This means I can define a search like this:

[search/doc]
pattern = *.doc|*.docx %s
description = Search for Word documents

It will now add a new catalog item with the title Everything: doc and description Search for Word documents which will if selected search for any word document with name like the user input.

Furthermore I added a flag empty_search which will allow to do an instant search after selecting the catalog item to list all documents matching the basic pattern (here *.doc|*.docx) and it will filter out items as soon as the user starts to type. I use this quite regulary to list all available projects of a specific type and to see what is available.

Please see the attached patch file everything.patch.txt

@polyvertex
Copy link
Member

Thank you for your contribution! It sounds like a nice feature to have.

At first glance, code seems pretty neat and blends very well with the existent. Kudos for that. I'll review it in detail and may have some tiny modifications to do (or not) if you don't mind but right now I see no cons on integrating it without altering the main idea.

In the meantime and as discussed previously in the chat, I will credit you in the Contributions section if I happen to integrate your modifications to the official package. If you feel like you want to step back on this, do not hesitate to shout it here.

Thanks again for sharing!

@psistorm
Copy link
Author

psistorm commented Jul 13, 2016

Thank you and you're welcome. I'm still totally fine with what we talked about.

I just found out a small but maybe essential part may be missing for the functionality and just added a flag for enabling regex for the searches with enable_regex flag. So e.g. a pattern like ^.*%s.*\\\.git$$ would list all git repositories available with regex enabled.

Here is the full patch once again: everything_with_regex.patch.txt

If you'd rather have this addon as a separate patch instead of a full patch just let me know.

@polyvertex
Copy link
Member

polyvertex commented Aug 11, 2016

I've integrated your patch and it will be available in the next release.

For the record, I was about to just leave it almost untouched (minor corrections) when I realized it was not blending perfectly due to the default Search and Regex Search items. So I added some default_search that are conceptually equivalent to predefined_site in the WebSearch package to blend in the Search and Regex Search originally available as hard-coded searches.
I took the liberty of doing some renaming as well.

@polyvertex
Copy link
Member

Integrated in 2.9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

2 participants