0

What would be the MQL query if I want to search for a property that has a particular string either in its name or the actual link path. For name, I was able to put a ~= matching on the name property, but not in the link path. I tried to use the ~= in the id, but it says we cannot do matching in the id.

[{

"/type/object/id": "wikipedia", "name~=": "wikipedia", "/type/object/type": "/type/property", "/type/object/name": null "limit": 200 }]​

Is there a way to also search for strings in the id ?

London guy
  • 27,522
  • 44
  • 121
  • 179

1 Answers1

1

A couple of things:

  • the ~= operator works on a whole word basis, so if you want to find the string "wikipedia" in all contexts, you'll want to use "*wikipedia*"
  • IDs aren't stored with fully formed paths, instead they're a sequence of keys in their respective namespaces (think filenames in directories)

You'll need two separate queries to match both the properties and their containing domains since you can't do unions like that in MQL.

For properties who's names contain wikipedia:

[{
  "type": "/type/property",
  "name~=" : "*wikipedia*",
  "name": null,
  "id":null,
  "limit":         200
}]​

and for properties which belong to types who's IDs contain wikipedia:

[{
  "type": "/type/property",
  "name": null,
  "id":null,
  "schema" : {"key":{"namespace":{"name~=":"*wikipedia*"}},"id":null},
  "limit":         200
}]​

That second query may need a little refinement, but it should give you the basic idea.

Tom Morris
  • 10,490
  • 32
  • 53
  • If the original comment about wildcards didn't make any sense, it's because the markup ate my asterisks. I've restored them to the text. – Tom Morris Nov 28 '12 at 22:04