Query SearchQuery searches help you search the contents of forms attached to your topics, as well as the values of other meta-data attached to the topic. Using query searches you can search:
On this page:
Field specifiersYou use field specifiers to say what value from the topic you are interested in. All meta-data in a topic is referenced according to a simple plan.
META:TOPICPARENT , META:TOPICINFO etc - are structures which are indexed by keys. For example, META:TOPICINFO has 4 entries, which are indexed by the keys author , date , format and version . META:FILEATTACHMENT , META:FIELD and META:PREFERENCE are all arrays, which means they can have any number of records under them. Arrays are indexed by numbers - for example, the first entry in the META:FIELD array is entry 0. The field specifier arraysize returns the number of items in an array, for example, attachments.arraysize returns the number of attachments.
It's a bit clumsy having to type META:FILEATTACHMENT every time you want to refer to the array of attachments in a topic, so there are some predefined aliases that make it a bit less typing:
fields shortcut when accessing form fields, but always use the name of the form instead.
There is a shortcut for accessing form fields. If you use the name of a field (for example, LastName ) in the query without a . before it, that is taken to mean "the value of the field named this". This works if and only if the field name isn't the same as of the top level entry names or their aliases described above. For example, the following expressions will all evaluate to the same thing:
X would conflict with the name of an entry or alias (e.g. it's moved or maybe parent ), you can prepend the name of the form followed by a dot, as shown in the last example.
ConstantsYou use constants for the values that you compare with fields. Constants are either strings, or numbers. Strings are always delimited by single-quotes (you can escape a quote using backslash). Numbers can be any integer or floating point number. Constants can be supplied by TWikiVariables, such as'%TOPIC%' representing the current topic name.
OperatorsField specifiers and constants are combined using operators to create queries.
Putting it all togetherWhen a query is applied to a topic, the goal is to reduce to a TRUE or FALSE value that indicates whether the topic matches that query or not. If the query returns TRUE, then the topic is included in the search results. A query matches if the query returns one or more values when it is applied to the topic. So if I have a very simple query, such as"attachments" , then this will return TRUE for all topics that have one or more attachments. If I write "attachments[size>1024 AND name ~ '*.gif']" then it will return TRUE for all topics that have at least one attachment larger than 1024 bytes with a name ending in .gif .
Gotcha
ExamplesQuery examples
Search examplesFind all topics that are children of this topic in the current web%SEARCH{"parent.name = '%TOPIC%'" web="%WEB%" type="query"}%Find all topics that have an attachment called 'grunge.gif' %SEARCH{"attachments[name='grunge.gif']" type="query"}%Find all topics that have form ColorForm where the form field 'Shades' is 'green' or 'yellow' but not 'brown'
%SEARCH{"(lc(Shades)='green' OR lc(Shades)='yellow') AND NOT(lc(Shades) ~ 'brown')" type="query"}%Find all topics that have PNG attachments that have been added since 26th March 2007 %SEARCH{"attachments[name ~ '*.png' AND date >= d2n('2007-03-26')]"}%Find all topics that have a field 'Threat' set to 'Amber' and 'cold virus' somewhere in the topic text. %SEARCH{"Threat='Amber' AND text ~ '*cold virus*'"}% | |||||||||||||||||||||||||||||||||||||||||||||||||||
Added: | |||||||||||||||||||||||||||||||||||||||||||||||||||
> > |
Find all topics that have a parent topic called "Family" and provide a link with the Topic name that goes directly to the last attachment (by date) that was attached to that topic.
%SEARCH{ "parent.name = 'Family'" type="query" nonoise="on" format="| [[%PUBURL%/%WEB%/$topic/$percntCALC{\"$LISTITEM($LISTSIZE($query(attachments.name)), $query(attachments.name))\"}$percnt][$topic]] |" }% | ||||||||||||||||||||||||||||||||||||||||||||||||||
Related Topics: IfStatements, SearchHelp, VarIF, VarGET, VarSET, VarSEARCH, FormattedSearch, TWiki:TWiki.QuerySearchPatternCookbook |
Query SearchQuery searches help you search the contents of forms attached to your topics, as well as the values of other meta-data attached to the topic. Using query searches you can search:
On this page:
Field specifiersYou use field specifiers to say what value from the topic you are interested in. All meta-data in a topic is referenced according to a simple plan.
| |||||||||||||||||||||||||||||||||||||||||||||||||
Added: | |||||||||||||||||||||||||||||||||||||||||||||||||
> > |
| ||||||||||||||||||||||||||||||||||||||||||||||||
META:TOPICPARENT , META:TOPICINFO etc - are structures which are indexed by keys. For example, META:TOPICINFO has 4 entries, which are indexed by the keys author , date , format and version . META:FILEATTACHMENT , META:FIELD and META:PREFERENCE are all arrays, which means they can have any number of records under them. Arrays are indexed by numbers - for example, the first entry in the META:FIELD array is entry 0. The field specifier arraysize returns the number of items in an array, for example, attachments.arraysize returns the number of attachments.
It's a bit clumsy having to type META:FILEATTACHMENT every time you want to refer to the array of attachments in a topic, so there are some predefined aliases that make it a bit less typing:
fields shortcut when accessing form fields, but always use the name of the form instead.
There is a shortcut for accessing form fields. If you use the name of a field (for example, LastName ) in the query without a . before it, that is taken to mean "the value of the field named this". This works if and only if the field name isn't the same as of the top level entry names or their aliases described above. For example, the following expressions will all evaluate to the same thing:
X would conflict with the name of an entry or alias (e.g. it's moved or maybe parent ), you can prepend the name of the form followed by a dot, as shown in the last example.
ConstantsYou use constants for the values that you compare with fields. Constants are either strings, or numbers. Strings are always delimited by single-quotes (you can escape a quote using backslash). Numbers can be any integer or floating point number. Constants can be supplied by TWikiVariables, such as'%TOPIC%' representing the current topic name.
OperatorsField specifiers and constants are combined using operators to create queries.
Putting it all togetherWhen a query is applied to a topic, the goal is to reduce to a TRUE or FALSE value that indicates whether the topic matches that query or not. If the query returns TRUE, then the topic is included in the search results. A query matches if the query returns one or more values when it is applied to the topic. So if I have a very simple query, such as"attachments" , then this will return TRUE for all topics that have one or more attachments. If I write "attachments[size>1024 AND name ~ '*.gif']" then it will return TRUE for all topics that have at least one attachment larger than 1024 bytes with a name ending in .gif .
Gotcha
ExamplesQuery examples
| |||||||||||||||||||||||||||||||||||||||||||||||||
Changed: | |||||||||||||||||||||||||||||||||||||||||||||||||
< < |
| ||||||||||||||||||||||||||||||||||||||||||||||||
> > |
| ||||||||||||||||||||||||||||||||||||||||||||||||
Search examplesFind all topics that are children of this topic in the current web%SEARCH{"parent.name = '%TOPIC%'" web="%WEB%" type="query"}%Find all topics that have an attachment called 'grunge.gif' %SEARCH{"attachments[name='grunge.gif']" type="query"}% | |||||||||||||||||||||||||||||||||||||||||||||||||
Changed: | |||||||||||||||||||||||||||||||||||||||||||||||||
< < | Find all topics that have form ColourForm where the form field 'Shades' is 'green' or 'yellow' but not 'brown' | ||||||||||||||||||||||||||||||||||||||||||||||||
> > | Find all topics that have form ColorForm where the form field 'Shades' is 'green' or 'yellow' but not 'brown' | ||||||||||||||||||||||||||||||||||||||||||||||||
%SEARCH{"(lc(Shades)='green' OR lc(Shades)='yellow') AND NOT(lc(Shades) ~ 'brown')" type="query"}%Find all topics that have PNG attachments that have been added since 26th March 2007 %SEARCH{"attachments[name ~ '*.png' AND date >= d2n('2007-03-26')]"}%Find all topics that have a field 'Threat' set to 'Amber' and 'cold virus' somewhere in the topic text. %SEARCH{"Threat='Amber' AND text ~ '*cold virus*'"}%Related Topics: IfStatements, SearchHelp, VarIF, VarGET, VarSET, VarSEARCH, FormattedSearch, TWiki:TWiki.QuerySearchPatternCookbook |
Query SearchQuery searches help you search the contents of forms attached to your topics, as well as the values of other meta-data attached to the topic. Using query searches you can search:
On this page:
Field specifiersYou use field specifiers to say what value from the topic you are interested in. All meta-data in a topic is referenced according to a simple plan.
META:TOPICPARENT , META:TOPICINFO etc - are structures which are indexed by keys. For example, META:TOPICINFO has 4 entries, which are indexed by the keys author , date , format and version . META:FILEATTACHMENT , META:FIELD and META:PREFERENCE are all arrays, which means they can have any number of records under them. Arrays are indexed by numbers - for example, the first entry in the META:FIELD array is entry 0. The field specifier arraysize returns the number of items in an array, for example, attachments.arraysize returns the number of attachments.
It's a bit clumsy having to type META:FILEATTACHMENT every time you want to refer to the array of attachments in a topic, so there are some predefined aliases that make it a bit less typing:
fields shortcut when accessing form fields, but always use the name of the form instead.
There is a shortcut for accessing form fields. If you use the name of a field (for example, LastName ) in the query without a . before it, that is taken to mean "the value of the field named this". This works if and only if the field name isn't the same as of the top level entry names or their aliases described above. For example, the following expressions will all evaluate to the same thing:
X would conflict with the name of an entry or alias (e.g. it's moved or maybe parent ), you can prepend the name of the form followed by a dot, as shown in the last example.
ConstantsYou use constants for the values that you compare with fields. Constants are either strings, or numbers. Strings are always delimited by single-quotes (you can escape a quote using backslash). Numbers can be any integer or floating point number. Constants can be supplied by TWikiVariables, such as'%TOPIC%' representing the current topic name.
OperatorsField specifiers and constants are combined using operators to create queries.
Putting it all togetherWhen a query is applied to a topic, the goal is to reduce to a TRUE or FALSE value that indicates whether the topic matches that query or not. If the query returns TRUE, then the topic is included in the search results. A query matches if the query returns one or more values when it is applied to the topic. So if I have a very simple query, such as"attachments" , then this will return TRUE for all topics that have one or more attachments. If I write "attachments[size>1024 AND name ~ '*.gif']" then it will return TRUE for all topics that have at least one attachment larger than 1024 bytes with a name ending in .gif .
Gotcha
ExamplesQuery examples
Search examplesFind all topics that are children of this topic in the current web%SEARCH{"parent.name = '%TOPIC%'" web="%WEB%" type="query"}%Find all topics that have an attachment called 'grunge.gif' %SEARCH{"attachments[name='grunge.gif']" type="query"}%Find all topics that have form ColourForm where the form field 'Shades' is 'green' or 'yellow' but not 'brown'
%SEARCH{"(lc(Shades)='green' OR lc(Shades)='yellow') AND NOT(lc(Shades) ~ 'brown')" type="query"}%Find all topics that have PNG attachments that have been added since 26th March 2007 %SEARCH{"attachments[name ~ '*.png' AND date >= d2n('2007-03-26')]"}%Find all topics that have a field 'Threat' set to 'Amber' and 'cold virus' somewhere in the topic text. %SEARCH{"Threat='Amber' AND text ~ '*cold virus*'"}% | |||||||||||||||||||||||||||||||||||||||||||||||||||
Changed: | |||||||||||||||||||||||||||||||||||||||||||||||||||
< < | Related Topics: IfStatements, SearchHelp, VarSEARCH, FormattedSearch, TWiki:TWiki/QuerySearchPatternCookbook | ||||||||||||||||||||||||||||||||||||||||||||||||||
> > | Related Topics: IfStatements, SearchHelp, VarIF, VarGET, VarSET, VarSEARCH, FormattedSearch, TWiki:TWiki.QuerySearchPatternCookbook | ||||||||||||||||||||||||||||||||||||||||||||||||||
Query SearchQuery searches help you search the contents of forms attached to your topics, as well as the values of other meta-data attached to the topic. Using query searches you can search:
On this page:
Field specifiersYou use field specifiers to say what value from the topic you are interested in. | |||||||||||||||||||||||||||||||||||||||||||||||||
Changed: | |||||||||||||||||||||||||||||||||||||||||||||||||
< < | All meta-data in a topic is referenced according to a to a simple plan. | ||||||||||||||||||||||||||||||||||||||||||||||||
> > | All meta-data in a topic is referenced according to a simple plan. | ||||||||||||||||||||||||||||||||||||||||||||||||
META:TOPICPARENT , META:TOPICINFO etc - are structures which are indexed by keys. For example, META:TOPICINFO has 4 entries, which are indexed by the keys author , date , format and version . META:FILEATTACHMENT , META:FIELD and META:PREFERENCE are all arrays, which means they can have any number of records under them. Arrays are indexed by numbers - for example, the first entry in the META:FIELD array is entry 0. The field specifier arraysize returns the number of items in an array, for example, attachments.arraysize returns the number of attachments.
It's a bit clumsy having to type META:FILEATTACHMENT every time you want to refer to the array of attachments in a topic, so there are some predefined aliases that make it a bit less typing:
fields shortcut when accessing form fields, but always use the name of the form instead.
There is a shortcut for accessing form fields. If you use the name of a field (for example, LastName ) in the query without a . before it, that is taken to mean "the value of the field named this". This works if and only if the field name isn't the same as of the top level entry names or their aliases described above. For example, the following expressions will all evaluate to the same thing:
X would conflict with the name of an entry or alias (e.g. it's moved or maybe parent ), you can prepend the name of the form followed by a dot, as shown in the last example.
ConstantsYou use constants for the values that you compare with fields. Constants are either strings, or numbers. Strings are always delimited by single-quotes (you can escape a quote using backslash). Numbers can be any integer or floating point number. Constants can be supplied by TWikiVariables, such as'%TOPIC%' representing the current topic name.
OperatorsField specifiers and constants are combined using operators to create queries.
Putting it all togetherWhen a query is applied to a topic, the goal is to reduce to a TRUE or FALSE value that indicates whether the topic matches that query or not. If the query returns TRUE, then the topic is included in the search results. A query matches if the query returns one or more values when it is applied to the topic. So if I have a very simple query, such as"attachments" , then this will return TRUE for all topics that have one or more attachments. If I write "attachments[size>1024 AND name ~ '*.gif']" then it will return TRUE for all topics that have at least one attachment larger than 1024 bytes with a name ending in .gif .
Gotcha
ExamplesQuery examples
Search examplesFind all topics that are children of this topic in the current web%SEARCH{"parent.name = '%TOPIC%'" web="%WEB%" type="query"}%Find all topics that have an attachment called 'grunge.gif' %SEARCH{"attachments[name='grunge.gif']" type="query"}%Find all topics that have form ColourForm where the form field 'Shades' is 'green' or 'yellow' but not 'brown'
%SEARCH{"(lc(Shades)='green' OR lc(Shades)='yellow') AND NOT(lc(Shades) ~ 'brown')" type="query"}%Find all topics that have PNG attachments that have been added since 26th March 2007 %SEARCH{"attachments[name ~ '*.png' AND date >= d2n('2007-03-26')]"}%Find all topics that have a field 'Threat' set to 'Amber' and 'cold virus' somewhere in the topic text. %SEARCH{"Threat='Amber' AND text ~ '*cold virus*'"}%Related Topics: IfStatements, SearchHelp, VarSEARCH, FormattedSearch, TWiki:TWiki/QuerySearchPatternCookbook |
Query SearchQuery searches help you search the contents of forms attached to your topics, as well as the values of other meta-data attached to the topic. Using query searches you can search:
On this page:
Field specifiers | |||||||||||||||||||||||||||||||
Added: | |||||||||||||||||||||||||||||||
> > | |||||||||||||||||||||||||||||||
You use field specifiers to say what value from the topic you are interested
in.
All meta-data in a topic is referenced according to a to a simple plan.
| |||||||||||||||||||||||||||||||
Added: | |||||||||||||||||||||||||||||||
> > |
| ||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||
Added: | |||||||||||||||||||||||||||||||
> > |
| ||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||
Added: | |||||||||||||||||||||||||||||||
> > |
| ||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||
Changed: | |||||||||||||||||||||||||||||||
< < | Most things at the top level of the plan - META:TOPICPARENT , META:TOPICINFO etc - are structures which are indexed by keys. For example, META:TOPICINFO has 4 entries, which are indexed by the keys author , date , format and version . META:FILEATTACHMENT , META:FIELD and META:PREFERENCE are all arrays, which means they can have any number of records under them. Arrays are indexed by numbers - for example, the first entry in the META:FIELD array is entry 0. | ||||||||||||||||||||||||||||||
> > | Most things at the top level of the plan - META:TOPICPARENT , META:TOPICINFO etc - are structures which are indexed by keys. For example, META:TOPICINFO has 4 entries, which are indexed by the keys author , date , format and version . META:FILEATTACHMENT , META:FIELD and META:PREFERENCE are all arrays, which means they can have any number of records under them. Arrays are indexed by numbers - for example, the first entry in the META:FIELD array is entry 0. The field specifier arraysize returns the number of items in an array, for example, attachments.arraysize returns the number of attachments. | ||||||||||||||||||||||||||||||
It's a bit clumsy having to type META:FILEATTACHMENT every time you want to refer to the array of attachments in a topic, so there are some predefined aliases that make it a bit less typing:
| |||||||||||||||||||||||||||||||
Changed: | |||||||||||||||||||||||||||||||
< < |
| ||||||||||||||||||||||||||||||
> > |
| ||||||||||||||||||||||||||||||
fields shortcut when accessing form fields, but always use the name of the form instead.
There is a shortcut for accessing form fields. If you use the name of a field (for example, LastName ) in the query without a . before it, that is taken to mean "the value of the field named this". This works if and only if the field name isn't the same as of the top level entry names or their aliases described above. For example, the following expressions will all evaluate to the same thing:
X would conflict with the name of an entry or alias (e.g. it's moved or maybe parent ), you can prepend the name of the form followed by a dot, as shown in the last example.
Constants | |||||||||||||||||||||||||||||||
Deleted: | |||||||||||||||||||||||||||||||
< < | You use constants for the values that you compare with fields. Constants are either strings, or numbers. Strings are always delimited by single-quotes (you can escape a quote using backslash). Numbers can be any integer or floating point number. | ||||||||||||||||||||||||||||||
Added: | |||||||||||||||||||||||||||||||
> > | You use constants for the values that you compare with fields. Constants are either strings, or numbers. Strings are always delimited by single-quotes (you can escape a quote using backslash). Numbers can be any integer or floating point number. Constants can be supplied by TWikiVariables, such as '%TOPIC%' representing the current topic name. | ||||||||||||||||||||||||||||||
OperatorsField specifiers and constants are combined using operators to create queries.
Putting it all together | |||||||||||||||||||||||||||||||
Added: | |||||||||||||||||||||||||||||||
> > | |||||||||||||||||||||||||||||||
When a query is applied to a topic, the goal is to reduce to a TRUE or FALSE value that indicates whether the topic matches that query or not. If the query returns TRUE, then the topic is included in the search results.
A query matches if the query returns one or more values when it is applied to the topic. So if I have a very simple query, such as "attachments" , then this will return TRUE for all topics that have one or more attachments. If I write "attachments[size>1024 AND name ~ '*.gif']" then it will return TRUE for all topics that have at least one attachment larger than 1024 bytes with a name ending in .gif .
Gotcha | |||||||||||||||||||||||||||||||
Deleted: | |||||||||||||||||||||||||||||||
< < |
| ||||||||||||||||||||||||||||||
Added: | |||||||||||||||||||||||||||||||
> > |
| ||||||||||||||||||||||||||||||
ExamplesQuery examples | |||||||||||||||||||||||||||||||
Added: | |||||||||||||||||||||||||||||||
> > | |||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||
Changed: | |||||||||||||||||||||||||||||||
< < |
| ||||||||||||||||||||||||||||||
> > |
| ||||||||||||||||||||||||||||||
Added: | |||||||||||||||||||||||||||||||
> > |
| ||||||||||||||||||||||||||||||
| |||||||||||||||||||||||||||||||
Changed: | |||||||||||||||||||||||||||||||
< < |
| ||||||||||||||||||||||||||||||
> > |
| ||||||||||||||||||||||||||||||
Search examples | |||||||||||||||||||||||||||||||
Added: | |||||||||||||||||||||||||||||||
> > | |||||||||||||||||||||||||||||||
Find all topics that are children of this topic in the current web
%SEARCH{"parent.name = '%TOPIC%'" web="%WEB%" type="query"}%Find all topics that have an attachment called 'grunge.gif' %SEARCH{"attachments[name='grunge.gif']" type="query"}%Find all topics that have form ColourForm where the form field 'Shades' is 'green' or 'yellow' but not 'brown'
%SEARCH{"(lc(Shades)='green' OR lc(Shades)='yellow') AND NOT(lc(Shades) ~ 'brown')" type="query"}%Find all topics that have PNG attachments that have been added since 26th March 2007 %SEARCH{"attachments[name ~ '*.png' AND date >= d2n('2007-03-26')]"}%Find all topics that have a field 'Threat' set to 'Amber' and 'cold virus' somewhere in the topic text. %SEARCH{"Threat='Amber' AND text ~ '*cold virus*'"}% | |||||||||||||||||||||||||||||||
Changed: | |||||||||||||||||||||||||||||||
< < | Related Topics: SearchHelp, VarSEARCH, FormattedSearch, TWiki:TWiki/QuerySearchPatternCookbook | ||||||||||||||||||||||||||||||
> > | Related Topics: IfStatements, SearchHelp, VarSEARCH, FormattedSearch, TWiki:TWiki/QuerySearchPatternCookbook | ||||||||||||||||||||||||||||||
Query SearchQuery searches help you search the contents of forms attached to your topics, as well as the values of other meta-data attached to the topic. Using query searches you can search:
On this page:
Field specifiersYou use field specifiers to say what value from the topic you are interested in. All meta-data in a topic is referenced according to a to a simple plan.
META:TOPICPARENT , META:TOPICINFO etc - are structures which are indexed by keys. For example, META:TOPICINFO has 4 entries, which are indexed by the keys author , date , format and version . META:FILEATTACHMENT , META:FIELD and META:PREFERENCE are all arrays, which means they can have any number of records under them. Arrays are indexed by numbers - for example, the first entry in the META:FIELD array is entry 0.
It's a bit clumsy having to type META:FILEATTACHMENT every time you want to refer to the array of attachments in a topic, so there are some predefined aliases that make it a bit less typing:
fields shortcut when accessing form fields, but always use the name of the form instead.
There is a shortcut for accessing form fields. If you use the name of a field (for example, LastName ) in the query without a . before it, that is taken to mean "the value of the field named this". This works if and only if the field name isn't the same as of the top level entry names or their aliases described above. For example, the following expressions will all evaluate to the same thing:
X would conflict with the name of an entry or alias (e.g. it's moved or maybe parent ), you can prepend the name of the form followed by a dot, as shown in the last example.
ConstantsYou use constants for the values that you compare with fields. Constants are either strings, or numbers. Strings are always delimited by single-quotes (you can escape a quote using backslash). Numbers can be any integer or floating point number.OperatorsField specifiers and constants are combined using operators to create queries.
| |||||||||||||||||||||||||||||||||
Changed: | |||||||||||||||||||||||||||||||||
< < |
| ||||||||||||||||||||||||||||||||
> > |
| ||||||||||||||||||||||||||||||||
Putting it all togetherWhen a query is applied to a topic, the goal is to reduce to a TRUE or FALSE value that indicates whether the topic matches that query or not. If the query returns TRUE, then the topic is included in the search results. A query matches if the query returns one or more values when it is applied to the topic. So if I have a very simple query, such as"attachments" , then this will return TRUE for all topics that have one or more attachments. If I write "attachments[size>1024 AND name ~ '*.gif']" then it will return TRUE for all topics that have at least one attachment larger than 1024 bytes with a name ending in .gif .
Gotcha
ExamplesQuery examples
Search examplesFind all topics that are children of this topic in the current web%SEARCH{"parent.name = '%TOPIC%'" web="%WEB%" type="query"}%Find all topics that have an attachment called 'grunge.gif' %SEARCH{"attachments[name='grunge.gif']" type="query"}%Find all topics that have form ColourForm where the form field 'Shades' is 'green' or 'yellow' but not 'brown'
%SEARCH{"(lc(Shades)='green' OR lc(Shades)='yellow') AND NOT(lc(Shades) ~ 'brown')" type="query"}%Find all topics that have PNG attachments that have been added since 26th March 2007 | |||||||||||||||||||||||||||||||||
Changed: | |||||||||||||||||||||||||||||||||
< < | Searched: attachments[name ~ '*.png' AND date >= d2n('2007-03-26')
Results from TWiki web retrieved at 23:04 (GMT)<--/twikiTopRow--> Query Search Query searches help you search the contents of forms attached to your topics, as well as the values of other meta data attached to the topic. Using query... <--/twikiSummary--> <--/twikiBottomRow--> <--/patternSearchResult--> Number of topics: 1 <--/patternSearchResultCount--> | ||||||||||||||||||||||||||||||||
> > | Searched: attachments[name ~ '*.png' AND date >= d2n('2007-03-26')]
Results from TWiki web retrieved at 23:04 (GMT)<--/twikiTopRow--> Query Search Query searches help you search the contents of forms attached to your topics, as well as the values of other meta data attached to the topic. Using query... <--/twikiSummary--> <--/twikiBottomRow--> <--/patternSearchResult--> Number of topics: 1 <--/patternSearchResultCount--> | ||||||||||||||||||||||||||||||||
Find all topics that have a field 'Threat' set to 'Amber' and 'cold virus' somewhere in the topic text.
%SEARCH{"Threat='Amber' AND text ~ '*cold virus*'"}%Related Topics: SearchHelp, VarSEARCH, FormattedSearch, TWiki:TWiki/QuerySearchPatternCookbook |
Query SearchQuery searches help you search the contents of forms attached to your topics, as well as the values of other meta-data attached to the topic. Using query searches you can search:
On this page:
Field specifiersYou use field specifiers to say what value from the topic you are interested in. All meta-data in a topic is referenced according to a to a simple plan.
META:TOPICPARENT , META:TOPICINFO etc - are structures which are indexed by keys. For example, META:TOPICINFO has 4 entries, which are indexed by the keys author , date , format and version . META:FILEATTACHMENT , META:FIELD and META:PREFERENCE are all arrays, which means they can have any number of records under them. Arrays are indexed by numbers - for example, the first entry in the META:FIELD array is entry 0.
It's a bit clumsy having to type META:FILEATTACHMENT every time you want to refer to the array of attachments in a topic, so there are some predefined aliases that make it a bit less typing:
fields shortcut when accessing form fields, but always use the name of the form instead.
There is a shortcut for accessing form fields. If you use the name of a field (for example, LastName ) in the query without a . before it, that is taken to mean "the value of the field named this". This works if and only if the field name isn't the same as of the top level entry names or their aliases described above. For example, the following expressions will all evaluate to the same thing:
X would conflict with the name of an entry or alias (e.g. it's moved or maybe parent ), you can prepend the name of the form followed by a dot, as shown in the last example.
ConstantsYou use constants for the values that you compare with fields. Constants are either strings, or numbers. Strings are always delimited by single-quotes (you can escape a quote using backslash). Numbers can be any integer or floating point number.OperatorsField specifiers and constants are combined using operators to create queries.
Putting it all togetherWhen a query is applied to a topic, the goal is to reduce to a TRUE or FALSE value that indicates whether the topic matches that query or not. If the query returns TRUE, then the topic is included in the search results. A query matches if the query returns one or more values when it is applied to the topic. So if I have a very simple query, such as"attachments" , then this will return TRUE for all topics that have one or more attachments. If I write "attachments[size>1024 AND name ~ '*.gif']" then it will return TRUE for all topics that have at least one attachment larger than 1024 bytes with a name ending in .gif .
Gotcha
ExamplesQuery examples
Search examplesFind all topics that are children of this topic in the current web%SEARCH{"parent.name = '%TOPIC%'" web="%WEB%" type="query"}%Find all topics that have an attachment called 'grunge.gif' %SEARCH{"attachments[name='grunge.gif']" type="query"}%Find all topics that have form ColourForm where the form field 'Shades' is 'green' or 'yellow' but not 'brown'
%SEARCH{"(lc(Shades)='green' OR lc(Shades)='yellow') AND NOT(lc(Shades) ~ 'brown')" type="query"}%Find all topics that have PNG attachments that have been added since 26th March 2007 %SEARCH{"attachments[name ~ '*.png' AND date >= d2n('2007-03-26')"}%Find all topics that have a field 'Threat' set to 'Amber' and 'cold virus' somewhere in the topic text. %SEARCH{"Threat='Amber' AND text ~ '*cold virus*'"}% | |||||||||||||||||||||||||||||||||||||||||||||||||||
Added: | |||||||||||||||||||||||||||||||||||||||||||||||||||
> > | Related Topics: SearchHelp, VarSEARCH, FormattedSearch, TWiki:TWiki/QuerySearchPatternCookbook | ||||||||||||||||||||||||||||||||||||||||||||||||||
Query SearchQuery searches help you search the contents of forms attached to your topics, as well as the values of other meta-data attached to the topic. Using query searches you can search:
On this page:
Field specifiersYou use field specifiers to say what value from the topic you are interested in. All meta-data in a topic is referenced according to a to a simple plan.
| |||||||||||||||||||||||||||||||||||||||||||||||||
Changed: | |||||||||||||||||||||||||||||||||||||||||||||||||
< < |
| ||||||||||||||||||||||||||||||||||||||||||||||||
> > |
| ||||||||||||||||||||||||||||||||||||||||||||||||
Added: | |||||||||||||||||||||||||||||||||||||||||||||||||
> > |
| ||||||||||||||||||||||||||||||||||||||||||||||||
META:TOPICPARENT , META:TOPICINFO etc - are structures which are indexed by keys. For example, META:TOPICINFO has 4 entries, which are indexed by the keys author , date , format and version . META:FILEATTACHMENT , META:FIELD and META:PREFERENCE are all arrays, which means they can have any number of records under them. Arrays are indexed by numbers - for example, the first entry in the META:FIELD array is entry 0.
It's a bit clumsy having to type META:FILEATTACHMENT every time you want to refer to the array of attachments in a topic, so there are some predefined aliases that make it a bit less typing:
fields shortcut when accessing form fields, but always use the name of the form instead.
There is a shortcut for accessing form fields. If you use the name of a field (for example, LastName ) in the query without a . before it, that is taken to mean "the value of the field named this". This works if and only if the field name isn't the same as of the top level entry names or their aliases described above. For example, the following expressions will all evaluate to the same thing:
X would conflict with the name of an entry or alias (e.g. it's moved or maybe parent ), you can prepend the name of the form followed by a dot, as shown in the last example.
ConstantsYou use constants for the values that you compare with fields. Constants are either strings, or numbers. Strings are always delimited by single-quotes (you can escape a quote using backslash). Numbers can be any integer or floating point number.OperatorsField specifiers and constants are combined using operators to create queries.
Putting it all togetherWhen a query is applied to a topic, the goal is to reduce to a TRUE or FALSE value that indicates whether the topic matches that query or not. If the query returns TRUE, then the topic is included in the search results. A query matches if the query returns one or more values when it is applied to the topic. So if I have a very simple query, such as"attachments" , then this will return TRUE for all topics that have one or more attachments. If I write "attachments[size>1024 AND name ~ '*.gif']" then it will return TRUE for all topics that have at least one attachment larger than 1024 bytes with a name ending in .gif . | |||||||||||||||||||||||||||||||||||||||||||||||||
Added: | |||||||||||||||||||||||||||||||||||||||||||||||||
> > | Gotcha
| ||||||||||||||||||||||||||||||||||||||||||||||||
ExamplesQuery examples
| |||||||||||||||||||||||||||||||||||||||||||||||||
Changed: | |||||||||||||||||||||||||||||||||||||||||||||||||
< < |
| ||||||||||||||||||||||||||||||||||||||||||||||||
> > |
| ||||||||||||||||||||||||||||||||||||||||||||||||
Search examplesFind all topics that are children of this topic in the current web%SEARCH{"parent.name = '%TOPIC%'" web="%WEB%" type="query"}%Find all topics that have an attachment called 'grunge.gif' %SEARCH{"attachments[name='grunge.gif']" type="query"}%Find all topics that have form ColourForm where the form field 'Shades' is 'green' or 'yellow' but not 'brown'
%SEARCH{"(lc(Shades)='green' OR lc(Shades)='yellow') AND NOT(lc(Shades) ~ 'brown')" type="query"}%Find all topics that have PNG attachments that have been added since 26th March 2007 %SEARCH{"attachments[name ~ '*.png' AND date >= d2n('2007-03-26')"}%Find all topics that have a field 'Threat' set to 'Amber' and 'cold virus' somewhere in the topic text. %SEARCH{"Threat='Amber' AND text ~ '*cold virus*'"}% |
Query SearchQuery searches help you search the contents of forms attached to your topics, as well as the values of other meta-data attached to the topic. Using query searches you can search:
On this page:
Field specifiersYou use field specifiers to say what value from the topic you are interested in. All meta-data in a topic is referenced according to a to a simple plan.
META:TOPICPARENT , META:TOPICINFO etc - are structures which are indexed by keys. For example, META:TOPICINFO has 4 entries, which are indexed by the keys author , date , format and version . META:FILEATTACHMENT , META:FIELD and META:PREFERENCE are all arrays, which means they can have any number of records under them. Arrays are indexed by numbers - for example, the first entry in the META:FIELD array is entry 0.
It's a bit clumsy having to type META:FILEATTACHMENT every time you want to refer to the array of attachments in a topic, so there are some predefined aliases that make it a bit less typing:
fields shortcut when accessing form fields, but always use the name of the form instead.
There is a shortcut for accessing form fields. If you use the name of a field (for example, LastName ) in the query without a . before it, that is taken to mean "the value of the field named this". This works if and only if the field name isn't the same as of the top level entry names or their aliases described above. For example, the following expressions will all evaluate to the same thing:
X would conflict with the name of an entry or alias (e.g. it's moved or maybe parent ), you can prepend the name of the form followed by a dot, as shown in the last example.
ConstantsYou use constants for the values that you compare with fields. Constants are either strings, or numbers. Strings are always delimited by single-quotes (you can escape a quote using backslash). Numbers can be any integer or floating point number.OperatorsField specifiers and constants are combined using operators to create queries.
Putting it all togetherWhen a query is applied to a topic, the goal is to reduce to a TRUE or FALSE value that indicates whether the topic matches that query or not. If the query returns TRUE, then the topic is included in the search results. A query matches if the query returns one or more values when it is applied to the topic. So if I have a very simple query, such as"attachments" , then this will return TRUE for all topics that have one or more attachments. If I write "attachments[size>1024 AND name ~ '*.gif']" then it will return TRUE for all topics that have at least one attachment larger than 1024 bytes with a name ending in .gif .
ExamplesQuery examples
Search examplesFind all topics that are children of this topic in the current web%SEARCH{"parent.name = '%TOPIC%'" web="%WEB%" type="query"}%Find all topics that have an attachment called 'grunge.gif' %SEARCH{"attachments[name='grunge.gif']" type="query"}%Find all topics that have form ColourForm where the form field 'Shades' is 'green' or 'yellow' but not 'brown'
%SEARCH{"(lc(Shades)='green' OR lc(Shades)='yellow') AND NOT(lc(Shades) ~ 'brown')" type="query"}%Find all topics that have PNG attachments that have been added since 26th March 2007 %SEARCH{"attachments[name ~ '*.png' AND date >= d2n('2007-03-26')"}%Find all topics that have a field 'Threat' set to 'Amber' and 'cold virus' somewhere in the topic text. %SEARCH{"Threat='Amber' AND text ~ '*cold virus*'"}% |