helm-bibtex icon indicating copy to clipboard operation
helm-bibtex copied to clipboard

allow searching different fields interactively

Open plantarum opened this issue 8 years ago • 6 comments

As I understand it, helm-bibtex uses a fixed set of fields for every search, possibly extended by the value of helm-bibtex-additional-search-fields.

However, sometimes I want to search only a subset of fields: keywords but not titles, abstract only etc. Is it possible to provide multiple search options to the user? This is provided in bibtex-mode via C-c C-a, which prompts the user for which field the wish to search. This may be the only feature of bibtex-mode that is not replaced by a superior alternative in helm-bibtex.

Thanks,

Tyler

plantarum avatar Sep 16 '15 19:09 plantarum

Hi Tyler, I agree that this would be useful but it would require major changes in the code and would lead to considerably increased memory consumption because all fields would need to be stored in memory. Currently, only the fields in helm-bibtex-additional-search-fields plus some standard fields are stored. In order to implement this feature efficiently, I think we would need a proper index similar to that generated by the mail indexer mu. That's unfortunately far beyond what I can do in my spare time.

It would be slightly easier to restrict the search to a subset of the fields in helm-bibtex-additional-search-fields but this is still considerable work because it would require a parser for search expressions like year:1999 and we would not anymore be able to use helm's search engine.

tmalsburg avatar Sep 16 '15 19:09 tmalsburg

Is helm-bibtex-candidates regenerated for each search? If so, maybe we could provide a way to set different fields each time it is called. If it is not regenerated each search, it sounds like it will be very complicated to change, as you say.

Thanks,

Tyler

plantarum avatar Sep 16 '15 19:09 plantarum

Is helm-bibtex-candidates regenerated for each search?

Unfortunately it's not because that would be too slow for most bibliographies. The bibliography is parsed once and then cached in helm-bibtex-cached-candidates. The goal is to produce results almost instantly even with huge bibliographies like this one. I'll think about a solution for option 2 (search a subset of the restricted fields), but please don't expect a solution in the near future. If you want to work on it, I'm happy to give you directions.

tmalsburg avatar Sep 16 '15 19:09 tmalsburg

Ok, I see that now. I'm not familiar with helm sources, but I understand the constraints now.

I can continue to use bibtex-search-entries when I need to restrict my searches to a single field. Maybe I'll think of a way to jump from helm-bibtex to bibtex-search-entries and back. If I do, I'll try and code something up.

FYI, I have a few bibtex helper functions packaged up in bibtex-utils (on melpa and github). Nothing as complex as helm-bibtex though.

https://github.com/plantarum/bibtex-utils

plantarum avatar Sep 16 '15 20:09 plantarum

Thanks for the link to your package. It looks very useful.

tmalsburg avatar Sep 16 '15 20:09 tmalsburg

For what it's worth, Ebib does have search filters for particular fields, though it's not as convenient as helm-bibtex for quick searches.

Awhile ago I did look using an indexer, particularly one that could also search the text in PDFs or other files associated with the bibtex entry (I switched from Zotero a while ago and this is something I miss). I envisioned something like helm-recoll underneath helm-bibtex. It's not a big priority and I didn't have enough time to pursue it. But at least the idea is out there if anyone decides to try something. Helm-bibtex is already very useful. Thanks again Titus.

scottmartincampbell avatar Sep 16 '15 20:09 scottmartincampbell