Alfresco 6.0 advanced custom search query

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Active Member II

Alfresco 6.0 advanced custom search query

Hello guys,

I have a custom model for my files, I added custom aspects to my nodes, Example: "Name_company:XYZ", Now I want to search for these properties on the search bar.

On internet it says something about adding a section of search on  a file name share-config-custom.xml. But I'm running alfresco on docker so, I'm not sure how to modify this file. Inside the container i know where is the file but at runtime it doesn't let me mount the volume of the file because it has the same name and it's in use and dont let me replace the file.

What would be the best approach to do this?.

Thanks for your help.

19 Replies
Highlighted
Alfresco Employee

Re: Alfresco 6.0 advanced custom search query

You can include an extension from official Alfresco Share Docker image with something similar to the following:

FROM alfresco/alfresco-share:6.0

ARG TOMCAT_DIR=/usr/local/tomcat

RUN sed -i '/<\/alfresco-config>/i \
<config evaluator="string-compare" condition="CSRFPolicy" replace="true"> \n\
    <filter/> \n\
</config>\n\
' $TOMCAT_DIR/shared/classes/alfresco/web-extension/share-config-custom.xml

In the sample, CSRF filter is being disabled but you can add your configuration for the Advanced Search.

Or you can overwrite share-config-custom.xml contents by using this other approach:

FROM alfresco/alfresco-share:6.0

ARG TOMCAT_DIR=/usr/local/tomcat

COPY share-config-custom.xml $TOMCAT_DIR/shared/classes/alfresco/web-extension/share-config-custom.xml

Alternatively you can package your forms using Alfresco SDK and deploy it as a Share module (AMP or JAR)

Software Engineer in Alfresco Search Team.
Highlighted
Active Member II

Re: Alfresco 6.0 advanced custom search query

Oh Thank you Angel, I'll try that

Highlighted
Customer

Re: Alfresco 6.0 advanced custom search query

Or just mounting share-config-custom.xml as a local volume for share image in docker-compose.yml

Regards.

--C.

Highlighted
Alfresco Employee

Re: Alfresco 6.0 advanced custom search query

Mounting a local volume only for configuration purposes? I thought volumes were only recommended for persistence...

Software Engineer in Alfresco Search Team.
Highlighted
Customer

Re: Alfresco 6.0 advanced custom search query

And why not to persist your custom configuration ? IMO, the approximation seems simpler, easier for managing and working with configuration files and you do not need to create custom images for basic / simple setups. Why to include docker RUN / COPY commands for "everything" ? I can't confirm if this is considered as a non-recommended practice from a docker point of view, maybe someone can give other arguments against it.

Regards.

--C.

Highlighted
Alfresco Employee

Re: Alfresco 6.0 advanced custom search query

I (more or less) agree with this: https://dantehranian.wordpress.com/2015/03/25/how-should-i-get-application-configuration-into-my-doc...

Anyway, I'm evaluating "docker config" for this kind of configurations.

Software Engineer in Alfresco Search Team.
Highlighted
Active Member II

Re: Alfresco 6.0 advanced custom search query

I tried to mount a local volume in the compose, but it says that the file already exist and does not allow me to replace it

Highlighted
Customer

Re: Alfresco 6.0 advanced custom search query

Thanks for the link Angel Borroy‌.

Regards.

--C.

Highlighted
Active Member II

Re: Alfresco 6.0 advanced custom search query

Hi, I tried your suggestion but i still have the issue, the one that worked best for me was the best option. my share-config-custom.xml now looks like this:

