cancel
Showing results for 
Search instead for 
Did you mean: 

Alfresco 6.0 advanced custom search query

pedrohernandez
Confirmed Champ
Confirmed Champ

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 19

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)

angelborroy
Community Manager Community Manager
Community Manager

It looks like you are deploying twice the content model in the repository. This error is not related with share-config-custom.xml customisation.

Hyland Developer Evangelist

I have only 1 content model active, and actually I changed the URI to a new one to test it out, and got some error but the uri changed.

No, you have 2 content models deployed using the same URI:

http://kardox.demo.netlinux/model/facturasnew/1.0 

Check your modules (JAR / AMP), your XML in 'extension' directory and Model Manager tool.

Hyland Developer Evangelist

Hello Angel, thanks for your help, Yes aparently that was an issue, since right now im in local, I deleted the container and build it again, now Solr it's not giving me error, but, I can't still find the documents by the custom aspect properties..

Also to note, when my aspect properties is set to index "free text" or "full text" the property disapears from the search filters and i cannot add it to filters.

My files properties is as follow:

I'm trying to look for value of property "Nombre proveedor":

And this is the result.

checking share container in docker on route $tomcatHome/shared/classes/alfresco/web-extension/share-config-custom.xml I have this configuration.

I checked that properties in this files match the propereties in my content model.

Much appreciate your help

I don't know what are you trying to configure, really.

Take a look at this presentation and you'll get some additional information on configuring Search in Share: http://beecon.buzz/2017/assets/files/F20/Leveraging%20search%20in%20Share.pdf 

Hyland Developer Evangelist

Thanks Angel,

Sorry if I wasn't totally specific, So looking at the presentation on page 21, apparently the default "Search on metadata" the default is this one:

#searchTerm=&query={"prop_cm_name":"project","prop_cm_title":"","prop_cm_description":"","prop_mimetype":"","prop_cm_modified-daterange":"","prop_cm_modifier":"","datatype":"cm:content"}&scope=all_sites&sortField=cm:name&sortAscending=truefacetFilters={http://www.alfresco.org/model/content/1.0}creator|abeecher

So, I would like to add a custom searchable metadata so when I search for a custom aspect value it will show all the files containing the above examples values. example: "nombre_proveedor:gruposolux"

Thanks for your help again.

Normally the OOTB options for search custom metadata are the following:

 0 - Use Alfresco FTS syntax

 1 - Use custom facets as filters over full text searches (probably only nombre_proveedor and nombre_cliente)

 2 - Extend share webscripts config search.get.config.xml or live-search-docs.get.config.xml with your custom metadata.

 3 - Create a custom form in Alfresco Advanced Search for a custom type in share-config-custom.xml

 4 - A smart folder with predefined queries about your custom metadata.

Regards.

--C.

Thank you Cesar,

So, Trying your suggestions I found the following.

Option 0: I have to investigate a little more about FTS syntax didn't know about it.

Option 1: I tried this one but when defining the index of the aspect when I select free text in the property it doesn't show on the filters on search management.

Option 2: looking at the files, apparentlly those files are for alfresco old version, I don't find those files in my instalation of alfresco 6.0.

Option 3: I created a custom form in Alfresco Advanced Search and it shows the form for my custom type, but when searching for any value there, it shows not result.

Considering that your indices are correctly working, so you can do searches:

- Option 1: You should define the index of a property for a given aspect. For a filter, it is not a good idea to use free text for a property like "nombre del cliente", because if is not indexed as an exact match or coincidence the name will be tokenised and splitted in parts. So the filtered terms may appear incorrect or confusing. For appearing in filters sometimes you need to have several documents too.

- Option 2: Probably you are looking wrong, look inside alfresco/WEB-INF/lib/alfresco-share-services-6.0.x.jar

- Option 3: Normally you need to define search configuration for a custom type, but we only saw that you defined an aspect. Try to define first as less properties as possible for your custom type, in your form. Then you should have content with the type and the aspect applied.

Hope this helps.

--C.