How to delete file link whose destination is NULL?
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-26-2012 02:58 AM
Hi,
I want to delete all file links whose destination is NULL. I tried through Lucene query to get all Links which is:
TYPE:"app:filelink" AND ISNULL:"cm:destination"
The above query doesn't work for me. It returns 0 rows.
The other approach is get all file links by TYPE:"app:filelink" in ResultSet and do iteration using for loop to check if destination is null, which is not the best way.
Please help me on this.
I want to delete all file links whose destination is NULL. I tried through Lucene query to get all Links which is:
TYPE:"app:filelink" AND ISNULL:"cm:destination"
The above query doesn't work for me. It returns 0 rows.
The other approach is get all file links by TYPE:"app:filelink" in ResultSet and do iteration using for loop to check if destination is null, which is not the best way.
Please help me on this.
Labels:
- Labels:
-
Archive
5 REPLIES 5
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-26-2012 09:28 AM
This will server your purpose I guess.
TYPE:"app:filelink" NOT ISNOTNULL:"cm:destination"
TYPE:"app:filelink" NOT ISNOTNULL:"cm:destination"
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-27-2012 04:53 AM
Hi Mittal,
Thanks for your reply. This query TYPE:"app:filelink" NOT ISNOTNULL:"cm:destination" didn't worked.
Thanks for your reply. This query TYPE:"app:filelink" NOT ISNOTNULL:"cm:destination" didn't worked.


Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-30-2012 08:48 AM
Hi,
I'm not really familiar with links, but having a glance to the models in Alfresco, the one with the cm:destination is not app:filelink, but cm:link…
So based on that, shouldn't the query look like the following?
Regards,
Adei
I'm not really familiar with links, but having a glance to the models in Alfresco, the one with the cm:destination is not app:filelink, but cm:link…
So based on that, shouldn't the query look like the following?
TYPE:"cm:link" AND ISNULL:"cm:destination"
Regards,
Adei
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-30-2012 10:02 AM
Hi Adie,
Thanks for your reply.
My problem got resolved by creating fresh new indexes.
The below query will also work because cm:link is parent for app:filelink. But this query will return all File links as well as Folder links. If you want only filelinks then, use TYPE:"app:filelink" and for folderlinks use TYPE:"app:folderlink"
Type cm:link is defined in contentModel.xml file as:
Type app:filelink & app:folderlink are defined in applicationModel.xml file as:
So, to find all links whose destination is NULL, Execute any of the below queries:
Thanks once again.
Thanks for your reply.
My problem got resolved by creating fresh new indexes.


The below query will also work because cm:link is parent for app:filelink. But this query will return all File links as well as Folder links. If you want only filelinks then, use TYPE:"app:filelink" and for folderlinks use TYPE:"app:folderlink"
TYPE:"cm:link" AND ISNULL:"cm:destination"
Type cm:link is defined in contentModel.xml file as:
<type name="cm:link"> <title>Link Object</title> <parent>cm:cmobject</parent> <properties> <property name="cm:destination"> <title>Link Destination</title> <type>d:noderef</type> <mandatory>true</mandatory> </property> </properties> </type>
Type app:filelink & app:folderlink are defined in applicationModel.xml file as:
<type name="app:filelink"> <title>File Link Object</title> <parent>cm:link</parent> </type> <type name="app:folderlink"> <title>Folder Link Object</title> <parent>cm:link</parent> </type>
So, to find all links whose destination is NULL, Execute any of the below queries:
// Returns only File links whose destination is NULL.1) TYPE:"app:filelink" AND ISNULL:"cm:destination"2) TYPE:"app:filelink" AND NOT ISNOTNULL:"cm:destination"3) TYPE:"app:filelink" AND ISUNSET:"cm:destination"// Returns only Folder links whose destination is NULL.1) TYPE:"app:folderlink" AND ISNULL:"cm:destination"2) TYPE:"app:folderlink" AND NOT ISNOTNULL:"cm:destination"3) TYPE:"app:folderlink" AND ISUNSET:"cm:destination"// Returns all File links & Folder links whose destination is NULL.1) TYPE:"cm:link" AND ISNULL:"cm:destination"2) TYPE:"cm:link" AND NOT ISNOTNULL:"cm:destination"3) TYPE:"cm:link" AND ISUNSET:"cm:destination"
Thanks once again.

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-30-2012 10:07 AM
True! didn't check the parent for the app:filelink…
