Bug 494584

Summary: Dolphin search for a quoted phrase gives no hits
Product: [Applications] dolphin Reporter: tagwerk19
Component: generalAssignee: Dolphin Bug Assignee <dolphin-bugs-null>
Status: CONFIRMED ---    
Severity: normal CC: ad.liu.jin, kfm-devel
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Neon   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description tagwerk19 2024-10-12 09:00:37 UTC
SUMMARY:
    If Baloo is disabled, a Dolphin search for a quoted phrase gives no hits

STEPS TO REPRODUCE:
1...
    Make sure Baloo is disabled or not indexing your test folder

2...
    Create a test file:

        $ echo "Hello Penguin" > letter-to-mary.txt

3...
    Open Dolphin search, choose a Content search and type, with the quotes,
    "Hello Penguin"

OBSERVED RESULT:   
    You don't get any results
    
    However if you search without the quotes you do get hits for exact matches.
    This is a bit messy as, with Baloo, you need quotes for an exact search, without
    Baloo you cannot use quotes

EXPECTED RESULT:
    You should get hits for exact matches

SOFTWARE/OS VERSIONS:

    Neon Unstable
    Dolphin: 24.11.70
    Plasma: 6.1.90
    Frameworks: 6.7.0
    Qt: 6.7.2

ADDITIONAL INFORMATION:
    This is specific as Dolphin's internal search. It has not yet been tested
    with the coming ripgrep (rg/rga) based search.
Comment 1 Jin Liu 2024-10-13 03:22:15 UTC
Can confirm. The search string is treated as a regular expression, so quote only matches the quote character.

The rg/rga will have the same behavior as the internal search.

I don't think we can make grammar in the internal search backend very close to Baloo. (unless we make them sharing the same query processor, i.e. make the internal backend a "Baloo running in unindexed mode".) So we need a decision on to what extent their grammars should match.

For reference, the file manager in both GNOME (Nautilus) and COSMIC (COSMIC Files) don't support quotes.
Comment 2 tagwerk19 2024-10-13 14:09:19 UTC
(In reply to Jin Liu from comment #1)
> Can confirm.
Thank you!

> ... The search string is treated as a regular expression, so quote
> only matches the quote character ...
I think a regex is beyond what people would expect. Would you ask people to type "Letter.*Mary" in order to find "letter-to-mary.txt"? Or explain why a search for "Mar*" found "Maggie"?

Of course there can/should be a flag to say "treat this is as a regex" for the Computer Science students ;-) but the normal expectation would be that you give a collection of terms (as you might in Google) and the back-end does it's best to satisfy your request. If you've quoted a phrase, then the search should be for that phrase.

> ... So we need a decision on to what extent their grammars should match ...
To start with, if you are putting work into the code, don't add to the divergence. Then, where possible, follow the principle of "fewest surprises". The behaviour with search terms and quotes is a very good example.

> ... For reference, the file manager in both GNOME (Nautilus) and COSMIC (COSMIC Files) don't support quotes ...
I know this was an aside at the bottom of the post - but the fact that we don't it because Gnome doesn't do it is a dodgy argument 8-)