browser.bookmarks.search fails to support quoted search tokens
Categories
(WebExtensions :: Compatibility, defect, P2)
Tracking
(firefox72 fixed)
Tracking | Status | |
---|---|---|
firefox72 | --- | fixed |
People
(Reporter: jimm, Assigned: mixedpuppy)
Details
(Keywords: dev-doc-complete)
Attachments
(1 file)
According to MDN, you should be able to do quoted keyword searches using browser.bookmarks.search. In practice though this doesn't appear to be implemented.
From MDN: "If query is a string, it consists of zero or more search terms. Search terms are space-delimited and may be enclosed in quotes to allow multiple-word phrases to be searched against. Each search term matches if it matches any substring in the bookmark's URL or title. Matching is case-insensitive. For a bookmark to match the query, all the query's search terms must match."
For example, say you have a bookmark with the text "Hello Dolly". The search:
browser.bookmarks.search("Hello Dolly")
succeeds due to Hello and Dolly matching independently. However if you try "'Hello Dolly'" or " 'Hello Dolly' " or "'Hello Dolly' 'Hello Dolly'" the search fails. This doesn't sync with the MDN docs.
https://searchfox.org/mozilla-central/source/toolkit/components/places/SQLFunctions.cpp#488
https://searchfox.org/mozilla-central/source/xpcom/ds/nsWhitespaceTokenizer.h#94
Assignee | ||
Comment 1•5 years ago
|
||
The doc page at https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/bookmarks/search
needs to be updated, we don't support quoted strings as described (or at all really).
Assignee | ||
Updated•5 years ago
|
Comment 2•5 years ago
|
||
The documentation also describes the query as a "string or object ", could you define the quote enclosed string in an object? However, I also note that the subsequent documentation only refers to the query as a string, is there a quick way to confirm what types the function takes or should I test?
Assignee | ||
Comment 3•5 years ago
|
||
You can always refer to the schema which will typically contain those details.
Assignee | ||
Updated•5 years ago
|
Comment 4•5 years ago
|
||
And the schema is definitive? So, it would appear that we missing documentation of the object that can be used to define the search terms.
Assignee | ||
Comment 5•5 years ago
|
||
(In reply to Richard Bloor from comment #2)
could you define the quote enclosed string in an object?
No. Our underlying search code doesn't support this (per comment 0).
(In reply to Richard Bloor from comment #4)
And the schema is definitive? So, it would appear that we missing documentation of the object that can be used to define the search terms.
The object that can be passed is documented in the params section of the function. The param can either be a string or an object as documented here:
I see that the schema says we can use quoted strings, which is also wrong, I should fix that (in this bug).
Assignee | ||
Comment 6•5 years ago
|
||
Assignee | ||
Updated•5 years ago
|
Pushed by scaraveo@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/8c5e8ea700d9 remove documentation about quoted phrases in bookmark search r=rpl
Comment 8•5 years ago
|
||
bugherder |
Comment 9•5 years ago
|
||
Hello,
Will this fix require manual validation? If yes, please provide some steps to reproduce in order to correctly test it and also, please set the "qe-verify+" flag. Otherwise, could the "qe-verify-" flag be added? Thanks!
Comment 10•5 years ago
|
||
Somewhat unclear as to what information I am expected to provide re-comment 4. However, I believe I have the information needed to make the necessary documentation changes.
Comment 11•5 years ago
|
||
https://wiki.developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/bookmarks/searchIs now updated with the reference to quote delineated search terms removed. Please let me know if there are any further changes needed or whether I can mark as dev-doc-done.
Assignee | ||
Comment 12•5 years ago
|
||
Thanks for the doc update, looks good.
Updated•5 years ago
|
Description
•