You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@jackrabbit.apache.org by grace <gr...@gmail.com> on 2015/01/14 16:43:55 UTC

Search in jcr:xmlcharacters

 have imported an xml file into JackRabbit repository using:

(...)  
Node grxmlNode = node.addNode("grxml", "nt:unstructured");  
ocm.getSession().importXML(grxmlNode.getPath(), getFileFromUrl(filePath),
ImportUUIDBehavior.IMPORT_UUID_CREATE_NEW);  
ocm.save();  
(...)  


I ended up with the following repo structure:

/appName/grammars/fileName/locale/grxml/ns:grammar/ns:rule[3]  
/appName/grammars/fileName/locale/grxml/ns:grammar/ns:rule[3]/id = DIGIT1  
/appName/grammars/fileName/locale/grxml/ns:grammar/ns:rule[3]/scope = public  
/appName/grammars/fileName/locale/grxml/ns:grammar/ns:rule[3]/jcr:primaryType
= nt:unstructured  
/appName/grammars/fileName/locale/grxml/ns:grammar/ns:rule[3]/ns:item  
/appName/grammars/fileName/locale/grxml/ns:grammar/ns:rule[3]/ns:item/jcr:primaryType
= nt:unstructured  
/appName/grammars/fileName/locale/grxml/ns:grammar/ns:rule[3]/ns:item/jcr:xmltext  
/appName/grammars/fileName/locale/grxml/ns:grammar/ns:rule[3]/ns:item/jcr:xmltext/jcr:xmlcharacters
=   
      one        
/appName/grammars/fileName/locale/grxml/ns:grammar/ns:rule[3]/ns:item/jcr:xmltext/jcr:primaryType
= nt:unstructured  
/appName/grammars/fileName/locale/grxml/ns:grammar/ns:rule[3]/ns:item/ns:tag  
/appName/grammars/fileName/locale/grxml/ns:grammar/ns:rule[3]/ns:item/ns:tag/jcr:primaryType
= nt:unstructured  
/appName/grammars/fileName/locale/grxml/ns:grammar/ns:rule[3]/ns:item/ns:tag/jcr:xmltext  
/appName/grammars/fileName/locale/grxml/ns:grammar/ns:rule[3]/ns:item/ns:tag/jcr:xmltext/jcr:xmlcharacters
= returnValue = "1";  
/appName/grammars/fileName/locale/grxml/ns:grammar/ns:rule[3]/ns:item/ns:tag/jcr:xmltext/jcr:primaryType
= nt:unstructured  


I need to find a way to search in the jcr:xmlcharacters attribute and create
my XmlFile object. 

I need help setting up my query filter correctly. This is the latest attempt
out of many. 

Filter filter = qm.createFilter(XmlFile.class);
filter.setScope("/" + configSettings.getAppName() + "/grammars//");
filter.addJCRExpression("jcr:like(fn:lower-case(@jcr:xmlcharacters), '%" +
search.toLowerCase() + "%')");
        
		

How do I map my POJO XmlFile field data to the jcr:xmlcharacters portion of
the imported xml ? 
I have tried @Field(jcrName="jcr:xmltext")
@Field(jcrName="jcr:xmlcharacters") @Field(jcrName="ns:grammar"), but the
"data" field in any XmlFile object returns always null 

@Node  
public class XmlFile{  
@Field(id = true)  
    private String locale;  
    @Field  
    private String uuid;  
  
    @Field  
    private String release;  
    @Field(jcrName = "jcr:mimeType")  
    private String mimeType;  
    @Field(jcrName = ?????????)  
    private String data;  
    @Field(jcrName = "jcr:lastModified")  
    private Calendar lastModified;  
    @Field(jcrName = "jcr:contentLength")  
    private String contentLength;  
    @Field(jcrName = "jcr:revision")  
    private String revision;  

(...)  
}  




--
View this message in context: http://jackrabbit.510166.n4.nabble.com/Search-in-jcr-xmlcharacters-tp4661875.html
Sent from the Jackrabbit - Users mailing list archive at Nabble.com.

Full Text Search jcr:xmlcharacters

Posted by Grazia Russo-lassner <gr...@icloud.com>.
Anyone able to help out with the request below ? Please help

