-
Notifications
You must be signed in to change notification settings - Fork 64
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
Search within specific fields #131
Comments
Currently the search terms are used as a regex that is matched against the rendered vcard. But this proposal is very nice. It reminds me of https://github.com/notmuch/notmuch . On the technical side: We have an option |
@GSI I like your idea even more after I thought about it for some time. So here are my thoughts: We are currently keeping the order of search terms (so for From there it might be easier to implement searching in specific fields. I imagine that search terms that do not start with a known field name are treated as before. This means that One further question is how multible search terms for one field should be treated. So what does I am currently refactoring the basic class that represents a vcard in #169. I think that can help us to achieve the above points. You are welcome to have a look at it and leave your comments. |
Quick comment due to time constraints: Very reasonable thoughts! I'd "and" anything together. For "or" one may aways run two separate searches in sequence. |
I created #237 to add a category search. This does not cover all fields, but covers my own workflow and might be of use to others as well until a full revamp of the search feature is completed. |
I think for this, it would be better to output the vcards as json objects, and have the users who want this level of filtering use the program
|
@earboxer that idea is also nice especially for general integration in scripts. The But if we had the conversion to that dict it might be trivial to output json with I still belive that a custom search syntax might be nice and should be added independently from the json output. The main reason being that it will work with all khard subcommands and not just |
The search queries from the command line where formally converted to regex in order to search for contacts. Because no special regex features were used (all regex special chars from the command line were escaped) and in order to prepare for a custom query syntax (see #131) this implementation is replaced by nested lists of strings. Strings are matched against the contact with `in`. The different individual search terms from the command line are collected into a list which is then matched recursive with `all()`. If several different queries are used to load one address book (for example for a merge command) `any()` is used to load all possibly needed contacts.
I noticed that we can already script ourself a
|
I just merged a big branch into develop. You can search in specific fields with Missing: zsh completion and test by early users -> @GSI , @vleonbonnet I would be happy about feedback. (@vleonbonnet sorry for not merging you suggestion before but this is what I was aiming at and I did not want to go forth and back with the feature and the syntax to first have one option and then these queries for every field.) |
Time had me (or my machine) forget how to execute without installing. Was it
|
Okay at rev 4fad9fd using The rest fails to return a result for me:
Minor typo there - says |
It looks like it's
|
Currently the query syntax does not support nested field names like I updated the docs: https://khard.readthedocs.io/en/latest/commandline.html#filtering-contacts |
How are search terms currently considered - and Is there a way to filter by certain properties of contacts?
Something like
khard details category:2016 prefix:dr
would return any doctors in the 2016 category.The text was updated successfully, but these errors were encountered: