cancel
Showing results for 
Search instead for 
Did you mean: 

Lucene Object search from a Metadata

nayak127
Champ in-the-making
Champ in-the-making
Hi,
Can we store a DTO object as part of a metadata and Lucene able to search its properties/attributes?
As for example, we want to store a list of DTO object to one metadata say "ImagesSet".

DTO looks like as follows:

public class Image {
private String id;
private String name;
private String title;
private Date updatedDate;
}

Say, we want to search "Name" property from the above object, can Lucene able to help us directly search that from "ImageSet" metadata?

Thanks
NN
1 REPLY 1

kaynezhang
World-Class Innovator
World-Class Innovator
Yes ,you can define a custom content type(for example ym:ImagesSet)  and save a DTO as an instance of ym:ImagesSet.

<?xml version="1.0" encoding="UTF-8"?>
<!– Definition of new Model –>
<model name="ym:yourmodel" xmlns="http://www.alfresco.org/model/dictionary/1.0">
   <description>Your Model</description>
   <author>you</author>
   <version>1.0</version>
   <imports>
      <import uri="http://www.alfresco.org/model/dictionary/1.0" prefix="d"/>
      <import uri="http://www.alfresco.org/model/content/1.0" prefix="cm"/>
   </imports>
   <namespaces>
      <namespace uri="http://www.yourmoedelurl.com/model/content/1.0" prefix="ym"/>
   </namespaces>

   <types>
      <!– Enterprise-wide generic document type –>
      <type name="ym:ImagesSet">
         <title>Minimum Custom Document</title>
         <parent>cm:content</parent>
         <properties>
            <property name="ym:id">
               <type>d:text</type>
               <mandatory>false</mandatory>
            </property>
            <property name="ym:name">
               <type>d:text</type>
               <mandatory>false</mandatory>
            </property>
            …
         </properties>

      </type>
   </types>
</model>

And search in lucene language.