Searching for files in a folder by property

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-08-2007 12:02 PM
Hi,
I'm trying to call the web services to search a folder to find a file(s) which match a certain criteria.
The property on the file is something like:
Name: {ORS}tenantref Value: 259499
I used the following code to find the folder I need (c#.NET):
reference = new Reference();
.store = spacesStore;
reference.uuid = deptNode.id;
queryResult = repositoryServiceWSE.queryChildren(reference);
foreach (ResultSetRow row in queryResult.resultSet.rows)
{
// Get the name of the node
foreach (NamedValue namedValue in row.columns)
{
if (namedValue.name.Contains("name") == true)
{
if (namedValue.value.Equals(folderName, StringComparison.CurrentCultureIgnoreCase))
{
…
I'm now stuck tring to find the file I want in the folder, I would prefer to do this using a query then looping through all of the files as there may be loads of files.
Can any one provide an example showing how to do this?
Thanks,
Stuart
I'm trying to call the web services to search a folder to find a file(s) which match a certain criteria.
The property on the file is something like:
Name: {ORS}tenantref Value: 259499
I used the following code to find the folder I need (c#.NET):
reference = new Reference();
.store = spacesStore;
reference.uuid = deptNode.id;
queryResult = repositoryServiceWSE.queryChildren(reference);
foreach (ResultSetRow row in queryResult.resultSet.rows)
{
// Get the name of the node
foreach (NamedValue namedValue in row.columns)
{
if (namedValue.name.Contains("name") == true)
{
if (namedValue.value.Equals(folderName, StringComparison.CurrentCultureIgnoreCase))
{
…
I'm now stuck tring to find the file I want in the folder, I would prefer to do this using a query then looping through all of the files as there may be loads of files.
Can any one provide an example showing how to do this?
Thanks,
Stuart
Labels:
- Labels:
-
Archive
3 REPLIES 3
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-10-2007 05:18 AM
I have the same problem. I`m trying to search content via the Web Service API related to a specific property. I have created an own ContentModel with some additional properties. Now i try to search via this properties. If i search only for a some text like:
Query query = new Query(Constants.QUERY_LANG_LUCENE, "TEXT:'anExampleText'");
// Execute the query
QueryResult queryResult = repositoryService.query(STORE, query, true);
i get the Results e.g.:
row 0: {http://www.alfresco.org/model/content/1.0}PLZ = 26188
This is a property, i added to my Content Model. Now i want to search "backwards" e.g. i want to search the property PLZ.
Can anyone post some code examples?
Thx
Query query = new Query(Constants.QUERY_LANG_LUCENE, "TEXT:'anExampleText'");
// Execute the query
QueryResult queryResult = repositoryService.query(STORE, query, true);
i get the Results e.g.:
row 0: {http://www.alfresco.org/model/content/1.0}PLZ = 26188
This is a property, i added to my Content Model. Now i want to search "backwards" e.g. i want to search the property PLZ.
Can anyone post some code examples?
Thx
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-10-2007 07:33 AM
Now i solved the Problem. You only have to change the query statement:
Query query1 = new Query(Constants.QUERY_LANG_LUCENE, "+@\\{http\\://www.alfresco.org/model/content/1.0\\}property1:\'value1\" AND (TYPE:\"{http://www.alfresco.org/model/content/1.0}content\")");
// Execute the query
QueryResult queryResult = repositoryService.query(STORE, query1, true);
Query query1 = new Query(Constants.QUERY_LANG_LUCENE, "+@\\{http\\://www.alfresco.org/model/content/1.0\\}property1:\'value1\" AND (TYPE:\"{http://www.alfresco.org/model/content/1.0}content\")");
// Execute the query
QueryResult queryResult = repositoryService.query(STORE, query1, true);

Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-13-2007 06:17 AM
Hi, I solved my issue too by using the following code:
Query query = new Query();
query.language = "lucene"; // 2 types "lucene and xpath"
query.statement = "+PARENT:\"workspace://SpacesStore/" + schema.id + "\"" + "+@ors\\:tenantref:259499";
result = repositoryServiceWSE.query(spacesStore, query, true);
Query query = new Query();
query.language = "lucene"; // 2 types "lucene and xpath"
query.statement = "+PARENT:\"workspace://SpacesStore/" + schema.id + "\"" + "+@ors\\:tenantref:259499";
result = repositoryServiceWSE.query(spacesStore, query, true);
