cancel
Showing results for 
Search instead for 
Did you mean: 

Alfresco Share Advanced Search Customization

gwad
Champ in-the-making
Champ in-the-making
Hi,

I have followed this example exactly as mentioned: http://wiki.alfresco.com/wiki/Share_Advanced_Search , to configure my Alfresco Advanced Search screen. I am able to select the 'SOP Document' from the 'Look for:' menu as well, and able to see my custom fields. However, not even the 'Keywords' field is searchable through this template. Why is that? If I select 'Content' from the 'Look for:' menu, then the search is perfect. It seems to me that the example has just created a dummy screen that doesn't actually do anything.

How do I give this new form some searching capability?

Note: I have noticed that when I select my new form and search, the last part of the URL contains "datatype":"my:sop". If I manually changed this to "datatype":"cm:content" and press Enter, the results appear. Seems to tell me that the problem lies in this area.

Any help would be greatly appreciated.

Regards,

Gwad
23 REPLIES 23

gwad
Champ in-the-making
Champ in-the-making
Seriously, not even 1 reply??? All I want to know is why is the example as mentioned in the URL creating a dummy search screen for me instead of an actual one! I'm surprised that not even 1 person can give me a reply….or even as much as a HINT….as to why this could be happening!

Doesn't anyone bother trying the examples around here?

loftux
Star Contributor
Star Contributor
No answer may be because your question/problem is not to clear, at least not besides getting no results. So it is not to easy to know where to start helping you. Since most of us helping out in this forum is doing this with no pay the best we can, your tone implying your question is the most important and easy to answer is, well not the best way to get help.
Lets try anyway
- Do you have content of type my:sop in your repository? That is, have you done specialise type?
- What does your search form look like, and what is the data model for my:sop. Paste in reply between code tags.
- What search terms do you use?
- can you paste the resulting url of your search in the reply
Doesn't anyone bother trying the examples around here?
What examples?

gwad
Champ in-the-making
Champ in-the-making
Hi Loftux,

Thanks for the reply.

Regarding your points:
- I have defined a content type my:sop, as mentioned in the following URL: http://wiki.alfresco.com/wiki/Data_Dictionary_Guide#Step_2:_Create_a_new_Content_Type
- My search form looks like the last screenshot in the following URL: http://wiki.alfresco.com/wiki/Share_Advanced_Search . The data model I'm using is here: http://svn.alfresco.com/repos/alfresco-open-mirror/alfresco/HEAD/root/projects/repository/config/alf... . As I mentioned, I have done exactly what the example there shows, and I'm able to see the search screen as well.
- Here is where the problem is, as you can see from my screen, it shows 'SOP Document' in the 'Look for:' menu and hence is the reason I'm able to see my customized search screen, but I can search for absolutely nothing using this form. I have a jpeg image with the 'Name' metadata as 'passport'. So when I type 'passport' in the 'Name' field and click on 'Search' I get the message '0 result(s) found in the repository.' However this same 'Name' field can be seen even when I select 'Content' in the 'Look for:' menu. Through that when I search for 'passport' in the 'Name' field I get '1 result(s) found in the repository'.

My 'SOP Document' form URL after hitting the 'Search' button: http://localhost:8080/share/page/search?t=&q={%22prop_cm_name%22%3A%22passport%22%2C%22prop_my_publi...}

'Content' form URL after hitting the 'Search' button: http://localhost:8080/share/page/search?t=&q={%22prop_cm_name%22%3A%22passport%22%2C%22prop_cm_title...}

Thanks,

Gwad

loftux
Star Contributor
Star Contributor
But have you made sure that the jpeg is of type my:sop? From what I can tell it is still cm:content.

In share-config-custom.xml, add (section is in the sample file if I remember correctly)

      <types>
         <type name="cm:content">
          <subtype name="my:sop" />
         </type>

         <type name="cm:folder">
         </type>
      </types>
Then restart. Navigate to your document, document details, and select change type.

After this, your search should work, because it is now actually of type my:sop

gwad
Champ in-the-making
Champ in-the-making
Hi Loftux,

Bingo! That the solution to my problem, thanks a lot for that.

Although now I have another small issue. I have a field called 'hr:empID' in my HR template and I have mentioned the index for a document as 'EMP0001' for this field. Through the Advanced Search, when I select my HR template in the 'Look For:' menu and search for 'EMP0001' in the 'hr:empID' field, I get '1 result(s) found in repository'. However if I search for 'EMP0001' in the default 'Keywords' field of the same 'HR' template I get '0 result(s) found in repository'. This seems to tell me that the Keywords field is incapable of searching through my custom fields. How to enable it to do so?

Thanks,

Gwad

loftux
Star Contributor
Star Contributor
try hr:empID:EMP0001

If you want to search without prefix, you would have to do some javascript code changes.
tomcat/webapps/alfresco/WEB-INF/classes/alfresco/templates/webscripts/org/alfresco/slingshot/search/search.lib.js
add hr:empID to
const QUERY_TEMPLATES = [
   {field: "keywords", template: "%(cm:name cm:title cm:description ia:whatEvent ia:descriptionEvent lnk:title lnk:description TEXT)"}];
Haven't tested this if it works. Note also that any changes done i webapps may get overwritten.

gwad
Champ in-the-making
Champ in-the-making
Thanks Loftux, that worked. Now I am able to search the default 'Keywords' field for my custom metadata.

I have another question here though, as you mentioned we need to manually go to the document details and change the documents 'Type' to 'my:sop' in order to associate it with that template. Is there a way to have any document uploaded to automatically be associated with my desired 'Type'? If I have many documents to be uploaded, I don't to go to each document detail and change the type, I want it to be associated to the appropriate type automatically on upload.

Thanks

loftux
Star Contributor
Star Contributor
Thanks Loftux, that worked. Now I am able to search the default 'Keywords' field for my custom metadata.

I have another question here though, as you mentioned we need to manually go to the document details and change the documents 'Type' to 'my:sop' in order to associate it with that template. Is there a way to have any document uploaded to automatically be associated with my desired 'Type'? If I have many documents to be uploaded, I don't to go to each document detail and change the type, I want it to be associated to the appropriate type automatically on upload.

Thanks

May I promote my own blog post in the matter?  Smiley Very Happy
http://loftux.se/en/2010/03/22/set-the-document-type-on-file-upload/
It may need to be adapted to current version of alfresco, but should get you started

alarocca
Champ in-the-making
Champ in-the-making
Create a rule on that folder, select the action "Specialize" and choose your custom type.

Thanks Loftux, that worked. Now I am able to search the default 'Keywords' field for my custom metadata.

I have another question here though, as you mentioned we need to manually go to the document details and change the documents 'Type' to 'my:sop' in order to associate it with that template. Is there a way to have any document uploaded to automatically be associated with my desired 'Type'? If I have many documents to be uploaded, I don't to go to each document detail and change the type, I want it to be associated to the appropriate type automatically on upload.

Thanks