-1

Category Name | Geograpy (8) Study Db (18)

i am implement my own advance search in alfresco. i need to read all files which related with particular category.

example:

if there is 20 file under geograpy, lucene query should read particular document under search key word "banana".

Further explanation - I am using search.lib.js to search. I would like to analyze the result to find out to which category the documents belong to. For example I would like to know how many documents belong to the category under Languages and the subcategories. I experimented with the Classification API but I don't get the result I want. Any Idea how to go through the result to get the category name of each document?

is there any simple method like node.properties["cm:creator"]?

thanks

janaka

HWJ
  • 87
  • 2
  • 9
  • Unfortunately your question doesn't make much sense. Can you clarify your data and what you expect to see given a certain input? Also, what do you actually want from us? Java code for a webscript? A lucene query? – Mardoz Jul 25 '14 at 08:51

2 Answers2

0

I think you should specify more your question:

  1. Are you using cm:content or a customized content?
  2. Are you going to search the keyword inside the content of the file? or are you going to search the keyword in a specific metadata(s)?
  3. Do you want to create a webscript (java or javascript)?

One thing to take in consideration:

if you use +PATH:"cm:generalclassifiable/...." for the categorization in your lucene queries, the performance will be slow (following my experince)

Yon Santos
  • 121
  • 1
  • 4
  • thanks Yon santos for reply my question I am using search.lib.js to search. I would like to analyze the result to find out to which category the documents belong to. For example I would like to know how many documents belong to the category under Languages and the subcategories. I experimented with the Classification API but I don't get the result I want. Any Idea how to go through the result to get the category name of each document? – HWJ Aug 05 '14 at 08:19
  • is there any simple method like node.properties["cm:creator"]? – HWJ Aug 05 '14 at 09:18
0

You can use for example the next query to find all nodes at any depth below /cm:Languages:

var results = search.luceneSearch("+PATH:\"cm:generalclassifiable/cm:Languages//*\");

Take a look to this url: https://wiki.alfresco.com/wiki/Search#Path_Queries

Once you have all the elements, you can loop all, and get to which category below. Of course you need to create some counter per each category/subcategory:

for(i = 0; i < results.length; i++){
    var node = results[i];
    var categoryNodeRef = node.properties["cm:categories"];
    var categoryDesc = categoryNodeRef.properties["cm:description"];
    var categoryName = categoryNodeRef.properties["cm:name"];
}

This is not exactly the solution, but can be a useful idea to start.

Sorry if it's not what you're asking for, I have just arrived from my holidays.

Yon Santos
  • 121
  • 1
  • 4