<config evaluator="string-compare" condition="Search" replace="true">
      <search>
         <min-search-term-length>1</min-search-term-length>
         <max-search-results>250</max-search-results>
         <max-users-search-results>20</max-users-search-results>
         <repository-search>always-options</repository-search>
         <display-facets>true</display-facets>
      </search>
      <sorting>
         <sort labelId="search.sort.relevance" isSortable="false"></sort>
         <sort labelId="label.name" isSortable="true">cm:name</sort>
         <sort labelId="label.title" isSortable="true">cm:title</sort>
         <sort labelId="label.description" isSortable="false">cm:description</sort>
         <sort labelId="label.author" isSortable="false">cm:author</sort>
         <sort labelId="label.modifier" isSortable="true">cm:modifier</sort>
         <sort labelId="label.modified" isSortable="true">cm:modified|false</sort>
         <sort labelId="label.creator" isSortable="true">cm:creator</sort>
         <sort labelId="label.created" isSortable="true">cm:created|false</sort>
         <sort labelId="search.sort.size" isSortable="true">.size|true</sort>
         <sort labelId="search.sort.mimetype" isSortable="true">.mimetype</sort>
         <sort labelId="search.sort.type" isSortable="true">TYPE</sort>
         <sort label="Nombre Proveedor" isSortable="true">kx:nombre_proveedor</sort> <---- these are my custom aspects
         <sort label="Nombre Cliente" isSortable="true">kx:nombre_cliente</sort>
         <sort label="Monto Factura" isSortable="true">kx:monto_factura</sort>
      </sorting>
</config>

On the filters I can see that the filters are working ok, but the search i got no results.checking the logs I saw that Solr its having an error:

 2018-08-28 20:35:30.062 ERROR (org.alfresco.solr.AlfrescoCoreAdminHandler@4681c175_Worker-2) [   ] o.a.s.t.AbstractTracker Tracking failed
solr6_1              | org.alfresco.service.namespace.NamespaceException: URI http://kardox.demo.netlinux/model/facturasnew/1.0 has already been defined
solr6_1              |  at org.alfresco.repo.dictionary.AbstractDictionaryRegistry.addURIImpl(AbstractDictionaryRegistry.java:541)
solr6_1              |  at org.alfresco.repo.dictionary.AbstractDictionaryRegistry.addURI(AbstractDictionaryRegistry.java:534)
solr6_1              |  at org.alfresco.repo.dictionary.AbstractDictionaryRegistry.putModelImpl(AbstractDictionaryRegistry.java:246)
solr6_1              |  at org.alfresco.repo.dictionary.CoreDictionaryRegistryImpl.putModelImpl(CoreDictionaryRegistryImpl.java:84)
solr6_1              |  at org.alfresco.repo.dictionary.AbstractDictionaryRegistry.putModel(AbstractDictionaryRegistry.java:113)
solr6_1              |  at org.alfresco.repo.dictionary.DictionaryDAOImpl.putModelImpl(DictionaryDAOImpl.java:277)
solr6_1              |  at org.alfresco.repo.dictionary.DictionaryDAOImpl.putModelIgnoringConstraints(DictionaryDAOImpl.java:267)
solr6_1              |  at org.alfresco.solr.AlfrescoSolrDataModel.putModel(AlfrescoSolrDataModel.java:1301)
solr6_1              |  at org.alfresco.solr.SolrInformationServer.putModel(SolrInformationServer.java:3774)
solr6_1              |  at org.alfresco.solr.tracker.ModelTracker.loadModel(ModelTracker.java:559)
solr6_1              |  at org.alfresco.solr.tracker.ModelTracker.trackModelsImpl(ModelTracker.java:326)
solr6_1              |  at org.alfresco.solr.tracker.ModelTracker.trackModels(ModelTracker.java:264)
solr6_1              |  at org.alfresco.solr.tracker.ModelTracker.doTrack(ModelTracker.java:210)
solr6_1              |  at org.alfresco.solr.tracker.AbstractTracker.track(AbstractTracker.java:205)
solr6_1              |  at org.alfresco.solr.tracker.TrackerJob.execute(TrackerJob.java:47)
solr6_1              |  at org.quartz.core.JobRunShell.run(JobRunShell.java:216)
solr6_1              |  at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:563)