cancel
Showing results for 
Search instead for 
Did you mean: 

Custom facet - Search - Alfresco 5.0.a

streetturtle
Confirmed Champ
Confirmed Champ
Hi!
I'd like to add some custom facets to the Alfresco search. I've created an extension which allows to override already created facets:

<import resource="classpath:/alfresco/site-webscripts/org/alfresco/share/imports/share-header.lib.js">
<import resource="classpath:/alfresco/site-webscripts/org/alfresco/share/imports/share-footer.lib.js">
var facet = widgetUtils.findObject(model.jsonModel, "id", "FCTSRCH_FACET_DESCRIPTION");
facet.config.label = "Document type";
facet.config.facetQName = "{http://www.someComp.com/model/comp/1.0}personGroup";

But it is not the right way I think.
The problem is that I cannot override the parent widgets, since they don't have ids (faceted-search.get.js).
How do I manage to add a custom facet to the model?

Another question is regarding parameter of the facet with name facetQName. In the same file (faceted-search.get.js) I met some strange syntax which I don't understand.
Some examples:

facetQName: "{http://www.alfresco.org/model/content/1.0}creator.__.u",
facetQName: "{http://www.alfresco.org/model/content/1.0}modifier.__.u",
facetQName: "{http://www.alfresco.org/model/content/1.0}description.__",


What do these '.__.u' and '.__' mean?

3 REPLIES 3

angelborroy
Community Manager Community Manager
Community Manager
Have you tried Search Manager (http://docs.alfresco.com/community/concepts/super-search-manager.html)?

Maybe you don't need to develop custom facets…
Hyland Developer Evangelist

Yes, I've upgraded my version to 5.0.b and now I can create facets throught share. But the goal I want to achieve is to create custom facets automatically.

streetturtle
Confirmed Champ
Confirmed Champ
Well I finally solve the problem.
Just for clarification: I had a requirement to use 5.0.a version in which there is no Search Manager page.
The solution which I used is a bit dirty, but it worked. I just overwrite the faceted-search.get.js and changed the facets array by adding my custom metadata:


// Compose the individual facets
var facets = [

{
    id: "FCTSRCH_FACET_DOCUMENT_TYPE",
    name: "alfresco/search/FacetFilters",
    config: {
      label: "Document Type",
      facetQName: "{http://www.mycomp.com/model/efiles/1.0}typeName.__.u",
      sortBy: "ALPHABETICALLY",
      hitThreshold: 1,
      minFilterValueLength: 5,
      maxFilters: 10,
      useHash: false
    }



If you are interested in details you can check this post: http://streetturtle.github.io/2015/01/20/faceted-search-alf-5-0-a/