cancel
Showing results for 
Search instead for 
Did you mean: 

problem in searching content on a particular node

inderjeet_kalra
Champ in-the-making
Champ in-the-making
Hi,
I am just trying to search the content on the particular node like i have the following hierarcy in saving the content.

workspace->SpacesStore->Fund (Container)>user1(folder) – Fund Content (content node).

now i want to search on any node like on Fund node only or only user1 node only or the complete spacestore…i have put the following query but i am not getting the expected result…

"TYPE:\"{http://www.alfresco.org/model/content/1.0}content\''+
" AND (@\\"+"{http\\"+"://www.alfresco.org/model/content/1.0\\}name:Fund Content))"+
" AND (TYPE:\"{http://www.alfresco.org/model/system/1.0}container\''+
" AND (@\\"+"{http\\"+"://www.alfresco.org/model/content/1.0\\}name:Fund))";

can i pass any Nodereference in place of store reference parameter in the query method…..

Please help me out in understanding the logic behind the query mechanism which API follows….

Thanks in advance
6 REPLIES 6

jmliege
Champ in-the-making
Champ in-the-making
Hi,

You can pass a node ID as a String value, the attribute in the query is 'node-uuid' (instead of name attribute for example).

I think you should try a step-by-step approach to enhance your query:

I'm doing it the following way (I use StringBuffer..)


StringBuffer sb = new StringBuffer(32)
.append("TYPE:\"{").append(NamespaceService.CONTENT_MODEL_1_0_URI).append("}content\" ")
.append("+@").append(CONTENT_MODEL_PREFIX).append("\\:name:\"Fund Content\"");


Regards,
JMarc

bindiya
Champ in-the-making
Champ in-the-making
Hi

I use following query to search content based on their TITLE as well as TEXT in the document. But this returns result only contents and files with the specified TITLE, it ignores TEXT search.
Is anything wrong with my query?

StringBuffer sb = new StringBuffer();
sb.append("TYPE:\"{").append(NamespaceService.CONTENT_MODEL_1_0_URI).append("}content\" ") ;
sb.append("+@").append(NamespaceService.CONTENT_MODEL_PREFIX).append("\\:title:"test"   TEXT:"test");

Query query = new Query(Constants.QUERY_LANG_LUCENE, sb.toString());

Thanks
Bindiya

jmliege
Champ in-the-making
Champ in-the-making
At a quick glance (still on holiday…), try to add a plus sign before TEXT and you missed also some \ before the double quote in your string.

("\\:title:\"test\" +TEXT:\"test\"");

For more on this topic, i suggest you take a glance at the following url:

http://wiki.alfresco.com/wiki/Search_Documentation#Lucene_Language

Happy new year.
Jean-Marc

bindiya
Champ in-the-making
Champ in-the-making
Thanks for the reply.
Sorry for earlier query, there was mistake while pasting the query.

I tried these queries but no luck

sb.append("TYPE:\"{").append(NamespaceService.CONTENT_MODEL_1_0_URI).append("}content\" ") ;
sb.append("+@").append(NamespaceService.CONTENT_MODEL_PREFIX).append("\\:title:'test' +TEXT:'test' ");

sb.append("TYPE:\"{").append(NamespaceService.CONTENT_MODEL_1_0_URI).append("}content\" ") ;
sb.append("+@").append(NamespaceService.CONTENT_MODEL_PREFIX).append("\\:title:'test' OR TEXT:'test' ");

If OR is used in the query it returns content which contains "test" in file title. And if  + is used in the query it retruns no result. It seems like when + sign is used, it should satisfy both title as well as text condition.
But my requirement is to fetch all SPACES and CONTENT which either has "test" in the Title as well as "test" in text content of the file.

Thanks,
Bindiya

jmliege
Champ in-the-making
Champ in-the-making
Hello,

your query should contain also an 'OR' with the 'folder' TYPE.

+ means AND
- means AND NOT
(nothing) means OR

See http://wiki.alfresco.com/wiki/Search#Combined_Queries for more explanations on this topic.

I would suggest you to use the search function of the FileFolderService.

See http://dev.alfresco.com/resource/docs/java/repository-service-api/org/alfresco/service/cmr/model/Fil...

By the way, don't hesitate to watch what's behind the scene (in Alfresco code I mean) for this function.
It will help you to create your own queries with no doubt, and that's for free…  :wink:

Best regards.
JMarc

bindiya
Champ in-the-making
Champ in-the-making
Thanks a lot.

Bindiya