Opened 17 months ago

Last modified 17 months ago

#18156 new enhancement

Support BQuery filtering by folder

Reported by: outsidecontext Owned by: nobody
Priority: normal Milestone: Unscheduled
Component: Kits/Storage Kit Version: R1/beta4
Keywords: Cc:
Blocked By: Blocking:
Platform: All

Description

When using Queries to find files it would be sometimes helpful to be able to filter the results by path / folder / location.

Currently the query predicate syntax already supports filtering by the filename (using something like "name==abc*"). Similar there could be the ability to filter by location by providing a "location" attribute containing the path. E.g. to get all video files in the home folder:

(location=/boot/home/*)&&(BEOS:TYPE==video/*)

See also the forum discussion on https://discuss.haiku-os.org/t/tracker-query-by-location/12828

Change History (2)

comment:1 by pulkomandy, 17 months ago

There is no performance benefit to doing it inside BQuery due to the way the attribute index works. That's why it isn't done there originally.

However, it can easily be done by filtering the results once you have them. Which we should add support for in the command line query tool and Tracker find dialog.

Should it be by extending the query language, or by allowing these tools to select a specific directory? How to handle live query updates in this situation?

comment:2 by outsidecontext, 17 months ago

I see. So if there is no performance benefit I agree that it does not need to be part of the core implementation.

For the query tool there is already an updated variant in the source that seems to do the filtering just fine: https://github.com/haiku/haiku/blob/master/src/bin/filteredquery/query.cpp

Looks like it should work, but I haven't run it and it looks like this utility is not build by default (or at least not included in release binaries). But maybe it makes sense to merge this with the query tool itself.

For Tracker I guess live updates means it should be a filter that gets applied then on each added item.

Note: See TracTickets for help on using tickets.