MozillaZine

Places query syntax

Discussion about official Mozilla Firefox builds
Max Karl Ernst

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

Post Posted February 18th, 2008, 11:35 am

@Oropher apparently there is a sqlite manager extension that works lovely :)
As for those two sort orders, url Mike provided explains it's the sort by count, I checked database and it probably means count of times bookmark has been visited.

@Mike - That's just great, cleared many things up :)

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

Post Posted February 18th, 2008, 1:44 pm

Max Karl Ernst wrote:@Oropher apparently there is a sqlite manager extension that works lovely :)

Thanks, I'll have a look for it.
Max Karl Ernst wrote:As for those two sort orders, url Mike provided explains it's the sort by count, I checked database and it probably means count of times bookmark has been visited.

That would dupe 7 & 8, visit count. Instead the results appear to dupe 1 & 2. Are you seeing different results? Mine could be skewed because it's a fairly new profile that I imported the bookmarks into with Weave.

Yeah, there's a lot of helpful explanations in nsINavHistoryService.idl (thanks Mike). I don't know if all of it should go in your summary Max? Not everything in there is much use for just hand-building smart bookmarks queries. But it should certainly go on MDC for the benefit of people (like me ;) ) who don't know where to look in the code.

maxResults - Set max number of results to return. Note: the query is executed, the results are sorted, and then the top 'maxResults' results are taken and returned. Set to 0 (the default) to get all results. THIS DOES NOT WORK IN CONJUNCTION WITH SORTING BY TITLE. This is because sorting by title requires us to sort after using locale-sensitive sorting (as opposed to letting the database do it for us). Instead, we get the result ordered by date, pick the maxResult most recent ones, and THEN sort by title.
domainIsHost - Controls the meaning of 'domain', and whether it is an exact match (=true), or hierarchical (= false).
uriIsPrefix - Controls the interpretation of 'uri'. When unset (default), the URI will request an exact match of the specified URI. When set, any history entry beginning in 'uri' will match. For example "http://bar.com/foo" will match "http://bar.com/foo" as well as "http://bar.com/foo/baz.gif".
excludeItems Excludes all URIs and separators from a bookmarks query. This would be used if you just wanted a list of bookmark folders and queries (such as the left pane of the places page). Ignored for queries over history. Defaults to false.
excludeQueries - Set to true to exclude queries ("place:" URIs) from the query results. Simple folder queries (bookmark folder symlinks) will still be included. Defaults to false.
excludeReadOnlyFolders - Set to true to exclude read-only folders from the query results. This is designed for cases where you want to give the user the option of filing something into a list of folders. It only affects cases where the actual folder result node would appear in its parent folder and filters it out. It doesn't affect the query at all, and doesn't affect more complex queries (such as "folders with annotation X").
excludeItemIfParentHasAnnotation - This option excludes items from a bookmarks query if the parent of the item has this annotation. An example is to exclude livemark items (parent folders have the "livemark/feedURI" annotation). Ignored for queries over history.
expandQueries - When set, allows items with "place:" URIs to appear as containers,with the container's contents filled in from the stored query. If not set, these will appear as normal items. Doesn't do anything if excludeQueries is set. Defaults to false. Note that this has no effect on folder links, which are place: URIs returned by nsINavBookmarkService.GetFolderURI. These are always expanded and will appear as bookmark folders.
originalTitle - Retrieves original page title. Not searchable?
includeHidden - Most items in history are marked "hidden." Only toplevel pages that the user sees in the URL bar are not hidden. Hidden things include the content of iframes and all images on web pages. Normally, you don't want these things. If you do, set this flag and you'll get all items, even hidden ones. Does nothing for bookmark queries. Defaults to false.
showSessions - Separate/group history items based on session information. Only matters when sorting by date.

Max Karl Ernst

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

Post Posted February 18th, 2008, 4:31 pm

Oropher wrote:That would dupe 7 & 8, visit count. Instead the results appear to dupe 1 & 2. Are you seeing different results? Mine could be skewed because it's a fairly new profile that I imported the bookmarks into with Weave.


