Content-Type: text/x-zim-wiki
Wiki-Format: zim 0.4
Creation-Date: Thu, 30 Jul 2009 21:37:25 +0200

====== SavedSearch ======
Created Thursday 30 July 2009

Saved Search would be generic interface used for e.g. by [[Task List]] plugin or a [[Tags]] plugin. It would use a table in the index database to account which page matches what search. This table would be updated all the time by hooking the queries into updates of the database.

Need a way to hook query objects to the index update routines and then get pages that matched the query from the index.

As a seperate feature it would be nice to have special pages, which are read-only and have links to all matches. Or should this go into a special UI element, e.g. in the side pane ? 

===== Implementation =====
* Add two tables
	* one joining page ids and property ids
	* one mapping property names to ids
* Have a method to register queries versus
* Each query determines the match for a single property name
* Optimise search to use these properties
	* Special keyword

E.g. the task list could register the "has_tasks" property, or even "has_tasks" and "has_open_tasks"
And the tags plugin could register a property "tag_foo" for a tag "@foo".
Special saved search pages would have a property name like "matches_search001"
etc.

In SQL we can query multiple properties at the same time using the "INTERSECT" operator.


