albertlauncher / albert

A fast and flexible keyboard launcher
https://albertlauncher.github.io
Other
7.26k stars 305 forks source link

Global filter for file indexing #334

Closed qazip closed 7 years ago

qazip commented 7 years ago

Hello,

I'm aware of the issue #115 but it's a mess, with several issues in the same post, so I decided to open a new one. If you disagree, let's move the discussion there.

So, I'm aware that currently, in order to exclude for example *.mp3 files, one has to create an .albertignore file in every folder that has mp3 files.

My suggestion is the following:

idkCpp commented 7 years ago

You are right. The proper implementation of the exclude mechanism (with per-folder settings) is already being developed. We'll see if a more sophisticated version of the .albertignore files will come as well. But anyway thank you for bringing a little structure.

ManuelSchneid3r commented 7 years ago

Will come as an option in the files extension. Err basically you will have to write what you want to index. This way less poeple will index all that unnecessary stuff.

qazip commented 7 years ago

As long as wildcard is supported, I don't mind about the difference between having to include vs having to exclude.

ManuelSchneid3r commented 7 years ago

You will have to include globally by mimetype and exclude locally by filename. Both supporting wildcards. By default nothing is included, but you can still include "*". Do you think a global exclusion by filename is still necessary?

qazip commented 7 years ago

Well.. I don't think I will be using global exclusion by filename if one has to include the valid extensions to index.

However, if it's not too troublesome, I don't think there's much to lose by adding an exclusion rule?

I would also like to state that defaults are important. I'm not sure if people will enjoy having to include the files to index, the first time they run Albert. I would suggest the following extensions as a default (taken from dmenu-extended, with some changes):

"valid_extensions": [
    "py",
    "svg",
    "pdf",
    "txt",
    "png",
    "jpg",
    "gif",
    "php",
    "tex",
    "odf",
    "ods",
    "avi",
    "mpg",
    "mp3",
    "lyx",
    "bib",
    "iso",
    "ps",
    "zip",
    "xcf",
    "doc",
    "docxxls",
    "xlsx",
    "md",
    "html",
    "kdbx",
    "sublime-project"
qazip commented 7 years ago

How is this going?

ManuelSchneid3r commented 7 years ago

Do you have any idea for an implementation of the gitignore mechanism? The ** wildcard is nontrivial to implement.

idkCpp commented 7 years ago

Why don't we make this scriptable?

Lets say the we go from where we are: The current method is to specify which directories should be scanned and indexed. If the list of files is fully populated; pass it to a script that determines which entries should be kept. Then the processed list is brought back to albert for index-buildup.

With this ability one can write their own perl or python script that automatically throws out any unwanted entries with whatever algo the user has in mind.

And then there should be a noob-friendly method too, but I quite like the script idea...

ManuelSchneid3r commented 7 years ago

Why don't we make this scriptable?

Because the app is complex enough. ;D No really I dont want to unleash the feature creep. If the two most popular things (filters and excludes) work everything should be fine.

ManuelSchneid3r commented 7 years ago

Closed by 0.11

ManuelSchneid3r commented 7 years ago

https://albertlauncher.github.io/docs/extensions/files/#file-name-filters--ignore-files

2202a92f4fa13f342c670123fbca417677e3b538

LorenzoBettini commented 5 years ago

Sorry if I go back to this issue, I've just started using Albert, and from what I understand it's still not possible to put in .albertignore something like *.log to ignore such files in any subdirectory, is it? Or am I missing something?

philohistoria commented 4 years ago

@LorenzoBettini Did you find an answer? I had the same problem

idkCpp commented 4 years ago

Shouldn't the **.log wildcard match all subdirectories? Please refer to the link above.

An asterisk * in a pattern matches against all characters but the directory separator /. Two consecutive asterisks in a pattern match against all characters. More consecutive asterisks collapse to .

LorenzoBettini commented 4 years ago

It doesn't work... if log files are included as MIME then you're not able to exclude them, neither with **.log, nor with path /path/to/**.log.

As against the file filters the MIME filters are inclusive, files are only indexed if their MIME type match against one of the patterns. Unlike the file filters which reside in a file the MIME filters have global scope.

idkCpp commented 4 years ago

Ok @LorenzoBettini I did not read that. That's actually quite annoying.

@ManuelSchneid3r I vote for reopen.