No, actually I haven't got any results with those values. And you're right, visit count already exists so it is my mistake. Can't think of any other count right now, we shall take better look at database and source :)

Oropher wrote: Yeah, there's a lot of helpful explanations in nsINavHistoryService.idl (thanks Mike). I don't know if all of it should go in your summary Max? Not everything in there is much use for just hand-building smart bookmarks queries. But it should certainly go on MDC for the benefit of people (like me ;) ) who don't know where to look in the code.

Yeah, it's absolutely delightful. I stripped details a bit to make it lighter, but l added links to your post and source for full reference if you don't mind :)

@Cye3s Are you sure about that time format as it baffles me a bit. It looks that source says it's the value of microseconds from 1970, do you get proper results with your query?

frandavid100
 
Posts: 41
Joined: February 18th, 2008, 3:40 pm

Post Posted February 18th, 2008, 4:42 pm

Max Karl Ernst wrote:beginTime
Query from this time.
Values: Any. Time format is in microseconds from now, so multiply with 1000000 * 60 * 60 for hours and for days multiply that with 24. Now is 0. Values before now are negative.


beginTimeRef

endTime
Query til this time.
Values: Same as beginTime.


endTimeRef (Unsigned Long)

terms (String)
Query this term
Values: Any

minVisits (Long)
Filter results based on number of visits. This is lower value
Values:
-1 (default) - Show all
Any - Show items with visit count larger than this number.

maxVisits (Long)
Filter results based on number of visits. This is upper value
Values:
-1 (default) - Show all
Any - Show items with visit count smaller than this number.

onlyBookmarked (Boolean)
Return only bookmarked items
Values:
true - Return only bookmarked items
false - Return all

domain (String)
Query for this host or domain name (controlled by domainIsHost).
Values: Any

domainIsHost (Boolean)
Controls the meaning of 'domain'
Values:
true - exact match
false - hierarchical (Returns anything whose host name ends in 'domain')

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

!annotation (Boolean)
Test for existance or non-existance of a given annotation. "Annotation is not"
Values:
true - Remove everything that doesn't have annotation.
false - Normal results

annotation (String)
Annotation to match
Values: Any

uri (URI)
URI to match
Values: Any

uriIsPrefix (Boolean)
Controls the interpretation of 'uri' (above).
Values:
false (default) - the URI will request an exact match of the specified URI.
true - Any history entry beginning in 'uri' will match (for example "http://bar.com/foo" will match "http://bar.com/foo" as well as "http://bar.com/foo/baz.gif")

OR
Logical operator

group (Unsigned Short)
Group results
Values:
0 - Group by day (since last visit)
1 - Group by exact host (for example "bugzilla.mozilla.org" and "www.mozilla.org" will be separate)
2 - Group by toplevel domain (mozilla.org will be one entry, and will contain "bugzilla.mozilla.org" and"www.mozilla.org").
3 - Group by bookmark folders (also tags as they are special folders)

sort (Unsigned Short)
Sort results
Values:
0 - Natural bookmark order
1 - Sort by title, A-Z
2 - Sort by title, Z-A
3 - Sort by visit date, most recent last
4 - Sort by visit date, most recent first
5 - Sort by uri, A-Z
6 - Sort by uri, Z-A
8 - Sort by visit count, ascending
8 - Sort by visit count, descending
9 - Sort by keyword, A-Z
10 - Sort by keyword, Z-A
11 - Sort by date added, most recent last
12 - Sort by date added, most recent first
13 - Sort by last modified date, most recent last
14 - Sort by last modified date, most recent first
15 - Sort by count, ascending (Untested)
16 - Sort by count, descending (Untested)
17 - Sort by tags, ascending (Untested)
18 - Sort by tags, descending (Untested)
19 - Sort by annotation, ascending (Untested)
20 - Sort by annotation, descending (Untested)

sortingAnnotation (String)
The annotation to use in sort by annotation modes

type
Identifies the type of this node (?)
Values:
0 - 9

