Alfresco: Search all nodes without parents - alfresco

I'd like to know how to get all nodes of a given type ts:folderSet which has no parent association of type ts:FolderSubSet informed.
Currently:
So, I mean, I need all nodes of type ts:folderSet where tsfss:folderSubSet-folder is null or not informed.
Currently, I'm using admin tool in order to build this query, but I'll need to use it into a java code.
So I mean, I can use FTS or lucene...
Any ideas?

If your parent type is different you can do:
+TYPE:"ts:folderSet"

The problem is that the PARENT keyword in search uses the primary parent. Your ts:folderSubSet object is a secondary parent to your ts:folderSet object. I don't think you will be able to write a single query that can find instances of ts:folderSet that do not have an instance of ts:folderSubSet as a secondary parent.
You can write a query that returns ts:folderSet objects and then you can iterate over each one of the results checking its list of parents for the secondary object. Not ideal, but it is probably the best you can do.

You can search for a type of nodes using the following Lucene query
TYPE:"cm:folder"

Related

kotlin firebase remove child

I'm trying to delete a specific value from a firebase realtime database, but I don't know how to do it because I don't know to save or find the key value of the child which is automatically generate.
If you see the picture I've only managed to remove all the children from the first key with
FirebaseDatabase.getInstance().reference.child("Comentarios").removeValue()
But I need to delete just by the child creadoPor
Is there any way of skkiping an unnamed child?
FirebaseDatabase.getInstance().reference.child("Comentarios").removeValue()
But I need to delete just by the child creadoPor.
Since you know the "grantparent" key of the data and the value of one of the nodes properties, you can use a query to find the nodes that match that value.
FirebaseDatabase.instance
.ref("Comentarios")
.child("-NGi7xP...")
.orderByChild("creadoPor")
.equalTo("R7lji3...")
When you get the DataSnapshot from the query, you'll need to loop over its children as shown in the documentation on listening for value events. Even when there's only one result, you'll get a list of one child node and thus will need to loop over them.

How to select a document whit a specific child in Alfreso?

I have a set of documents where some of them have a child (associtaion type "ecmccontent:content_origin") and some of them don't have such child association. I need a result set of documents without such association, how to do that (in any query language)?
Thank you!
There's no way to query for associations, unfortunately.
What you can do is setup a property or an aspect - at the same time when you create the association - and then query for that property/aspect.
find nodes with a specific child association

Gremlin find all vertices that have "any" property with a given value

The properties in my graph are dynamic. That means, there can be any number of properties on the vertices. This also means that, when I do a search, I will not know what property value to look for. Is it possible in gremlin to query the graph to find all vertices that have any property with a given value.
e.g., with name and desc as properties. If the incoming search request is 'test', the query would be g.V().has('name', 'test').or().has('desc', 'test'). How can I achieve similar functionality when I do not know what properties exist? I need to be able to search on all the properties and check if any of those properties' value is 'test'
You can do this using the following syntax:
g.V().properties().hasValue('test')
However, with any size dataset I would expect this to be a very slow traversal to perform as it is the equivalent of asking an RDBMS "Find me any cell in any column in any table where the value equals 'test'". If this is a high frequency request I would suggest looking at refactoring your graph model or using a database optimized for searches such as Elasticsearch.

Tinkerpop: Creating nested Properties

I want to create a Vertex of label foo, which contains a property child. Child property will have two properties A, B. Child in itself can contain more nested children.
If vertex foo is deleted, its all properties including child property should be deleted. My query pattern would be to query all vertexes of label foo which has property A = 'bar'
This can be easily represented by representing the child as vertices instead of property, but then the child has to be deleted by doing dfs/bfs originating from vertex foo. This is proving a costly affair. If childs are saved as property, drop operation will be saved of dfs/bfs.
How do I create nested properties and how can I query them using apache tinkerpop. Is there any other data model I can adopt to reduce the query cost.
Neptune does not support meta properties. Even if it would, you should not have used them. If you have hierarchical structure, and you already use a graph DB, then you should benefit from its capabilities.
If just storing nested properties is your need, maybe you should look at document DB instead.
Deleting a child vertex should not be an expensive operation:
g.V(child_id).emit().repeat(out()).drop()

How do I search only first object in an array of nested objects using ElasticSearch

I'm using ElasticaBundle and ElasticSearch with Symfony2 in a system I've written.
A 'person' can have many 'positions' in their work history. The positions are sorted by date desc, and in order to find someone's current position with PHP I retrieve and read the first object in the array.
I am struggling to search only the current or first position using ElasticSearch. I have set the mappings upas nested, and I am able to perform a Nested Query returning a 'person' who has a 'position' that matches all my criteria. What I can't do is work out how to only search for the criteria in the 1st listed 'position'. Does anyone have any ideas to set me off on the right path?
The only options I can think of at the moment are:
maintain an order value in each object so I can pick out the 1st,
or create another field in the entity that only has a relationship, with the 1st position
I've read on the ElasticSearch documentation that this kind of key isn't supported in ElasticSearch, but now I can't find the page in question. Sorry.
In the end I got round by the problem by setting an identifier on the current position, i.e. giving it a identifier of 0 with all other positions numbers in order.

Resources