cancel
Showing results for 
Search instead for 
Did you mean: 

Alfresco FTS

alubachkin
Champ in-the-making
Champ in-the-making
Hello,

I am trying to create web script for searching in Alfresco. Below is hte java script code of my web script:

function main()
{
   var text = args["text"];
   var name = args["name"];
   logger.log(text);
  
   var query = "TEXT:" + (text == null ? "*" : text) + "cm:name:" + (name == null ? "*" : name);
  
   var def =
   {
      store: "workspace://SpacesStore",
      query: "TEXT:" + text + " cm:name:" + name,
      language: "fts-alfresco"
   };
   var nodes = search.query(def);
  
   model.data = { "items": nodes };
}

main();

And in this scope I have 2 questions:

1. I need to have the possibility to do single site search. How can I do it? My thoughts were about the store. Every folder is represented with some store, but I don't know how I can identify the store of my folder. Could anyone show the right example?

2. I need to do the search on several properties. What is the right syntax? in the case that I've created the query works in the way that these two conditions (query: "TEXT:" + text + " cm:name:" + name) are with OR operator. But I need them to be with AND operator.

Thanks for your replies.
1 REPLY 1

abarisone
Star Contributor
Star Contributor
Hi,
here you can find info you need about full text searching http://wiki.alfresco.com/wiki/Full_Text_Search_Query_Syntax

Regards,
Andrea