Feature Proposal: Query custom collections

Motivation

A couple of proposals (this one used to be known as QueryLinksAndBacklinks) seem to be somewhat mergeable:

An IRC discussion, established that it should be possible to 'scope' queries using the QuerySearch syntax itself, to a particular 'collection' (better term wanted)

Description and Documentation

This requires two parts spec'd out:
  1. Syntax to query custom collections (and the standard 'topics' collection, which we can assume is what QuerySearch already defaults to)
  2. Store/Meta/??? API changes to allow registration of new collections; different collections might want to have their own store mechanisms too, unless they represent topics?

Examples

Just brainstorming
  • Query topics that have backlinks to a given topic
    %QUERY{"topiclinks[target='Web.TargetTopic']"}%
  • Authors of topics that have backlinks to a given topic
    %QUERY{"topiclinks[target='Web.TargetTopic'].author"}%
  • Query a topic for its links to other topics
    %QUERY{"topiclinks[source='Web.SourceTopic'"}%

QueryAcrossTopicRevisions

  • List all revs on a topic authored by JoeBloggs
    %QUERY{"revisions[name='Web.SomeTopic' AND author='JoeBloggs']"}%
  • List all revs on a topic where 'State' was Working
    %QUERY{"revisions[name='Web.SomeTopic' AND State='Working']"}%
  • List all revs on a topic between Jan 1 and Sep 1
    %QUERY{"revisions[name='Web.SomeTopic' AND date >= d2n(2010-01-01) AND date <= d2n(2010-09-01)]"}%
  • List all topics that have any rev whose 'State' was ever Waiting
    %QUERY{"revisions[State='Waiting']"}%

'log' DB

  • Query for save actions between 12/12/2005 and 12/12/2008
    %QUERY{"log[action='save' AND '12/12/2005'<date<'12/12/2008']"}%

Standard 'topics' collection as we already know it

  • Essentially, all existing QuerySearch queries operate on our existing 'topics' DB, Eg.
    %QUERY{"FieldName='SomeValue'"}%
    becomes something like:
    %QUERY{"topics[name='%BASEWEB%.%BASETOPIC%' AND FieldName='SomeValue']"}%

QueryAccessControls

  • On a vanilla foswiki, probably this will expand to %ALLOW[WEB,TOPIC]CHANGE% -
    %QUERY{"acls[topic='%WEB%.%TOPIC%' AND allowtopicchange]
    or, to flatten out groups as far as the user mapper is capable (TopicUserMapping should show only users, no groups):
    %QUERY{"acls[topic='%WEB%.%TOPIC%' AND allowtopicchange].flattened
    or to list only groups:
    %QUERY{"acls[topic='%WEB%.%TOPIC%' AND allowtopicchange AND isgroup]
    or to list flattened groups:
    %QUERY{"acls[topic='%WEB%.%TOPIC%' AND allowtopicchange AND isgroup].flattened

Impact

%WHATDOESITAFFECT%
edit

Implementation

-- Contributors: PaulHarvey - 04 Oct 2010

Discussion

it is possible that what you call a collection, is what I've been calling a ResultSet. (I say possible, because clearly, further thought is needed to define both of these terms.

  • List all topics from a previous QUERY's named resultset that whose 'State' was ever Waiting
    %QUERY{"PreviouslyNamedSet[State='Waiting']"}%

-- SvenDowideit - 26 Oct 2010

Added the QueryAccessControls example

-- PaulHarvey - 07 Nov 2010
Topic revision: r4 - 07 Nov 2010, PaulHarvey - This page was cached on 05 Jun 2020 - 05:04.

The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy