MozillaZine

Places query syntax

Discussion about official Mozilla Firefox builds
Neelark
 
Posts: 4
Joined: March 18th, 2006, 8:07 am
Location: UK

Post Posted April 1st, 2008, 8:12 am

Max Karl Ernst wrote: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=2&excludeItems=1&queryType=1

Just a thought. Wouldn't it be a good idea to be able to change the default queries for the menus via about:config.

Maybe it's already possible in the nightlies, but all I can see in beta 4 is: browser.places.organizer.options.bookmarks

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

Post Posted April 4th, 2008, 4:01 pm

Neelark wrote:Just a thought. Wouldn't it be a good idea to be able to change the default queries for the menus via about:config.

I hope it won't be buried that deep. I'd like to keep queries editable in the organizer, but I suspect devs are leery of handing out footguns, in the form of endless recursiveness or corrupted whatever, to an unsuspecting populace. As release time approach-eth, sort of thing, they'd rather it were more robust, I'd expect.

Once the release comes out, I'd also expect query support to be high on The List.

a;skdjfajf;ak

User avatar
 
Posts: 17002
Joined: July 10th, 2004, 8:44 am

Post Posted April 4th, 2008, 4:09 pm

bomfog wrote:
Neelark wrote:As release time approach-eth, sort of thing, they'd rather it were more robust, I'd expect.

Once the release comes out, I'd also expect query support to be high on The List.


Well for those of us that are not that well versed in creating queries, they took away any advance to beginning to create those queries when they removed the Advanced Search feature from the Library.

Query support high on the 'list' ? Nope, not it 3.0 I'd say.

Any Advanced search, or query items will probably come later in the form of an extension.

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

Post Posted April 4th, 2008, 5:30 pm

Littlemutt wrote:
bomfog wrote:As release time approach-eth, sort of thing, they'd rather it were more robust, I'd expect.

Once the release comes out, I'd also expect query support to be high on The List.
Query support high on the 'list' ? Nope, not it 3.0 I'd say.

Any Advanced search, or query items will probably come later in the form of an extension.

Once the release comes out -> post 3.0, was my intent, so we agree there.

I think they'll have to come up with something more complete in the build, though, rather than relying entirely on extensions.

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

Post Posted April 9th, 2008, 6:42 pm

In Bug 399264 – stop hard coding folder roots in place: urls,
edit: In Bug 423267 – Library/Bookmark sidebar is blank/empty with new profile, actually,

(from the first post)
folder (Unsigned Short)
Folder that is queried
Values:
1 - Places (Untested)
2 - Bookmarks Menu
3 - Bookmarks Toolbar
4 - Tags
5 - Unfiled Bookmarks

becomes

PLACES_ROOT - Places
BOOKMARKS_MENU - Bookmarks Menu
TOOLBAR - etc.
TAGS - ...
UNFILED_BOOKMARKS - ....

changing numbers to names.

Max Karl Ernst

User avatar
 
Posts: 107
Joined: February 5th, 2008, 3:43 am

Post Posted April 10th, 2008, 8:56 am

Thanks bomfog for update :)
Fixing folder values and default query for Recently Bookmarked.

So, for example, people that want Unfiled Bookmarks in their Bookmark Menu would add this bookmark:
Code: Select all
place:folder=UNFILED_BOOKMARKS

mattcoz
 
Posts: 1014
Joined: November 7th, 2002, 11:15 pm

Post Posted April 20th, 2008, 9:41 pm

Maybe someone can help me, how do I create a query to list all my livemarks? I tried this:

Code: Select all
place:queryType=1&sort=1&annotation=livemark/feedURI


Is this even possible?

Oropher
 
Posts: 346
Joined: September 26th, 2007, 7:12 pm

Post Posted April 21st, 2008, 4:21 am

I'd guess that:
Code: Select all
place:folder=BOOKMARKS_MENU&folder=UNFILED_BOOKMARKS&folder=TOOLBAR&queryType=1&annotation=livemark%2FfeedURI
ought to work, but it doesn't seem to. I'll hunt around and see what I can come up with.

