Search on property of custom type

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

Search on property of custom type

Jump to solution

Dear everyone,

I've defined custom type (custom model) with some property

mc:refNumber: d:text

-mc:customerName: d:text

-mcSmiley TongueroductCode : d:text

When end-user create new document on custom type, he or she want to search on some property at custom type, I've try advance search with filter, but filter only allow property with type as number (not d:text).

Anyone can me some advices?

Many thanks!

1 Solution

Accepted Solutions
douglascrp
Advanced II

Re: Search on property of custom type

Jump to solution

Are you using the share simple search, the text field in the upper right corner?

If that is the case, then you wont get the result, as it does a search agains properties name, subject, description and the document's content.

You can find some information on how to change that behaviour in this blog post https://www.bluefishgroup.com/insights/ecm/adding-metadata-fields-to-simple-search-and-live-search-w... 

View solution in original post

15 Replies
afaust
Master

Re: Search on property of custom type

Jump to solution

Filter does support properties with type d:text - if they have been configured in the data model to support faceting. You need to add the "facetable" element to the "index" section on a property and set it to true to tell SOLR to prepare the necessary index fields to support filtering.

phong_van
Active Member II

Re: Search on property of custom type

Jump to solution

Dear Mr Axel Faust,

Thanks for your reply, but can you give more detail or link for intruction?  I'm a new member in alfresco.

Many thanks!

afaust
Master

Re: Search on property of custom type

Jump to solution

This documentation page explains what "facetable" means and how it is specified.

phong_van
Active Member II

Re: Search on property of custom type

Jump to solution

Dear Mr Axel Faust,

Your link is realy helpful but not exactly i want. In custom model i've property is mc:customerName, when i create new document at custom  model I set 

props.put("mc:customerName", "Mr John");

I've upload successfullly document on Alfresco, after that I've try search Mr John the system return no result.

afaust
Master

Re: Search on property of custom type

Jump to solution

It would be great to know what kind of API / progamming language you are using to do that. Depending on that, I could tell you if it is done the right way. It looks like Java code to me, but from a Java API perspective the code is incorrect as there is no API that supports properties to be provided as a <String, String/Serializable> map...

phong_van
Active Member II

Re: Search on property of custom type

Jump to solution

Dear Mr Axel Faust,

I'm using java with cmis 1.1, this is my code (below). I've search by programming is OK but I want end-user can search from share UI.

Session cmisSession = getCmisSession();

String fileName = file.getName();

// create a map of properties if one wasn't passed in
if (props == null) {
props = new HashMap<String, Object>();
}

// Add the object type ID if it wasn't already
if (props.get("cmisSmiley SurprisedbjectTypeId") == null) {
props.put("cmisSmiley SurprisedbjectTypeId", "D:mc:loanDocs");
// ,P:scSmiley TongueroductRelated,P:cm:titled
}
// Add the name if it wasn't already
if (props.get("cmis:name") == null) {
props.put("cmis:name", fileName);
}
props.put("mc:refNumber","142");
props.put("mc:refName", "142");
props.put("mc:customerName", "Le Trong Oanh");
props.put("mc:idCardNumber", "12345678910");
props.put("mc:loanTerm", "6");
props.put("mc:contractNumber", "123456789012345");
props.put("mcSmiley TongueroductCode", "tragop");
props.put("mc:loanAmount", 500000);

ContentStream contentStream = cmisSession.getObjectFactory().createContentStream(fileName, file.length(),
fileType, new FileInputStream(file));
Document document = null;
try {
document = parentFolder.createDocument(props, contentStream, null);
System.out.println("Created new document: " + document.getId());
} catch (CmisContentAlreadyExistsException ccaee) {
document = (Document) cmisSession.getObjectByPath(parentFolder.getPath() + "/" + fileName);
System.out.println("Document already exists: " + fileName);
}

return document;

douglascrp
Advanced II

Re: Search on property of custom type

Jump to solution

Are you using the share simple search, the text field in the upper right corner?

If that is the case, then you wont get the result, as it does a search agains properties name, subject, description and the document's content.

You can find some information on how to change that behaviour in this blog post https://www.bluefishgroup.com/insights/ecm/adding-metadata-fields-to-simple-search-and-live-search-w... 

phong_van
Active Member II

Re: Search on property of custom type

Jump to solution

Dear Mr Douglas,

Thanks for your help,I've tried your link but when I open folder

alfresco-remote-api-5.2.f\alfresco\templates\webscripts\org\alfresco\slingshot

there is no folder with name as search. I've tried search all file in alfresco-remote-api-5.2.f there is no file with name search.get.config.xml

I'm using alfresco 5.2 community version.

phong_van
Active Member II

Re: Search on property of custom type

Jump to solution

Dear Mr Douglas,

I've tried to add search folder, add to file xml as your link and i success.

Once again, very thanks for your help.