cancel
Showing results for 
Search instead for 
Did you mean: 

Best performance searching node

spilby
Confirmed Champ
Confirmed Champ
Hi,

I need to search a node in my Alfresco repository, with the Alfresco Java API. I have a initial path where I must begin to search, and a property value to find.

My repository will be big, because of this, I need the search quick and efficient.

There are various methods to implement this search. For example, SearchService have these ones: selectNodes and query.

getSearchService().selectNodes(root, path, null, this.serviceRegistry.getNamespaceService(), false);

getSearchService().query(WORKSPACE_SPACESSTORE, SearchService.LANGUAGE_LUCENE, query);

Use the SearchService are a good idea? Better others? And which one is better, selectNodes or query? Do you know the difference?. 

Thanks!
6 REPLIES 6

mitpatoliya
Star Collaborator
Star Collaborator
This should work efficiently for you.
getSearchService().query(WORKSPACE_SPACESSTORE, SearchService.LANGUAGE_LUCENE, query);

But main performance will be depend your query.If you combine path query and property queries it will give good performance.

romschn
Star Collaborator
Star Collaborator
As per my knowledge, PATH queries are slow when it comes to performance. You may want to use TYPE query with properties it would be fast compare to PATH queries if you do not want explicitly search from some specific PATH.

mitpatoliya
Star Collaborator
Star Collaborator
Yes, I do agree with Ramesh, TYPE queries are faster then PATH queries.
Provided you do not have idea within which path your contents are stores(which you seems to have in this case as you have mentioned) and if you want to search content of only certain type.

Thanks for all the answers! Smiley Surprised) My query is more or less this:

PATH: "/app:company_home/app:user_homes/cm:rootFolder/cm:folder2" AND @exp\:exposition_number:"123" AND TYPE: "{project.size.model}margin"

I have an initial path from which begin to search (before the search, I know if it begins from folder1, folder2, …, or folderN, where N is 500). The tree of subfolders are pretty big, thousand of subfolders from each of these N folders.

My query combines a PATH (I imagine is better to include, although TYPE is faster, to discard primary folders in which I don't need to search), a TYPE and a own property exposition_number.

You see it ok? The order of the elements in the query (PATH, property and TYPE) is important for the performance?

Thanks again!

spilby
Confirmed Champ
Confirmed Champ
Any suggerence about this problem, please?

mrogers
Star Contributor
Star Contributor
Search is an area of considerable change at the moment.    Has been for the last couple of releases and will be for the next few.   That will mean there's a possibility of one approach "leapfrogging" another.

However you need to target a particular version so I suggest you just benchmark each approach and see what's best.