cancel
Showing results for 
Search instead for 
Did you mean: 

Lucene Query by Mimetype

faiyth
Champ in-the-making
Champ in-the-making
I've been spending the last few days trying to figure out how to limit the results of my query to only jpgs and gifs in my folder and for some reason it just isn't working. Either I get absolutely nothing at all or I get every record.

Here's the queries I've tried and their results:

LucQuery = "text:\"*jpg*\""; RESULT: 0
LucQuery = "name:\"*jpg*\""; RESULT: 0
LucQuery = "+@cm\:abstract.mimetype:\"image/jpeg\"" RESULT: 0

I have two files: image1.jpg and HomepageText.html.. so shouldn't the image be showing up? Any help you can offer would be greatly appreciated.

Thanks!
10 REPLIES 10

kevinr
Star Contributor
Star Contributor
Which version of Alfresco are you using? I noticed you are using "phrase" search syntax i.e. in quotes. Have you tried this:

LucQuery = "name:*jpg";

Thanks,

Kevin

andy
Champ on-the-rise
Champ on-the-rise
Hi

Only properties of type d:content (eg cm:content) support queries for cm\:content.mimetype. What type is cm:abstract?

Andy

en64026
Champ in-the-making
Champ in-the-making
Hi friends,

I used the below query to get the files based on their MIME types. I dint get any error but i can not get the result also.

There are files in the .pdf format but it is not displayed as results.

Kindly help me out in this issue.

var whitepapers = search.luceneSearch("PATH:\"/company_home.//*\"" + "@cm\abstract:mimetype:" + "application/pdf");

Thanks in advance

Regards,
Elavarasan N.

mikeh
Star Contributor
Star Contributor
Please see corrected search format on the wiki: http://wiki.alfresco.com/wiki/Search#Finding_nodes_by_content_mimetype

Thanks,
Mike

en64026
Champ in-the-making
Champ in-the-making
Thanks Mike.

I have used the following code to get the contents by the mime type.

var whitepapers = search.luceneSearch("+PATH:\"/company_home.//*\"+@\"{http\://www.alfresco.org/model/content/1.0\}content.mimetype:text/plain'+'\"");

No error came. But output also dint come.

Kindly correct the code and let us know the correct syntax.

Thanks.

Regards,
Elavarasan N.

mikeh
Star Contributor
Star Contributor
You need to escape the "\" character that forms part of the query because this is contained within a JavaScript string. I've single-quoted the string to make things easier… you also need to be careful about spaces and note that it's "app:company_home"
search.luceneSearch('+PATH:"/app:company_home//*" +@\\{http\\://www.alfresco.org/model/content/1.0\\}content.mimetype:text/plain');

Mike

en64026
Champ in-the-making
Champ in-the-making
Hi

Thank you very much mike………..

Its working fine now……….

Such a useful tip for me………….

Thank you once again mike.

Regards,
Elavarasan N.

en64026
Champ in-the-making
Champ in-the-making
HI all,

Could anyone tell me how to display the content of the file using freemarket template.

While i using the key.content, the content have been displayed in the encrypted format like the below one.

+ _rels/.relsPK  -   !ky� ��   theme/theme/themeManager.xmlPK  -   !���� P  � theme/theme/theme1.xmlPK  -   ! ѐ��  '� theme/theme/_rels/themeManager.xml.relsPK    ] �     ����         �8 �        @ � �������   �  �      �0  �(  �   �     �B  �    S � �  � �     ?    �               � �.�(]�   �@�    �        X @��  Unknown��  �� �� ���� �� G �           �* � � Times New Roman5 �             �Symbol3.�           �* � � Arial7.�           � �{ @�CalibriA �            Cambria  @(� )�1Table   ���� ���� � WordDocument    ��������  SummaryInformation(    ����   DocumentSummaryInformation8  ������������   CompObj  ������������y������������������������ ���������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������������� ��  ����   �F'Microsoft Office Word 97-2003 Document MSWordDoc Word.Document.8�9�q


kindly tell me to avoid this problem.

Thank you.

Regards,
Elavarasan N.

mikeh
Star Contributor
Star Contributor
First of all, please open a new topic for completely unrelated questions - thanks.

As to your problem - your trying to do the equivalent of opening a Word document in Notepad. Try it - you'll get the same "random" characters. Because this is being displayed inline in a web browser, you must use text or html as the output.

Mike