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

feature request: add filter #10156

Open
ghost opened this issue Aug 10, 2023 · 15 comments
Open

feature request: add filter #10156

ghost opened this issue Aug 10, 2023 · 15 comments

Comments

@ghost
Copy link

ghost commented Aug 10, 2023

Hi

I would like to request the following filters for JabRef:

  • author filter
  • year filter
  • tag filter: each entry can be assigned a tag on which you can apply a filter

You can see this feature in the Mendeley Reference Manager:

https://www.youtube.com/watch?v=OzFHGFnAM2Q&t=527s

@ghost
Copy link
Author

ghost commented Aug 10, 2023

Maybe the filter can be configured so you can choose what fields are filtered.

@Siedlerchr
Copy link
Member

HI, this is already possible with groups. Basically, you can use groups for this.
You can create a group for filtering by keyword for free search expression.

https://docs.jabref.org/finding-sorting-and-cleaning-entries/groups#types-of-groups

@ThiloteE Can probably say more about this

@ghost
Copy link
Author

ghost commented Aug 10, 2023

But the goal of this feature is to have a list of all authors, years, ... from which the user can choose to quickly filter the database without having to create a group. See the youtube video.

I'm also interested in an example of the free search expression (for example to filter on author) because I don't understand it by reading the documentation.

@ThiloteE
Copy link
Member

ThiloteE commented Aug 10, 2023

Mendeley filters refer to what other programms often would call "tags", "labels" or "keywords".
Also relevant related issues: #8739 and #9203.

Yes, it would be nice to have a better representation of tags, filters, labels or keywords in the JabRef UI. Though, most (not all) of what those offer can already be reproduced with existing features of JabRef. The things that cannot be done are mostly just UI things. Meaning, keywords are not displayed in the maintable or somewhere where users can easily click on them to trigger a selected view of certain entries, apart from using the groups feature.

What we have:

  1. Groups with searching for keyword
  2. Groups with free search expression
  3. Groups with specified keywords
  4. A "Keywords" field in the "general" tab of the entry editor / or any other custom field, if you like! --> show the "keywords" field in the main table via options / file > preferences > entry table. Unfortunately, it is currently not possible to click on those words to selectively show only entries with these words (e.g. like github's labels). Not sure, if Javafx offers something like this.
  5. "Search" for (key-) words (and fields, field content, citekeys and entrytypes) within or across groups or within your whole database (within the "all entries" group) using the search bar. In the most incidents the normal search is enough, but if not, then you can always go the advanced route and come up with a regular expression.

Now, if you feel like you want to "save" your search (which would be again something like a label, tag, filter or keyword, then you basically have two choices: A) create a group or B) write the "keyword" directly into one of the fields in your library, which then can be found by the search or groups feature.

Storing your data directly in the library is a great way to ensure colleagues will have access to your keyword once you decide to share your library. There is no further need to also share JabRef settings. I suspect, if JabRef were to implement something like a unique keywords feature, then the easiest approach would be to just come up with a custom field called "labels" or something and then to make this field more prominent and accessible in the UI. There already is the keywords field, but those are usually filled with official data inherent to your entries (e.g. fetched from DOI or ISBN), whereas your own unique labels should probably be put into another (custom) field.

Just a short reminder about JabRef's library syntax (which follows bibtex/biblatex), which you can see in the "bibtex source tab", so when I say "field", I mean part of the following:

@Entrytype{citekey,
field = {field content},
}

@ThiloteE
Copy link
Member

ThiloteE commented Aug 10, 2023

While i think the author filter or tag filter are covered by what I wrote above, this is not the case for date ranges.
Enhancing the search or groups feature (or both) with the possibility to search for a range of the "year" or "date" would indeed be nice! E.g. find all entries with data between 2000 and 2012.

I guess it's possible with java. See here:

While it's technically possible to come up with some regex, this seems to be highly inefficient and likely comes with very mediocre performance as this source claims: https://stackoverflow.com/questions/6839987/regular-expression-for-a-date-range

@ghost
Copy link
Author

ghost commented Aug 11, 2023

I think there should be a "tag" field for each entry, just as in Mendeley.
And this tag should be possible to be filtered, completely independent from the groups with a filter button as in Mendeley.

  • The reason for this is that this tag filter is not permanent and should not be stored as a group or anywhere in the bibtex file: the user wants to see all entries with a certain tag but does not want to store this filter.

  • the filter should also show all possible values in all other fields that already exist and make sense to be filtered (all fields except the "tag" field):

  1. for year: all years in the database
  2. for author: all different authors (separated by "," or AND) in the author field.
  3. ...