excludeItems (Boolean)
Exclude all URIs and separators from the bookmark query results (ignored for queries over history.)
Values:
true - Return only list of bookmark folders and queries (such as the left pane of the places page)
false (default) - Return full list

excludeQueries (Boolean)
Excludes queries from the query results (simple folder queries like bookmark folder symlinks will still be included.)
Values:
true - Return list without queries
false (default) - Return full list

excludeReadOnlyFolders (Boolean)
Excludes read-only folders from the query results (this only affects cases where the actual folder result node would appear in its parent folder and filters it out)
Values:
true - Return list without read-only folders
false (default) - Return full list

excludeItemIfParentHasAnnotation (Boolean)
Exclude item whose parent has annotation from the bookmark query results (ignored for queries over history.)An example is to exclude livemark items (parent folders have the "livemark/feedURI" annotation)
Values:
true - Exclude item
false (default) - Return full list

expandQueries (Boolean)
Allows items with "place:" URIs to appear as containers,with the container's contents filled in from the stored query (doesn't do anything if excludeQueries is set).
true - "place:" URIs appear as containers
false (default) - "place:" URIs appear as normal items

originalTitle (String)
Retrieves original page title.
Values:none?

includeHidden (Boolean)
Returns normally hidden items in history query (content of iframes and all images on web pages). Does nothing for bookmark queries
Values:
true - Return items including hidden ones
false (default) - Return normal results

showSessions (Boolean)
Separate/group history items based on session information. Only matters when sorting by date.
Values:
true - Use session information when returning results
false (default) - Normal results

resolveNullBookmarkTitles

applyOptionsToContainers (Boolean)
Only apply our query options to the containers
Values:
true
false

maxResults (Unsigned Long)
Set max number of results to return. This doesn't work in conjunction with sorting by title!

Values:
0 (default) - Get all results
Any: The query is executed, the results are sorted, and then the top 'maxResults' results are taken and returned.

queryType (Unsigned Short)
[color=gray]The type of search to use when querying the DB; This attribute is only honored by query nodes. It is silently ignored for simple folder queries.
Values:
0 - History
1 - Bookmarks
2 - Unified


Are there plans to integrate those in the Places search interface? I can only search for "text", "visited" and "location". I would like to be able to do a tag search, at least.

Max Karl Ernst

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

Post Posted February 18th, 2008, 5:02 pm

frandavid100 wrote:Are there plans to integrate those in the Places search interface? I can only search for "text", "visited" and "location". I would like to be able to do a tag search, at least.


If you are referring to search in "Library" it does search tags too, just make sure you sorted results by tags so you get them on top. If you don't see tags column click that little box in the right corner below the search bar :)

@On Topic
One quickie that just made my friend very happy :)
"Most Visited" includes all pages you're browsing often cluttering important ones, so to make "Most Visited Bookmarks" just bookmark this:
Code: Select all
place:queryType=0&sort=8&maxResults=10&onlyBookmarked=true

Cye3s
 
Posts: 17
Joined: December 28th, 2007, 9:53 pm

Post Posted February 18th, 2008, 7:32 pm

Max Karl Ernst wrote:@Cye3s Are you sure about that time format as it baffles me a bit. It looks that source says it's the value of microseconds from 1970, do you get proper results with your query?

