AnsweredAssumed Answered

Search on custom property not returning results

Question asked by heisenberg on Jan 9, 2014
Latest reply on Jan 17, 2014 by castgroupteam
I had modified the stock contentModel.xml by adding a custom property "mycustomprop1" to cm:content as follows:


     <type name="cm:content">
         <title>Content</title>
         <parent>cm:cmobject</parent>
         <archive>true</archive>
         <properties>
            <property name="cm:content">
               <type>d:content</type>
               <mandatory>false</mandatory>
               <!– Although content is marked as indexed atomically it may end up asynchronous –>
               <!– if the content conversion will take too long. Content that does not require conversion –>
               <!– to UTF8 test/plain will always be indexed atomically –>
               <index enabled="true">
                  <atomic>true</atomic>
                  <stored>false</stored>
                  <tokenised>true</tokenised>
               </index>
            </property>
            <property name="cm:mycustomprop1">
               <title>My Custom Property</title>
               <type>d:text</type>
               <protected>false</protected>
               <mandatory>false</mandatory>
               <index enabled="true">
                   <atomic>true</atomic>
                     <stored>true</stored>
                     <tokenised>true</tokenised>
               </index>
            </property>
         </properties>
      </type>


Then I proceeded to add a couple of nodes with FileFolderService, and set the property to "ZACK". But searching for the custom property fails, but if I search for the type I can see the nodes.


   SearchParameters params = new SearchParameters();
        params.addStore(storeRef);
        params.setLanguage(SearchService.LANGUAGE_LUCENE);
        params.setQuery("@cm\\:mycustomprop1:\"ZACK\"");  /* This returns 0 hits?!? */
        //params.setQuery("TYPE:\"cm:content\""); /* This returns the 2 nodes as expected. */
        ResultSet results = searchService.query(params);


What am I missing here? Yes, I am 100% sure I successfully added the "ZACK" property to the nodes, I verified that by reading it back with NodeService.getProperty().

Outcomes