Places query syntax

Discussion about official Mozilla Firefox builds
Locked
bomfog
Posts: 455
Joined: November 7th, 2002, 3:22 pm
Location: the palouse, SE. WA, USA

Re: Places query syntax

Post by bomfog »

frandavid100 wrote:I would like it to search *only* tags

That would be Bug 399799 – add query options for tags, incidentally.
bomfog
Posts: 455
Joined: November 7th, 2002, 3:22 pm
Location: the palouse, SE. WA, USA

Post by bomfog »

More grist for the mill, maybe: doxygen-generated Places documentation.
Oropher
Posts: 346
Joined: September 26th, 2007, 7:12 pm

Post by Oropher »

<a href="https://bugzilla.mozilla.org/show_bug.cgi?id=385245">Bug 385245</a> seems to have shaken up some of these queries - in particular, grouping apparently no longer works. The source <a href="http://mxr.mozilla.org/firefox/source/toolkit/components/places/public/nsINavHistoryService.idl">here</a> has been updated; I'll try to go through it sometime today and find what's changed.

Edit: first impression - 'sort by count' has gone. Apparently it was for sorting folders by the number of results they contained.
Oropher
Posts: 346
Joined: September 26th, 2007, 7:12 pm

Post by Oropher »

Grouping's gone, replaced by 'type=':
type=0 - "URI" results, one for each URI visited in the range.
type=1 - "Visit" results, with one for each time a page was visited (may give multiple results for one URI).
type=2 - "FullVisit" results (like "Visit", but returns all attributes for each result).
type=3 - "DateQuery" results (equivalent to 'group by date').
type=4 - "SiteQuery" results, returns last visit for each url in the given host. (May require 'domain' to be set. Equivalent to 'group by site')
type=5 - "DateSiteQuery" results (equivalent to 'group by date and site').
type=6 - "TagQuery" results (equivalent to 'group by tag').

I'm not sure yet, but it looks like these queries may only work without 'folder' and 'type' being set. And we seem to have lost the ability to sort results by folder.
brablc
Posts: 19
Joined: November 7th, 2003, 3:24 am
Contact:

Post by brablc »

I'm author of the patch for <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=385245">bug 385245</a>. So if there are questions and complains I can answer them.

Generally it would be nice, if extension authors and power users would contribute to the unit test. So that we can find early when we break something and can discuss this with someone.

Just explanation to the rather radical change - previous grouping was too slow, it was reading a lot of bookmarks into memory and sorting them later. Now we build only set of queries which get executed only when you click on them. Displaying big history sorted by date now takes less than second, while it could have taken minutes before.

You can read/discuss more on related bug: <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=359332">bug 359332</a>.
Oropher
Posts: 346
Joined: September 26th, 2007, 7:12 pm

Post by Oropher »

Hi Ondrej, thanks for dropping by! I hadn't been following bug 385245 properly, so I didn't realise until too late, that the change was going to break a couple of my use-cases. I understand that grouping as it was had to go, and if there's no fix for my problem I'll accept it as a trade-off for the speed increase.

