Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Web CMS (TeamSite)
Searching by folder with SOAP?
donundeen
Hi, I'm implementing some calls against the MediaBin SOAP webservice.
I've searching against a few metadata fields, which is working fine.
However, I also want to search against the FOLDER that an asset (or asset reference) is located in.
For example, I've got an asset, named
Map_of_Baltimore_1869.jpg,
in the Mediabin folder:
\Non-Curatorial Departments\IS&T\AmericanKiosk (GUID: {B542432C-F421-4AC7-98C0-9AF6B1362F75} )
It's also got two metadata fields:
AmKioskFilename ( {421F03D3-D889-40D1-8997-7A11D874BB62} )
and
AmKioskFilepath ( {2446BF1D-EFBB-4A4F-B7EC-BBE0C00B50BA} )
My code (C# .net ) currently looks like, can anyone show my how I'd add to the search, a check that it's in the specified folder? Thanks in advance:
MBAsset[] assets = null;
MBSearchCriteria criteria = new MBSearchCriteria();
criteria.mRecursive = true;
MBSearchConstraint constraint;
ArrayList constraints = new ArrayList();
constraint = new MBSearchConstraint();
MBMetadata fileMeta = new MBMetadata();
fileMeta.mID = amWingFilenameGuid;
fileMeta.mValue = filename;
constraint.mMetadata = fileMeta;
constraint.mSearchOperator = "Equality";
constraint.mBooleanOperator = MBBooleanOperator.AND;
constraints.Add(constraint);
MBMetadata pathMeta = new MBMetadata();
pathMeta.mID = amWingPathGuid;
pathMeta.mValue = path;
constraint.mMetadata = pathMeta;
constraint.mSearchOperator = "Equality";
constraint.mBooleanOperator = MBBooleanOperator.AND;
constraints.Add(constraint);
// search within the AmericanKiosk collection only:
// How is this done?
criteria.mSearchConstraints = (MBSearchConstraint[])constraints.ToArray(typeof(MBSearchConstraint));
assets = service.Search(criteria, true);
Find more posts tagged with
Comments
msrinivas
GetParentContainer method will get you the parent container/folder of any asset. Is that what you are looking for?
donundeen
I don't think so.
I'm trying to FIND the assets that are IN a particular Container.
ie, "Return all assets that have AmWingPath="Baltimore" AND AmWingFilename="smileyFace.jpg" AND are in Container "AmericanKiosk"
it's the "AND are in Container "AmericanKiosk" " part I don't know how to express.
donundeen
hmm, is it just a matter of setting the mContainerID on the MBSearchCriteria object:
ie in the above code:
// search within the AmericanKiosk collection only:
// How is this done?
criteria.mSearchConstraints = (MBSearchConstraint[])constraints.ToArray(typeof(MBSearchConstraint));
// add:
criteria.mContainerID = americanKioskGuid;
hidecolumn.rptdesign
msrinivas
You are correct:
Properties
- string mContainerID
[indent]The GUID of the container to search. Default: null
[/indent]- string mAssetID
[indent]The GUID of the asset to sort search results. (CBIR Search). Default: null
[/indent]- bool mRecursive
[indent]If true, the search will include all subcontainers. Default: true
[/indent]- MBSearchConstraint[ ] mSearchConstraints
[indent]An array of MediaBin search constraints. Default: null
[/indent]- int mMaxHits
[indent]The maximum number of assets to return in the search results. Default: 10
[/indent]
lyman
To be clear, the search API's let you root the search at a starting container and determine whether you want to make the search recursive or not. It does not allow you to mix and match properties of a container and an asset (e.g., find me all jpegs in containers named "in progress").
You can search for containers based on their properties or assets based on their properties but not both simultaneously (well, the clients do expose a "search both" option but it is simply issuing two searches under the covers).
Cheers,
Lyman