cancel
Showing results for 
Search instead for 
Did you mean: 

Lucene search with FreeMarker

simon
Champ in-the-making
Champ in-the-making
Alfresco,

I'm trying to show all the subspaces of a given space but when I do this with Freemarker it returns an extra folder. This folder is empty and has no properties whatsoever. The folder opens in the web client (but is empty) and Alfresco crashes when I try to open the details of this space.

The Lucene search looks like this:
( PATH:"/app:company_home/cm:Some_x0020_Folder/cm:SomeOtherFolder/cm:Presentations/*" ) AND ( TYPE:"{http://www.alfresco.org/model/content/1.0}folder" )
Result with FreeMarker and companyhome.childrenByLuceneSearch or companyhome.childrenBySavedSearch:
    - 168804d6-fb96-11da-a82c-4fa8d7c49110
    - Space 1
    - Space 2
    - Space 3
Result with the same SavedSearch in the web client:

    - Space 1
    - Space 2
    - Space 3
Where does this inconsistency come from?
4 REPLIES 4

simon
Champ in-the-making
Champ in-the-making
I found the problem! The strange folder that shows up is a systemfolder but for some reason it shows up when you search on the folder type as well (is systemfolder a subtype of folder?). So I changed the query to:
"(PATH:\"/app:company_home/cm:Some_x0020_Folder/cm:SomeOtherFolder/cm:Presentations/*") AND (TYPE:\"{http://www.alfresco.org/model/content/1.0}folder\" NOT TYPE:\"{http://www.alfresco.org/model/content/1.0}systemfolder\")"
and it works fine now.

Still think there is an inconsistance (why doesn't this folder show up in the web client with exactly the same Lucene search) but fine, problem solved.

kevinr
Star Contributor
Star Contributor
Well spotted Smiley Happy In the client we specifically filter out "system folders" from the results of browsing and searching within folders. So you have done the correct thing with modifying your query to remove the system folder from the search.

Thanks,

Kevin

nyronian
Champ in-the-making
Champ in-the-making
Is there anyway to NOT have the LUCENE search return subtypes?  I may need to change the way I do my model but I designed assuming I could retreive all nodes of a certain TYPE, I was not interetested in their subtypes unless I request them.

The more I think of it, maybe my concept is wrong.  I designed my model such that if Type A should only have children of Type B  and Type B should only have children of Type C, I set it up like a Tree Structure:

    
A
  – > B
         –> C

      <type name="webc:A">
         <title>A</title>
         <parent>cm:folder</parent>
      </type>
      <type name="webc:B">
         <title>B</title>
         <parent>webc:A</parent>
      </type>
      <type name="webc:C">
         <title>C</title>
        <parent>webc:B</parent>
      </type>

But now I'm doing a search looking for all of Type A and I receive Types A, B and C.  Is my concept wrong?  Should I use aspects instead?  Should I not set the parent (or set them all as Folder)? I have spent quite a bit of time flip-flopping between types and aspects and really understanding when each should be used. 

any thoughts?

Thanks,
Jim

andy
Champ on-the-rise
Champ on-the-rise
Hi

Try EXACTTYPE instead of TYPE.

Andy