Bug 432004 - Baloosearch search syntax confusion
Summary: Baloosearch search syntax confusion
Status: RESOLVED NOT A BUG
Alias: None
Product: frameworks-baloo
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: 5.78.0
Platform: Neon Linux
: NOR normal
Target Milestone: ---
Assignee: Stefan Brüns
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-01-23 18:12 UTC by tagwerk19
Modified: 2021-01-24 09:24 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description tagwerk19 2021-01-23 18:12:35 UTC
SUMMARY:

    Baloosearch as a command line program seems to stumble on tags that
    contain spaces. For a file tagged with "Blue Tag"

        baloosearch 'tags:Blue Tag' 

    does not find it. In comparision:

        dolphin 'tags:Blue Tag'

    opens the "Blue Tag" tag folder and shows the file. 

STEPS TO REPRODUCE:

    Create a file, attach a tag "Blue Tag" and check with getfattr:

        getfattr -d File
        # file: File
        user.xdg.tags="Blue Tag" 

    Search for the file with baloosearch, looking for 'tags:Blue'
    and 'tags:Blue Tag'. Assume that baloosearch recognises when
    arguments are quoted: 

OBSERVED RESULTS

        baloosearch 'tags:Blue'

    returns hits but

        baloosearch 'tags:Blue Tag'

    does not

EXPECTED RESULTS

    Both searches should find the file

    Baloosearch ought to give the same results as the tags: folder
    syntax in Dolphin

SOFTWARE/OS VERSIONS

    Neon Testing

    Plasma : 5.20.90
    Frameworks : 5.79.0
    Qt : 5.15.2 

ADDITIONAL INFORMATION

    Seems to be failing as a result of unexpected argument parsing, a

        baloosearch 'tags:Blue Tag' 

    works the same as

        baloosearch tags:Blue Tag

    that is a search for "Tags:Blue AND Tag". Baloo is actually doing
    a search for "tags:Blue" and a content search for "Tag"

    A search:

        baloosearch tags:Blue_Tag 

    returns the expected result (but why? maybe another question...)
Comment 1 Stefan Brüns 2021-01-23 18:37:48 UTC
You have to use proper quotes on the command line:

$> baloosearch tag:\"Blue Tag\"

Although looking similar, "dolphin tags:..." and "baloosearch tags:..." are two completely different things, the first one is a URL of the tags kioslave, the second one is a query for the "tags" property.
Comment 2 tagwerk19 2021-01-24 09:17:59 UTC
(In reply to Stefan Brüns from comment #1)
> You have to use proper quotes on the command line:
> 
> $> baloosearch tag:\"Blue Tag\"

Ah! Thanks.

    baloosearch tags:\"Blue Tag\"
    baloosearch 'tags:"Blue Tag"'

work - and indeed typing

    tags:"Blue Tag"

works in Krunner (whereas tags:'Blue Tag' returns the same hits as tags:Blue Tag).

The questions are:

    How can anyone find this out? I've previously looked for
    search syntax documentation/specs but not really come up with anything.

    Is there any way that baloosearch can treat single and
    double quotes as equivalent? It seems a particularly obscure trap
    for young players.

> Although looking similar, "dolphin tags:..." and "baloosearch tags:..." are
> two completely different things, the first one is a URL of the tags
> kioslave, the second one is a query for the "tags" property.

My assumption is, right at the bottom of the stack, baloosearch and the tags slave are doing the same work (for this query). The trouble relates to "how to quote phrases" and "how the code handles escaped quotes". If I'm completely offbase here, apologies.
Comment 3 tagwerk19 2021-01-24 09:24:39 UTC
Having looked at Krunner...

    tags:"Blue Tag"

gives the expected hits, but 'locations' gives

    go to tags:%22Blue Tag%22

which does not work. This is, I think, a bug...