So this is also not possible with the groups. You must inspect the database yourself to know what values to enter to search for.
If the filters show list of possible values, this is much more user friendly. You can quickly filter the database and remove the filter again.

  • And finally you should be able to combine filters. The first filter is applied first, then the second is applied on the remaining filtered database, ...

So the goals of these filters:

  1. So the tag filter should be possible to apply immediately by filtering on the tag field.
  2. There should also be filters available for certain fields that make sense (year, author, ...) by choosing list of possible values that are automatically extracted by JabRef from the current database,
  3. Filters are not stored in the bibtex file, so they are gone when JabRef is closed.
  4. Combining filters: applied the one after the other

This was my idea for a filter. Quick fast filtering by choosing values from a list that is presented to you by JabRef, either the "tag" field or another existing field that makes sense (year, author, ...). No storage of the filters. So this is total different concept then groups, which provide stored filters you create manually by adding filter values yourself

Is there interest to make this?

@ThiloteE
Copy link
Member

ThiloteE commented Aug 11, 2023

Since I do not want to write out "tags / filters / keywords / labels", I will simply use the word "keywords" for now.

I think what you want is slightly at odds with each other. At one point you want tags not permanent, but then later you want them permanent.

What JabRef has:

Not permanent:

  • all your needs are covered by using "search"!

Permanent:

A) Data is stored in your library:

  • JabRef stores data in your library (the .bib file). This includes keywords.
    image
  • being part of a group is stored in your entry.
    image
  • The entry table / main table shows you all the possible values and you can sort and scroll through this table to find specific keywords.
    image
  • JabRef searches through your library and finds "keywords", which are stored in your library. Note, these keywords are not limited to what is stored in the keyword field, but can be any field or field content, including authors or year. JabRef will store the search in a separate place in your library file (when you open the file with a text editor, the location can be found via @Comment{jabref-meta: grouping:. These tags are then shown separately in a different place in JabRef's UI
    • this is basically "groups with specified keywords" and all other groups related features.

B) Data is NOT stored in your library, but somewhere else on your computer / remotely.

  • JabRef searches through your library, comes up with tags, which are really not stored in your library, but still shown separately in a different place in the UI
    • I think "Manage keywords" from edit > manage keywords fulfills these criteria. The search itself is not permanently stored in your library files, but the keywords it finds ARE. It is basically a temporary search.
      image
      What is lacking here:
      • also show field content from other fields in "Manage keywords", other than from the keywords field.
      • allow to select a keyword, then show all entries with this keyword.

Have you actually tried those features, I have pointed you towards?
The next big thing on the agenda for JabRef 6.0 is a rework of JabRef's search engine, so it might take a while until core developers have a look at this feature request, especially since it is possible to work around most of the issues you describe with groups and search. If anybody is willing to work on keywords, sure, go ahead :-) 👍

@ghost
Copy link
Author

ghost commented Aug 11, 2023

Yes I understand but currently it's not really user friendly to work with keywords :)
It takes a lot of time before you understand what is where and how it works.

As I understand correctly the keywords field below is the only one that can be filtered?
We can currently not assign a user tag we choose ourselves in a separate field? (see video of Mendeley)

afbeelding

@ThiloteE
Copy link
Member

ThiloteE commented Aug 11, 2023

yes, unfortunately only the "keywords" field can be filtered using the "Manage keywords" feature.

We can currently not assign a user tag we choose ourselves in a separate field?

You can, if you use the groups feature. Any field can be "filtered", if you use search or the groups feature.

e.g. by creating your own custom field "tags" and creating a group using following regex: field = .+
image

. means: any character
+ means: one or more times

@ghost
Copy link
Author

ghost commented Aug 13, 2023

e.g. by creating your own custom field "tags" and creating a group using following regex: field = .+ image

. means: any character + means: one or more times

Where is the correct window to make custom fields?

What is the difference between .+ and .* because they both seem to work.

@ThiloteE
Copy link
Member

ThiloteE commented Aug 13, 2023

@ThiloteE
Copy link
Member

ThiloteE commented Aug 13, 2023

You can declare custom fields via the entry types menu.

in JabRef 5.9 go to options > custom entry types.
in JabRef 5.10 development version go to File > preferences > entry types.

You also can just open the entry editor, go to the biblatex source tab and type them in.
For example:

image

@Siedlerchr
Copy link
Member

The regex quantifier: .+ means: 1 or more, .* zero or more

@ThiloteE
Copy link
Member

Ah, you are right. My bad.

@ghost
Copy link
Author

ghost commented Aug 13, 2023

The regex quantifier: .+ means: 1 or more, .* zero or more

Thanks! So there is no way to write an empty string like (where empty is something that works in jabref)?
tag = empty

We must use the . and use !=?

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

No branches or pull requests

2 participants