This question about Using an extension: Answered

DBQUERY for topics with MetaDataPlugin data value

I am trying to figure out how to do a DBQUERY search that finds topics with an MetaDataPlugin record having a specific value.

I've tried something along the lines of
%DBQUERY{"metadatakey.FieldName = 'Some value'"}%
which works if there's only a single meta data entry but fails if there is more than one.

I also tried this:
%DBQUERY{"metadatakey[name='FieldName' AND value='Some value']"}%
which did not seem to work.

I'm pretty sure there would be syntax for this but can't figure it out.

-- LynnwoodBrown - 22 Aug 2022

I tried query-type SEARCH in this format and it worked:
%SEARCH{"metadatakey.FieldName = 'Some value'"
   type="query"
   web="Test"
   nonoise="on"
   format="   * $web.$topic"
   separator="$n"
}%

Wonder why I can't get similar query to work with DBQUERY?

-- LynnwoodBrown - 22 Aug 2022

Try

%DBQUERY{
   "FieldNAme='Some Value'"
   context="metadatakey"
}%

context="..." may be the name of any hash generated by DBCacheContrib such as attachments or custom metadata via MetaDataPlugin or MetaCommentPlugin etc. Queries are then executed within the given context.

Will add it to the docu in the next release.

-- MichaelDaum - 23 Aug 2022
 

QuestionForm edit

Subject Using an extension
Extension MetaDataPlugin
Version Foswiki 2.1.7
Status Answered
Related Topics
Topic revision: r3 - 23 Aug 2022, MichaelDaum
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