jackrabbit-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "hsp" <piccina...@ibest.com.br>
Subject Re: Searching....
Date Tue, 30 May 2006 12:17:09 GMT
I am doing a classification of the mimetype by comparing the end of the file name, like this:
	public static String getMimeType(String nomeArquivo) {
		String ret = null;
		if(nomeArquivo.endsWith(".avi")) {
			ret = "video/x-msvideo";
		} else if (nomeArquivo.endsWith(".doc")) {
			ret = "application/msword";
		} else if (nomeArquivo.endsWith(".htm")) {
			ret = "text/html";
		} else if (nomeArquivo.endsWith(".html")) {
			ret = "text/html";
		} else if (nomeArquivo.endsWith(".mht")) {
			ret = "text/html";
		} else if (nomeArquivo.endsWith(".cfm")) {
			ret = "text/html";
		} else if (nomeArquivo.endsWith(".jsp")) {
			ret = "text/html";
		} else if (nomeArquivo.endsWith(".jspx")) {
			ret = "text/html";
		} else if (nomeArquivo.endsWith(".pdf")) {
			ret = "application/pdf";
		} else if (nomeArquivo.endsWith(".ppt")) {
			ret = "application/mspowerpoint";
		} else if (nomeArquivo.endsWith(".rtf")) {
			ret = "application/rtf";
		} else if (nomeArquivo.endsWith(".sxc")) {
			ret = "application/vnd.sun.xml.calc";
		} else if (nomeArquivo.endsWith(".sxi")) {
			ret = "application/vnd.sun.xml.impress";
		} else if (nomeArquivo.endsWith(".sxw")) {
			ret = "application/vnd.sun.xml.writer";
		} else if (nomeArquivo.endsWith(".txt")) {
			ret = "text/plain";
		} else if (nomeArquivo.endsWith(".xls")) {
			ret = "application/msexcel";
		} else if (nomeArquivo.endsWith(".xml")) {
			ret = "text/xml";
		} else if (nomeArquivo.endsWith(".xsl")) {
			ret = "text/xml";
		} else if (nomeArquivo.endsWith(".java")) {
			ret = "text/plain";
		} else if (nomeArquivo.endsWith(".bat")) {
			ret = "text/plain";
		} else if (nomeArquivo.endsWith(".ods")) {
			ret = "application/vnd.oasis.opendocument.spreadsheet";
		} else if (nomeArquivo.endsWith(".odt")) {
			ret = "application/vnd.oasis.opendocument.text";
		} else if (nomeArquivo.endsWith(".odf")) {
			ret = "application/vnd.oasis.opendocument.formula";
		} else if (nomeArquivo.endsWith(".odg")) {
			ret = "application/vnd.oasis.opendocument.graphics";
		} else if (nomeArquivo.endsWith(".odd")) {
			ret = "application/vnd.oasis.opendocument.database";
		} else if (nomeArquivo.endsWith(".odp")) {
			ret = "application/vnd.oasis.opendocument.presentation";
		}
		return ret;
	}

So, the jcr:mimeType gets the "correct" value when I am saving the nt:resource node.
But I am searching any document I put there and there is no result, or if there is it is unstable
for all the extensions the textfilters assume that it does.
Normally I put the file inside a node (nt:resource) that is inside a nt:folder, and do the
query:
SELECT * FROM nt:folder WHERE CONTAINS(*,'TEXTSEARCHINGFOR')

My repository xml does reference to textfilters.
The textfilters are based on the information in the jcr:mimetype to build the index, no?

Is there no way to rebuild the indexes without have to restart the jboss?
I am not seeing this funcionallity works, but I need it working, what are the best pratice
for that (if it exists).

Thanks
Helio

>hsp wrote:
>> I don't mind what could be happen, but my application doesn't search any
>> values (properties or binary contents). If I do the simple query in
>> XPath: //*[jcr:contains(.,'lidando')]
>
>can you provide a small test case that reproduces this behaviour? Thanks.
>
>> or the other:
>> 
>> //*[jcr:like(@jcr:primaryType,'%nt:folder%')]
>
>JSR 170 specifies that jcr:like() does not work with properties of type 
>NAME. you should rather use the equals operator or the element node test:
>
>//*[@jcr:primaryType == 'nt:folder']
>	(returns nodes that are of type nt:folder)
>
>//element(*, nt:folder)
>	(returns nodes that are of type nt:folder or of types that are derived 
>from nt:folder)
>
>regards
>  marcel
>

Mime
View raw message