Places query syntax
-
- Posts: 346
- Joined: September 26th, 2007, 7:12 pm
I filed Bug 420282 - After bug 385245, need RESULTS_AS_FOLDER_QUERY result type.
Max, as far as I can tell, these are the (currently!) correct queries for the Smart Bookmarks folder:
Most Visited - place:queryType=0&sort=8&maxResults=10
Recently Bookmarked - place:folder=2&folder=5&folder=3&queryType=1&sort=12&excludeItemIfParentHasAnnotation=livemark%2FfeedURI&maxResults=10&excludeQueries=1
Recent Tags (actually recently used tags) - place:type=6&sort=12&maxResults=10
Oh, and to regenerate your Smart Bookmarks folder, rename or delete the old one, go to about:config and set browser.places.createdSmartBookmarks to false, then restart. Easy
- Matthew
Max, as far as I can tell, these are the (currently!) correct queries for the Smart Bookmarks folder:
Most Visited - place:queryType=0&sort=8&maxResults=10
Recently Bookmarked - place:folder=2&folder=5&folder=3&queryType=1&sort=12&excludeItemIfParentHasAnnotation=livemark%2FfeedURI&maxResults=10&excludeQueries=1
Recent Tags (actually recently used tags) - place:type=6&sort=12&maxResults=10
Oh, and to regenerate your Smart Bookmarks folder, rename or delete the old one, go to about:config and set browser.places.createdSmartBookmarks to false, then restart. Easy
- Matthew
Last edited by Oropher on March 11th, 2008, 11:38 am, edited 1 time in total.
- Max Karl Ernst
- Posts: 107
- Joined: February 5th, 2008, 3:43 am
Thanks both Brablc and Matthew
As for my problem with smart bookmark folder, I should've stated more clearly that no setting in about:config, nor deleting places, bookmarks or even whole profile regenerates Smart Bookmarks in my latest nightly
Doesn't really matter, as your query info made latest changes obvious.
As for my problem with smart bookmark folder, I should've stated more clearly that no setting in about:config, nor deleting places, bookmarks or even whole profile regenerates Smart Bookmarks in my latest nightly
Doesn't really matter, as your query info made latest changes obvious.
- Laeb
- Posts: 90
- Joined: September 21st, 2003, 11:21 pm
- Location: Montréal, CAN
How to build a query to find a bookmarks folder
Does anyone has an example of a query to find a bookmarks folder by its name anywhere in Places ?
I tried this but it did not work:
var historyService = Components.classes["@mozilla.org/browser/nav-history-service;1"]
.getService(Components.interfaces.nsINavHistoryService);
var bookmarksService = Components.classes["@mozilla.org/browser/nav-bookmarks-service;1"]
.getService(Components.interfaces.nsINavBookmarksService);
var placesRoot = bookmarksService.placesRoot;
var options = historyService.getNewQueryOptions();
var query = historyService.getNewQuery();
query.setFolders([placesRoot ], 1);
query.searchTerms = "myFolderName";
var result = historyService.executeQuery(query, options);
I tried this but it did not work:
var historyService = Components.classes["@mozilla.org/browser/nav-history-service;1"]
.getService(Components.interfaces.nsINavHistoryService);
var bookmarksService = Components.classes["@mozilla.org/browser/nav-bookmarks-service;1"]
.getService(Components.interfaces.nsINavBookmarksService);
var placesRoot = bookmarksService.placesRoot;
var options = historyService.getNewQueryOptions();
var query = historyService.getNewQuery();
query.setFolders([placesRoot ], 1);
query.searchTerms = "myFolderName";
var result = historyService.executeQuery(query, options);
-
- Posts: 346
- Joined: September 26th, 2007, 7:12 pm
Laeb, we've mostly been discussing the 'place:' URIs in this thread. Although I'm starting to take a look at the underlying query system for Bug 420282, I'm not really at the stage to be able to help you. Perhaps someone else can, though?
On second thoughts - if I was building a 'place:' URI to find a bookmark folder, I'd try setting 'excludeItems=1'.
On second thoughts - if I was building a 'place:' URI to find a bookmark folder, I'd try setting 'excludeItems=1'.
- Sephirot
- Posts: 247
- Joined: June 15th, 2004, 7:56 am
brablc wrote: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.
done - https://bugzilla.mozilla.org/show_bug.cgi?id=421953
Would be nice if you drop a message there or even providng a patch.
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
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
-
- Posts: 1407
- Joined: April 25th, 2003, 11:02 pm
Re: How to build a query to find a bookmarks folder
Laeb wrote:Does anyone has an example of a query to find a bookmarks folder by its name anywhere in Places ?
I tried this but it did not work:
Seems like it should work, but I haven't played with any of that stuff for awhile. I assume you've looked at the result to see what it was. What exactly is it returning to you?
-
- Posts: 24
- Joined: December 7th, 2004, 11:56 pm
Does anyone know if the final release will have a user-friendly way to construct complex queries? In Beta 4 the search "rules" are very limited.
I'm also curious why the places query syntax needs to be reverse engineered like this? Don't the programmers who wrote the places code know exactly what the query syntax is?
I'm also curious why the places query syntax needs to be reverse engineered like this? Don't the programmers who wrote the places code know exactly what the query syntax is?
- Max Karl Ernst
- Posts: 107
- Joined: February 5th, 2008, 3:43 am
Yes they know, but places are still under heavy construction and major changes are possible (and happening) so they don't need more nagging users
Plans probably don't include any expansion of functionality at this stage, in fact some bugs call for hiding place: uris altogether
Anyway, just for the record, few other default queries
History menu:
Bookmarks menu:
Plans probably don't include any expansion of functionality at this stage, in fact some bugs call for hiding place: uris altogether
Anyway, just for the record, few other default queries
History menu:
Code: Select all
place:type=0&sort=4&maxResults=10
Bookmarks menu:
Code: Select all
place:folder=BOOKMARKS_MENU&excludeItems=1&queryType=1
Last edited by Max Karl Ernst on April 21st, 2008, 9:22 am, edited 3 times in total.
-
- Posts: 11
- Joined: September 21st, 2005, 5:32 am
Oropher wrote:I filed Bug 420282 - After bug 385245, need RESULTS_AS_FOLDER_QUERY result type.
Max, as far as I can tell, these are the (currently!) correct queries for the Smart Bookmarks folder:
Most Visited - place:queryType=0&sort=8&maxResults=10
Recently Bookmarked - place:folder=2&folder=5&folder=3&queryType=1&sort=12&excludeItemIfParentHasAnnotation=livemark%2FfeedURI&maxResults=10&excludeQueries=1
Recent Tags (actually recently used tags) - place:type=6&sort=12&maxResults=10
Oh, and to regenerate your Smart Bookmarks folder, rename or delete the old one, go to about:config and set browser.places.createdSmartBookmarks to false, then restart. Easy
- Matthew
I accidentally deleted the Smart Bookmarks. I recreated them using some other URL's posted for FF3b2, but as those were static (they were not update at all), I deleted them and I set the entry browser.places.createdSmartBookmarks to false. However, no Smart Bookmarks appears . (I have other bookmarks in my Bookmarks Toolbar folder) Do you know a solution? I run FF3b4.
(I can also wait for the next version if that will solve the problem)
-
- Posts: 33
- Joined: August 27th, 2005, 3:24 am
If you have a non relative profile location it's probably bug 381365.
- Max Karl Ernst
- Posts: 107
- Joined: February 5th, 2008, 3:43 am
ernstblaauw wrote:I accidentally deleted the Smart Bookmarks. I recreated them using some other URL's posted for FF3b2, but as those were static (they were not update at all), I deleted them and I set the entry browser.places.createdSmartBookmarks to false. However, no Smart Bookmarks appears . (I have other bookmarks in my Bookmarks Toolbar folder) Do you know a solution? I run FF3b4.
(I can also wait for the next version if that will solve the problem)
If about:config change and restart don't work for you (it didn't work for me either couple of nightlies ago) just recreate folder manually, and add queries from the post you quoted, those are default Smart Bookmarks.
- Laeb
- Posts: 90
- Joined: September 21st, 2003, 11:21 pm
- Location: Montréal, CAN
Re: How to build a query to find a bookmarks folder
Canyonero wrote:Laeb wrote:Does anyone has an example of a query to find a bookmarks folder by its name anywhere in Places ?
I tried this but it did not work:
Seems like it should work, but I haven't played with any of that stuff for awhile. I assume you've looked at the result to see what it was. What exactly is it returning to you?
It is returning a result object with no child but the searched bookmarks folder does exist.