linkding icon indicating copy to clipboard operation
linkding copied to clipboard

Boolean Search

Open Gatada opened this issue 3 years ago • 3 comments

I just discovered Linkding, and haven't really used it yet - so maybe I just missed the feature - but seems like Linkding doesn't support it yet:

A search engine is so much more powerful when it allows me to hone my search using boolean logic. A side effect of having boolean search is usually a smaller and more manageable tag collection.

I would like to see:

  1. AND - I think this is default (current) behaviour?
  2. OR - one or the other: #utility OR #accessory
  3. NOT - for excluding tags: #utility NOT #iOS
  4. () - for grouping tags: (#utility OR #accessory) AND #macOS

This way I can find:

  • #utility NOT #service
  • (#utility OR #service) NOT #online

If this is not already supported, I hope to find time to add this.

Gatada avatar Mar 15 '21 23:03 Gatada

No, this is not supported ATM. Currently all search terms (words and tags) are combined using AND.

I understand your use-case, and if I would want to support complex queries then I would go for a textual query language instead of a visual query builder. But I can see this easily getting out of hand in terms of effort and complexity (which I have to maintain). Just some things from the top of my head:

  • Would need to write a custom parser for the query syntax
  • Syntax would still need to support entering multiple terms without operators as it does now, which introduces several edge-cases
  • Would need to handle syntax errors when parsing and communicate them to the user in a reasonable way (preferrably not just Unexpected token: abc)
  • Query syntax needs to be documented so that it is actually discoverable by the user
  • Complete reimplementation of the SQL query building logic
  • Needs an extensive test suite
  • Would need to make sure the search auto-complete still works correctly

If someone can provide that and verify that it works with a sufficient test suite then I would consider it.

sissbruecker avatar Mar 20 '21 12:03 sissbruecker

This is a great suggestion, although I fully respect the complexity and sustainability of such a feature.

That said, I'd like to also a request for some smart logic such as:

site:github.com tag:dev issue linkding

darylf avatar Dec 13 '21 17:12 darylf

Possible search syntax (and implementation) https://github.com/mchaput/whoosh (also implementats FTS, but query parser can be extracted.

Other option could be Haystacks for Django?

clach04 avatar May 15 '22 06:05 clach04