Anyway, these are the use-cases I'm having problems with:
  1. I have a lot of bookmarks tagged 'css'. They're sorted into folders, eg 'Typgraphy', 'Layout', 'Tables'. Each of those folders also contains lots of bookmarks that aren't CSS-related. By searching 'folder=2&group=3&terms=css' I got my CSS-related bookmarks sorted into folders by sub-category.
  2. I have many bookmarks tagged 'terminal'. These relate to command-line stuff across Win/Mac/*nix. Each one also has tags like 'winxp', 'mac', 'linux', 'software', 'docs' and a few more. There are too many overlapping tags here to sort these bookmarks into folders like in Use Case 1, so I used 'folder=4&group=3&terms=terminal' to get the results grouped according to tag.

Since 385245 landed, I've had a quick look through nsINavHistoryService.idl, but I couldn't see a way to fulfill these use-cases with a single query. Since there aren't AND and NOT operators available, I can't do it with a series of queries, either.

My use-cases don't look like they fit under bug 359332 - would you like me to file a new bug?

- Matthew
bomfog
Posts: 455
Joined: November 7th, 2002, 3:22 pm
Location: the palouse, SE. WA, USA

Re: Places query syntax

Post by bomfog »

Max Karl Ernst wrote:Recent Tags

Code: Select all

place:folder=4&group=3&queryType=1&applyOptionsToContainers=1&sort=12&maxResults=10

This gets you recently added tags. For recently *used* tags, change to "sort=14" (by modification time).

Other queries may need the same tweak. See <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=419866#c7" title="Recent Tags list in smart bookmarks no longer seems to be working">bug #419866, comment #7</a>.
brablc
Posts: 19
Joined: November 7th, 2003, 3:24 am
Contact:

Re: Places query syntax

Post by brablc »

bomfog wrote:
Max Karl Ernst wrote:Recent Tags

Code: Select all

place:folder=4&group=3&queryType=1&applyOptionsToContainers=1&sort=12&maxResults=10

This gets you recently added tags. For recently *used* tags, change to "sort=14" (by modification time).

Other queries may need the same tweak. See <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=419866#c7" title="Recent Tags list in smart bookmarks no longer seems to be working">bug #419866, comment #7</a>.


Not sure if I follow this properly, but as of the trunk, the right queries are:

Recently Used Tags: place:type=6&sort=14&maxResults=10
Recently Added Tags: place:type=6&sort=12&maxResults=10

Group and applyOptionsToContainers have gone.
User avatar
Sephirot
Posts: 247
Joined: June 15th, 2004, 7:56 am

Post by Sephirot »

Oropher wrote:Grouping's gone, replaced by 'type=':
type=0 - "URI" results, one for each URI visited in the range.
type=1 - "Visit" results, with one for each time a page was visited (may give multiple results for one URI).
type=2 - "FullVisit" results (like "Visit", but returns all attributes for each result).
type=3 - "DateQuery" results (equivalent to 'group by date').
type=4 - "SiteQuery" results, returns last visit for each url in the given host. (May require 'domain' to be set. Equivalent to 'group by site')
type=5 - "DateSiteQuery" results (equivalent to 'group by date and site').
type=6 - "TagQuery" results (equivalent to 'group by tag').

I'm not sure yet, but it looks like these queries may only work without 'folder' and 'type' being set. And we seem to have lost the ability to sort results by folder.

Hey thanks. :) DateQuery and DateSiteQuery helped me out, but I'd still like to see a "DateHostSiteQuery" (1st date, 2nd host, 3rd site; e.g. today > mozillazine.org > forums.mozillazine.org).
Ondrej, is it possible to add this query type?


best,
Ronny
Author of Bookmarks Menu Button, Autoclose Bookmark&History Folders and more

Mozilla/5.0 (Windows; U; Windows NT 6.1; de; rv:1.9.2.19pre) Gecko/20110701 Firefox/3.6.19pre <-- build with MS VC++ 2010 SP1 and PGO on Win 7 x64
Oropher
Posts: 346
Joined: September 26th, 2007, 7:12 pm

Post by Oropher »

Sephirot wrote:DateQuery and DateSiteQuery helped me out, but I'd still like to see a "DateHostSiteQuery" (1st date, 2nd host, 3rd site; e.g. today > mozillazine.org > forums.mozillazine.org).
Ondrej, is it possible to add this query type?

best,
Ronny

Looks like you're describing bug 359322.

- Matthew
brablc
Posts: 19
Joined: November 7th, 2003, 3:24 am
Contact:

Post by brablc »

Oropher wrote:Since 385245 landed, I've had a quick look through nsINavHistoryService.idl, but I couldn't see a way to fulfill these use-cases with a single query. Since there aren't AND and NOT operators available, I can't do it with a series of queries, either.

My use-cases don't look like they fit under bug 359332 - would you like me to file a new bug?

- Matthew


This was really nice use of the old API. There is really no way how to simulate the behavior now without any scripting. I can imagine, that we would include a new result type - RESULTS_AS_FOLDER_QUERY. Which could together with bug 359332 fulfill your needs.
brablc
Posts: 19
Joined: November 7th, 2003, 3:24 am
Contact:

Post by brablc »

Sephirot wrote:Hey thanks. :) DateQuery and DateSiteQuery helped me out, but I'd still like to see a "DateHostSiteQuery" (1st date, 2nd host, 3rd site; e.g. today > mozillazine.org > forums.mozillazine.org).
Ondrej, is it possible to add this query type?

best,
Ronny


This should be easy to implement and fast to execute. Please file a bug and try to get votes for it.
Oropher
Posts: 346
Joined: September 26th, 2007, 7:12 pm

Post by Oropher »

brablc wrote:
Oropher wrote:Since 385245 landed, I've had a quick look through nsINavHistoryService.idl, but I couldn't see a way to fulfill these use-cases with a single query. Since there aren't AND and NOT operators available, I can't do it with a series of queries, either.

My use-cases don't look like they fit under bug 359332 - would you like me to file a new bug?

- Matthew


This was really nice use of the old API. There is really no way how to simulate the behavior now without any scripting. I can imagine, that we would include a new result type - RESULTS_AS_FOLDER_QUERY. Which could together with bug 359332 fulfill your needs.

Sounds great. I'll file a bug for that later today and post back with the number.
User avatar
Max Karl Ernst
Posts: 107
Joined: February 5th, 2008, 3:43 am

Post by Max Karl Ernst »

Wow, those were some major changes I wasn't expecting to see in this stage. :)

There might be a handful of queries I might need to fix in my bookmarks too, thanks Oropher for hunting down changes, and thanks Brablc for explanation.

Brablc posted new default Smart Bookmarks for recent tags, is there anyone that can post the rest if they were changed. I would look at them myself, but I can't seem to be able to recreate Smart Bookmarks in the latest build (Gecko/2008022806) even by deleting profile :)
brablc
Posts: 19
Joined: November 7th, 2003, 3:24 am
Contact:

Post by brablc »

Max Karl Ernst wrote:Wow, those were some major changes I wasn't expecting to see in this stage. :)

There might be a handful of queries I might need to fix in my bookmarks too, thanks Oropher for hunting down changes, and thanks Brablc for explanation.

Brablc posted new default Smart Bookmarks for recent tags, is there anyone that can post the rest if they were changed. I would look at them myself, but I can't seem to be able to recreate Smart Bookmarks in the latest build (Gecko/2008022806) even by deleting profile :)


It should be enough to change your prefs.js to: user_pref("browser.places.createdSmartBookmarks", false);

There were no other changes in Smart Bookmarks area. All grouping queries used in history sidebar have been changed.
Locked