On Jan 14, 2015, at 9:43 AM, grace wrote:

> have imported an xml file into JackRabbit repository using:
> 
> (...)  
> Node grxmlNode = node.addNode("grxml", "nt:unstructured");  
> ocm.getSession().importXML(grxmlNode.getPath(), getFileFromUrl(filePath),
> ImportUUIDBehavior.IMPORT_UUID_CREATE_NEW);  
> ocm.save();  
> (...)  
> 
> 
> I ended up with the following repo structure:
> 
> /appName/grammars/fileName/locale/grxml/ns:grammar/ns:rule[3]  
> /appName/grammars/fileName/locale/grxml/ns:grammar/ns:rule[3]/id = DIGIT1  
> /appName/grammars/fileName/locale/grxml/ns:grammar/ns:rule[3]/scope = public  
> /appName/grammars/fileName/locale/grxml/ns:grammar/ns:rule[3]/jcr:primaryType
> = nt:unstructured  
> /appName/grammars/fileName/locale/grxml/ns:grammar/ns:rule[3]/ns:item  
> /appName/grammars/fileName/locale/grxml/ns:grammar/ns:rule[3]/ns:item/jcr:primaryType
> = nt:unstructured  
> /appName/grammars/fileName/locale/grxml/ns:grammar/ns:rule[3]/ns:item/jcr:xmltext  
> /appName/grammars/fileName/locale/grxml/ns:grammar/ns:rule[3]/ns:item/jcr:xmltext/jcr:xmlcharacters
> =   
>      one        
> /appName/grammars/fileName/locale/grxml/ns:grammar/ns:rule[3]/ns:item/jcr:xmltext/jcr:primaryType
> = nt:unstructured  
> /appName/grammars/fileName/locale/grxml/ns:grammar/ns:rule[3]/ns:item/ns:tag  
> /appName/grammars/fileName/locale/grxml/ns:grammar/ns:rule[3]/ns:item/ns:tag/jcr:primaryType
> = nt:unstructured  
> /appName/grammars/fileName/locale/grxml/ns:grammar/ns:rule[3]/ns:item/ns:tag/jcr:xmltext  
> /appName/grammars/fileName/locale/grxml/ns:grammar/ns:rule[3]/ns:item/ns:tag/jcr:xmltext/jcr:xmlcharacters
> = returnValue = "1";  
> /appName/grammars/fileName/locale/grxml/ns:grammar/ns:rule[3]/ns:item/ns:tag/jcr:xmltext/jcr:primaryType
> = nt:unstructured  
> 
> 
> I need to find a way to search in the jcr:xmlcharacters attribute and create
> my XmlFile object. 
> 
> I need help setting up my query filter correctly. This is the latest attempt
> out of many. 
> 
> Filter filter = qm.createFilter(XmlFile.class);
> filter.setScope("/" + configSettings.getAppName() + "/grammars//");
> filter.addJCRExpression("jcr:like(fn:lower-case(@jcr:xmlcharacters), '%" +
> search.toLowerCase() + "%')");
> 
> 		
> 
> How do I map my POJO XmlFile field data to the jcr:xmlcharacters portion of
> the imported xml ? 
> I have tried @Field(jcrName="jcr:xmltext")
> @Field(jcrName="jcr:xmlcharacters") @Field(jcrName="ns:grammar"), but the
> "data" field in any XmlFile object returns always null 
> 
> @Node  
> public class XmlFile{  
> @Field(id = true)  
>    private String locale;  
>    @Field  
>    private String uuid;  
> 
>    @Field  
>    private String release;  
>    @Field(jcrName = "jcr:mimeType")  
>    private String mimeType;  
>    @Field(jcrName = ?????????)  
>    private String data;  
>    @Field(jcrName = "jcr:lastModified")  
>    private Calendar lastModified;  
>    @Field(jcrName = "jcr:contentLength")  
>    private String contentLength;  
>    @Field(jcrName = "jcr:revision")  
>    private String revision;  
> 
> (...)  
> }  
> 
> 
> 
> 
> --
> View this message in context: http://jackrabbit.510166.n4.nabble.com/Search-in-jcr-xmlcharacters-tp4661875.html
> Sent from the Jackrabbit - Users mailing list archive at Nabble.com.