Max Karl Ernst

User avatar
 
Posts: 107
Joined: February 5th, 2008, 3:43 am

Post Posted April 21st, 2008, 9:03 am

This is a thing I've been trying to do for months and never made it to work :) It's IMHO one of the most useful queries we could dig up.

We should probably check in nsNavHistory.cpp code around line 4904 to see what happens with annotation queries, I just never had time to dechiper all the variables... :)

According to the code it should be
Code: Select all
place:annotation=livemark%2FfeedURI

but it doesn't work.

Oropher
 
Posts: 346
Joined: September 26th, 2007, 7:12 pm

Post Posted April 21st, 2008, 11:56 am

I had a look earlier and couldn't figure out why it doesn't work.

I did spot something else interesting, in http://mxr.mozilla.org/mozilla/source/toolkit/components/places/public/nsINavHistoryService.idl#950: a RESULTS_AS_TAG_CONTENTS query. Sounds extremely useful, although I haven't figured out how to use it yet either.

Maybe I'll get some time to dig around properly later. :(

mak77
 
Posts: 262
Joined: April 3rd, 2006, 4:51 pm
Location: Italy

Post Posted April 21st, 2008, 2:33 pm

for RESULTS_AS_TAG_CONTENTS: queryType=1&type=7&folder=tag_folder_id
only one folder can be defined for this resultType
to have bookmarks tagged with tag corresponding to that folder id
it probably does not support many other options due to backend limitations, you cannot sort results for sure. Will most probably change in future though if tags are moved out from bookmarks table
this exists because it makes a remap from tag contents to real tagged bookmarks, returning the last modified bookmark in case a bookmark is duplicated.

Max Karl Ernst

User avatar
 
Posts: 107
Joined: February 5th, 2008, 3:43 am

Post Posted April 21st, 2008, 3:00 pm

Yay, that works lovely, thank you very much mak77 for hard work and this insider info :)

I never knew you could use actual folder id as folder argument that's a bit of a revelation.
It would be nicer if tags were separate and unique, and query could be based on terms, but at this stage any hack tip is welcome :)

So people to get your tag_folder_id from sqlite manager find moz_bookmarks table, find your term in titles column, make sure type column is 2 and then read tag_folder_id from id column. Complicated? Hell yeah, but it works :)

Oropher
 
Posts: 346
Joined: September 26th, 2007, 7:12 pm

Post Posted April 22nd, 2008, 3:03 am

mak77, that is huge. Thanks!

So now we have a fix for both the duplicate results and the no titles issues. :) Still doesn't let us sort the results according to tag or folder, but it's a big step forward. I'm happy. :D

Max Karl Ernst wrote:So people to get your tag_folder_id from sqlite manager find moz_bookmarks table, find your term in titles column, make sure type column is 2 and then read tag_folder_id from id column. Complicated? Hell yeah, but it works :)

I think you actually want to look for 'parent=4'. 'type=2' seems to include regular folders and live bookmarks as well as tags.

- Matthew

Max Karl Ernst

User avatar
 
Posts: 107
Joined: February 5th, 2008, 3:43 am

Post Posted April 22nd, 2008, 4:43 am

Oropher wrote:I think you actually want to look for 'parent=4'. 'type=2' seems to include regular folders and live bookmarks as well as tags.


Yes, I was wrong, wasn't really paying much attention. Thanks for the fix :)

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

Post Posted April 23rd, 2008, 8:27 am

Note that if you sync with weave, I think you'll still have to carry per-profile-tag_folder_id'd copies of the query. Maybe some sync-add query-sync contortions would make it other-wise, but I don't see any easy (user-facing) way to guarantee "portable" id's.

Weave doesn't do much with tags yet, does it? When/if it does, will/does it re-write the folder_id's to match across profiles? I have very little idea how this stuff works, but that (syncing id's) doesn't seem to have happened during my brief bit of tinkering.

I'm syncing current-mardak-trybuild and current-trunk profiles, if it matters. I doubt it does.

Return to Firefox Builds


Who is online

Users browsing this forum: No registered users and 4 guests