Hello,
I am using Alfresco Community 5.2 on Windows 10.
I am testing customization of advanced search based on a custom type with properties.
To customize the advanced search UI, I followed the instructions in
https://docs.alfresco.com/6.0/references/dev-extension-points-content-model-configure-ui.html
I can now search content based on all custom properties and on some default properties (title, filename).
However, the problem is that the advanced search does not retrieve any text inside the file (search by keyword).
The same content is retrieved by a simple search or by using the keyword field (mot-clé in French) in the default Advanced Search available in Alfresco! So definetely there is a problem with my advanced search customization.
I noticed that the keyword field is not present in the share-config-custom.xml. Is this normal ?
Here is my share-config-custom.xml file
<config evaluator="node-type" condition="gd:GlobalDoc"> <forms> <!-- Default form configuration --> <form> <field-visibility> <show id="cm:name" /> <show id="cm:title" force="true" /> <show id="cm:description" force="true" /> <show id="mimetype" /> <show id="cm:author" force="true" /> <show id="size" for-mode="view" /> <show id="cm:creator" for-mode="view" /> <show id="cm:created" for-mode="view" /> <show id="cm:modifier" for-mode="view" /> <show id="cm:modified" for-mode="view" /> <!-- tags and categories --> <show id="cm:taggable" for-mode="edit" force="true" /> <show id="cm:categories" /> <!-- cm:dublincore aspect --> <show id="cm:publisher"/> <show id="cm:contributor"/> <show id="cm:type"/> <show id="cm:identifier"/> <show id="cm:dcsource"/> <show id="cm:coverage"/> <show id="cm:rights"/> <show id="cm:subject"/> <!-- cm:complianceable aspect --> <show id="cm:removeAfter" /> <!-- cm:effectivity aspect --> <show id="cm:from"/> <show id="cm:to"/> <!-- cm:summarizable aspect --> <show id="cm:summary" /> <!-- cm:translatable aspect --> <show id="cm:translations" /> <!-- cm:localizable aspect --> <show id="cm:locale" /> <!-- cm:ownable aspect --> <show id="cm:owner" /> <!-- cm:attachable aspect --> <show id="cm:attachments" /> <!-- cm:emailed aspect --> <show id="cm:originator" /> <show id="cm:addressee" /> <show id="cm:addressees" /> <show id="cm:sentdate" /> <show id="cm:subjectline" /> <!-- exif:exif aspect --> <show id="exif:dateTimeOriginal" /> <show id="exif:pixelXDimension" /> <show id="exif:pixelYDimension" /> <show id="exif:exposureTime" /> <show id="exif:fNumber" /> <show id="exif:flash" /> <show id="exif:focalLength" /> <show id="exif:isoSpeedRatings" /> <show id="exif:manufacturer" /> <show id="exif:model" /> <show id="exif:software" /> <show id="exif:orientation" /> <show id="exif:xResolution" /> <show id="exif:yResolution" /> <show id="exif:resolutionUnit" /> <!-- audio:audio aspect --> <show id="audio:album" /> <show id="audio:artist" /> <show id="audio:composer" /> <show id="audio:engineer" /> <show id="audio:genre" /> <show id="audio:trackNumber" /> <show id="audio:releaseDate" /> <show id="audio:sampleRate" /> <show id="audio:sampleType" /> <show id="audio:channelType" /> <show id="audio:compressor" /> <!-- cm:indexControl aspect --> <show id="cm:isIndexed" /> <show id="cm:isContentIndexed" /> <!-- cm:geographic aspect --> <show id="cm:latitude" /> <show id="cm:longitude" /> <!-- surf:widget aspect --> <show id="surf:widgetType"/> <show id="surf:mid"/> <show id="surf:label"/> <show id="gd:Produit" force="true" /> <show id="gd:NomClient" /> <show id="gd:ClientID" /> <show id="gd:CategClient" /> <show id="gd:ProjectID" /> <show id="gd:TypeDoc" /> <show id="gd:Langue" /> <show id="gd:Status" /> <show id="gd:Confidentiality" /> </field-visibility> <appearance> <field id="cm:name"> <control> <control-param name="maxLength">255</control-param> </control> </field> <field id="cm:title"> <control template="/org/alfresco/components/form/controls/textfield.ftl" /> </field> <field id="cm:description"> <control> <control-param name="activateLinks">true</control-param> </control> </field> <field id="mimetype"> <control template="/org/alfresco/components/form/controls/mimetype.ftl" /> </field> <field id="size"> <control template="/org/alfresco/components/form/controls/size.ftl" /> </field> <field id="cm:taggable"> <control> <control-param name="compactMode">true</control-param> <control-param name="params">aspect=cm:taggable</control-param> <control-param name="createNewItemUri">/api/tag/workspace/SpacesStore</control-param> <control-param name="createNewItemIcon">tag</control-param> </control> </field> <field id="cm:categories"> <control> <control-param name="compactMode">true</control-param> </control> </field> <field id="cm:originator" read-only="true" /> <field id="cm:addressee" read-only="true" /> <field id="cm:addressees" read-only="true" /> <field id="cm:sentdate" read-only="true" /> <field id="cm:subjectline" read-only="true" /> <set id="gdDocSet" appearance="bordered-panel" label-id="form.set.label.gd.document"/> <field id="gd:Produit" label-id="form.field.label.gd.Produit" set="gdDocSet" /> <field id="gd:NomClient" label-id="form.field.label.gd.NomClient" set="gdDocSet" /> <field id="gd:ClientID" label-id="form.field.label.gd.ClientID" set="gdDocSet"/> <control template="/org/alfresco/components/form/controls/textfield.ftl"/> <field id="gd:CategClient" label-id="form.field.label.gd.CategClient" set="gdDocSet"/> <field id="gd:ProjectID" label-id="form.field.label.gd.ProjectID" set="gdDocSet"/> <field id="gd:TypeDoc " label-id="form.field.label.gd.TypeDoc" set="gdDocSet"/> <field id="gd:Langue " label-id="form.field.label.gd.langue" set="gdDocSet"/> <field id="gd:Status" label-id="form.field.label.gd.status" set="gdDocSet"/> <field id="gd:Confidentiality" label-id="form.field.label.gd.confidentiality" set="gdDocSet"/> </appearance> </form> </forms> </config> <config evaluator="string-compare" condition="DocumentLibrary"> <aspects> <visible> <aspect name="gd:webPublished"/> <aspect name="gd:SecurityClassified"/> <aspect name="ToBeArchived"/> </visible> <addable> <!-- defaults to visible config --> </addable> <removeable> <!-- defaults to visible config --> </removeable> </aspects> <types> <type name="cm:folder"> <subtype name="gd:Projet"/> </type> <!-- First define the GD base doc type as decedent from cm:content --> <type name="cm:content"> <subtype name="gd:GlobalDoc"/> </type> <!-- Then the GD sub-types --> <type name="gd:GlobalDoc"> <subtype name="gd:Juridique"/> <subtype name="gd:Etudes"/> <subtype name="gd:Formation"/> </type> </types> </config> <config evaluator="string-compare" condition="AdvancedSearch" replace="true"> <advanced-search> <forms> <form labelId="search.form.label.cm_folder" descriptionId="search.form.desc.cm_folder">cm:folder</form> <form labelId="search.form.label.cm_content" descriptionId="search.form.desc.cm_content">cm:content</form> <form labelId="search.form.label.gd_GlobalDoc" descriptionId="search.form.desc.gd_GlobalDoc">gd:GlobalDoc </form> </forms> </advanced-search> </config> <config evaluator="model-type" condition="gd:GlobalDoc"> <forms> <form id="search"> <field-visibility> <show id="cm:name" /> <show id="cm:title" force="true" /> <show id="cm:description" force="true" /> <show id="mimetype" /> <show id="cm:modified" /> <show id="cm:modifier" /> <show id="gd:Produit" force="true"/> <show id="gd:ProjectID" /> <show id="gd:NomClient" /> <show id="gd:ClientID" /> <show id="gd:CategClient" /> <show id="gd:TypeDoc" /> <show id="gd:Status" /> <show id="gd:Langue" /> <show id="gd:Confidentiality" /> </field-visibility> <appearance> <field id="mimetype"> <control template="/org/alfresco/components/form/controls/mimetype.ftl" /> </field> <field id="cm:modifier"> <control> <control-param name="forceEditable">true</control-param> </control> </field> <field id="cm:modified"> <control template="/org/alfresco/components/form/controls/daterange.ftl" /> </field> <set id="gdDocSet" appearance="bordered-panel" label-id="form.set.label.gd.document"/> <field id="gd:Produit" label-id="form.field.label.gd.Produit" set="gdDocSet"/> <field id="gd:NomClient" label-id="form.field.label.gd.NomClient" set="gdDocSet" /> <control template="/org/alfresco/components/form/controls/textfield.ftl"/> <field id="gd:ClientID" label-id="form.field.label.gd.ClientID" set="gdDocSet"/> <control template="/org/alfresco/components/form/controls/textfield.ftl"/> <field id="gd:CategClient" label-id="form.field.label.gd.CategClient" set="gdDocSet"/> <field id="gd:ProjectID" label-id="form.field.label.gd.ProjectID" set="gdDocSet"/> <field id="gd:TypeDoc " label-id="form.field.label.gd.TypeDoc" set="gdDocSet"/> <field id="gd:Langue " label-id="form.field.label.gd.langue" set="gdDocSet"/> <field id="gd:Status" label-id="form.field.label.gd.status" set="gdDocSet"/> <field id="gd:Confidentiality" label-id="form.field.label.gd.confidentiality" set="gdDocSet"/> </appearance> </form> </forms> </config>
And here is a screen capture of my custom advanced search window (in French).
The field not working is the first one ; "mots-clés" (keywords).
Solved! Go to Solution.
Yes, it is normal. The keyword field is independent of your form configuration and always present. As such it does not need to (and indeed cannot) be configured. The behaviour with regards to they keyword field should be identical between default forms and your custom form.
What I often see trip people up is the way that boolean fields / checkboxes and select fields behave in the advanced search: since checkbox / select via default Alfresco form control templates do not have an "unset" value, they always restrict the search result, e.g. a checkbox by default always filters by false and a select filters by the first value in the allowed list, without any action by the user or any chance for the user to "deselect" those restrictions. I often develop custom form control templates specifically for search to allow "unset" values, e.g. instead of using a checkbox I use a select with "" / "Yes" / "No" values, and all selects based on model constraints always get an empty value forced as the first option. This does not only apply to your custom fields but also generic fields such as the MIME type.
You can inspect the browser URL after searching to check what params and values are generated from your Advanced Search page.
For instance, the following URL has been generated for an Advanced Search using "Title" to search in Title field:
http://127.0.0.1/share/page/dp/ws/faceted-search#searchTerm=&query=%7B%22prop_cm_name%22%3A%22%22%2C%22prop_cm_title%22%3A%22Title%22%2C%22prop_cm_description%22%3A%22%22%2C%22prop_mimetype%22%3A%22%22%2C%22prop_cm_modified-date-range%22%3A%22%22%2C%22prop_cm_modifier%22%3A%22%22%2C%22datatype%22%3A%22cm%3Acontent%22%7D&scope=all_sites
Yes, it is normal. The keyword field is independent of your form configuration and always present. As such it does not need to (and indeed cannot) be configured. The behaviour with regards to they keyword field should be identical between default forms and your custom form.
What I often see trip people up is the way that boolean fields / checkboxes and select fields behave in the advanced search: since checkbox / select via default Alfresco form control templates do not have an "unset" value, they always restrict the search result, e.g. a checkbox by default always filters by false and a select filters by the first value in the allowed list, without any action by the user or any chance for the user to "deselect" those restrictions. I often develop custom form control templates specifically for search to allow "unset" values, e.g. instead of using a checkbox I use a select with "" / "Yes" / "No" values, and all selects based on model constraints always get an empty value forced as the first option. This does not only apply to your custom fields but also generic fields such as the MIME type.
Hello,
thanks for your quick reply!
I am not sure I interpret your answer correctly, but I have tested every single search criterion of my custom advanced search independently from the others. They all work, except for the keyword field.
So for example, documents are retrieved correctly if I only specify the filename, or only the project ID or only the product name.
In fact, when I created my content model, every time I had a list constraint, I left a blank field by default (I used the "----" characters) so that the search would not be constrained mistakenly by the first value on the list.
To see if the constraint came from the MIME type, I also tried to specify the exact file type, but still doesn't work.
So, I guess if there was a constraint in the my content model, it would also affect the other criteria in the advanced search, right?
Thanks again,
Rosa
Rosa
You can inspect the browser URL after searching to check what params and values are generated from your Advanced Search page.
For instance, the following URL has been generated for an Advanced Search using "Title" to search in Title field:
http://127.0.0.1/share/page/dp/ws/faceted-search#searchTerm=&query=%7B%22prop_cm_name%22%3A%22%22%2C%22prop_cm_title%22%3A%22Title%22%2C%22prop_cm_description%22%3A%22%22%2C%22prop_mimetype%22%3A%22%22%2C%22prop_cm_modified-date-range%22%3A%22%22%2C%22prop_cm_modifier%22%3A%22%22%2C%22datatype%22%3A%22cm%3Acontent%22%7D&scope=all_sites
Hello,
thanks for your suggestion. Here is what I get when I specify only the word "objectives" in the keyword field and the word "plan" in the title and name fields.
http://127.0.0.1:8081/share/page/site/epc-projects/dp/ws/faceted-search#searchTerm=objectives&query=%7B%22prop_cm_name%22%3A%22plan%22%2C%22prop_cm_title%22%3A%22plan%22%2C%22prop_cm_description%22%3A%22%22%2C%22prop_mimetype%22%3A%22%22%2C%22prop_cm_modified-date-range%22%3A%22%22%2C%22prop_cm_modifier%22%3A%22%22%2C%22prop_gd_TypeDoc%22%3A%22-----%22%2C%22prop_gd_Langue%22%3A%22---------%22%2C%22prop_gd_Produit%22%3A%22---------------%22%2C%22prop_gd_ProjectID%22%3A%22%22%2C%22prop_gd_NomClient%22%3A%22---------%22%2C%22prop_gd_ClientID%22%3A%22%22%2C%22prop_gd_CategClient%22%3A%22------------------%22%2C%22prop_gd_Status%22%3A%22-------------%22%2C%22prop_gd_Confidentiality%22%3A%22--------%22%2C%22datatype%22%3A%22gd%3AGlobalDoc%22%7D&scope=epc-projects
I think I have a problem with the dash characters "----" which I used as first value in the list constraints of my content model. They seem to be considered as specific values, instead of empty value.
I created my content model from the Alfresco UI and I don't know how else to obtain an empty value as first item of drop-down list. If I use the word "empty" (with or without inverted commas), then I get the word empty as first value.
Any suggestion? Tx in advance :-)
Ask for and offer help to other Alfresco Content Services Users and members of the Alfresco team.
Related links:
By using this site, you are agreeing to allow us to collect and use cookies as outlined in Alfresco’s Cookie Statement and Terms of Use (and you have a legitimate interest in Alfresco and our products, authorizing us to contact you in such methods). If you are not ok with these terms, please do not use this website.