Yes,the source says the time format is microseconds, set it to -1000 return the same results :(
I don`t know why,maybe we need an official document.

frandavid100
 
Posts: 41
Joined: February 18th, 2008, 3:40 pm

Post Posted February 19th, 2008, 1:44 am

Max Karl Ernst wrote:If you are referring to search in "Library" it does search tags too, just make sure you sorted results by tags so you get them on top. If you don't see tags column click that little box in the right corner below the search bar :)


I would like it to search *only* tags, but I'll give the method a try. Thanks Max.

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

Post Posted February 19th, 2008, 5:00 am

@Max Karl Ernst - good job with the summary.
@Cye3s - yes, we could do with an official document - the MDC page you linked to earlier needs updating. I don't have time to search for a documentation bug on that right now, but I'll do it later unless someone gets there first ;)

ktrix
 
Posts: 24
Joined: December 7th, 2004, 11:56 pm

Post Posted February 19th, 2008, 5:15 am

frandavid100 wrote:
Max Karl Ernst wrote:If you are referring to search in "Library" it does search tags too, just make sure you sorted results by tags so you get them on top. If you don't see tags column click that little box in the right corner below the search bar :)


I would like it to search *only* tags, but I'll give the method a try. Thanks Max.


Sorry I realize this is off topic, but I have the same issue. I want to search for specific tags (and combinations thereof) so I can make saved search folders. Right now, if the word I use for a tag also happens to be in the title of a page in my history, the search (and thus the search folder) returns a lot of junk. :(

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

Post Posted February 19th, 2008, 5:21 am

ktrix wrote:
frandavid100 wrote:
Max Karl Ernst wrote:If you are referring to search in "Library" it does search tags too, just make sure you sorted results by tags so you get them on top. If you don't see tags column click that little box in the right corner below the search bar :)


I would like it to search *only* tags, but I'll give the method a try. Thanks Max.


Sorry I realize this is off topic, but I have the same issue. I want to search for specific tags (and combinations thereof) so I can make saved search folders. Right now, if the word I use for a tag also happens to be in the title of a page in my history, the search (and thus the search folder) returns a lot of junk. :(

Take a look at the examples Max links to in his first post. That should show you how to construct a tags-only search manually :)
As for the results from a search in the Library, a workaround is to click on the 'Tags' column to sort by tags and stick the other results down at the bottom.

Max Karl Ernst

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

Post Posted February 19th, 2008, 5:23 am

Well you can't do that yet (ff 3.0b4). Maybe it will be implemented later.

You can however edit query manually to search tags only. There is "top" example link on the first post.

[edit] Ah, Oropher, you're blazing fast :)

timjstone
 
Posts: 30
Joined: October 30th, 2004, 11:12 am

Post Posted February 19th, 2008, 5:35 am

what would be great would be to set a "places query" as your homepage! then it would solve the problem that some people are having (the ones who sent their homepage to bookmarks.html). i can see an issue about how it would be formatted, but i can see a lot of uses for this

has anyone else noticed the following:

1. if you create a new places query it doesn't show the same icon as the original queries

2. you can't select "open all in tabs" for the places query

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

Post Posted February 19th, 2008, 9:40 am

timjstone wrote:what would be great would be to set a "places query" as your homepage! then it would solve the problem that some people are having (the ones who sent their homepage to bookmarks.html). i can see an issue about how it would be formatted, but i can see a lot of uses for this

At this stage of the game, that sounds more like an extension. You might want to file an enhancement bug for it, and perhaps mention it over in the daily builds thread, though.

timjstone wrote:has anyone else noticed the following:

1. if you create a new places query it doesn't show the same icon as the original queries

2. you can't select "open all in tabs" for the places query

Both of these WFM.

Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9b4pre) Gecko/2008021903 Minefield/3.0b4pre ID:2008021903

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

Post Posted February 19th, 2008, 9:46 am

Cye3s wrote:
Max Karl Ernst wrote:@Cye3s Are you sure about that time format as it baffles me a bit. It looks that source says it's the value of microseconds from 1970, do you get proper results with your query?

Yes,the source says the time format is microseconds, set it to -1000 return the same results :(
I don`t know why,maybe we need an official document.

I wonder if beginTimeRef and endTimeRef are set in microseconds from 1970? That would allow queries against a fixed time period rather than a 'moving target' based on the current time.

Max Karl Ernst

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

Post Posted February 19th, 2008, 11:51 am

Oropher wrote:I wonder if beginTimeRef and endTimeRef are set in microseconds from 1970? That would allow queries against a fixed time period rather than a 'moving target' based on the current time.


I got puzzling results with Cye3s formula, but as I haven't went much into time format, it might as well be my mistake. I'm also not sure what time does it refer to last visited, bookmarked, modified or what. So those strings obviously need more attention :)

Return to Firefox Builds


Who is online

Users browsing this forum: No registered users and 9 guests