Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Implement gallery serch support
Signed-off-by: Mario Danic <[email protected]>
  • Loading branch information
mario authored and AndyScherzinger committed Jun 12, 2018
commit b40082f2c72980c2552b054a66b88093ab15c41b
14 changes: 10 additions & 4 deletions src/com/owncloud/android/lib/resources/files/SearchOperation.java
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ private Document createQuery() {
Element folderElement = null;
if (filterOutFiles) {
folderElement = query.createElementNS(DAV_NAMESPACE, "d:is-collection");
}
}
Element equalsElement;
if (searchType == SearchType.FAVORITE_SEARCH) {
equalsElement = query.createElementNS(DAV_NAMESPACE, "d:eq");
Expand All @@ -232,6 +232,7 @@ private Document createQuery() {
Text literalTextElement = null;
Element imageLikeElement = null;
Element videoLikeElement = null;

if (searchType != SearchType.GALLERY_SEARCH) {
propElement = query.createElementNS(DAV_NAMESPACE, "d:prop");
queryElement = null;
Expand Down Expand Up @@ -269,20 +270,25 @@ private Document createQuery() {
imageLikeElement = query.createElementNS(DAV_NAMESPACE, "d:like");
Element imagePropElement = query.createElementNS(DAV_NAMESPACE, "d:prop");
Element imageQueryElement = query.createElementNS(DAV_NAMESPACE, "d:getcontenttype");
Element imageLiteralElement = query.createElementNS(DAV_NAMESPACE, "d:literal");
Text imageLiteralTextElement = query.createTextNode("image/%");
videoLikeElement = query.createElementNS(DAV_NAMESPACE, "d:like");
Element videoPropElement = query.createElementNS(DAV_NAMESPACE, "d:prop");
Element videoQueryElement = query.createElementNS(DAV_NAMESPACE, "d:getcontenttype");
Element videoLiteralElement = query.createElementNS(DAV_NAMESPACE, "d:literal");
Text videoLiteralTextElement = query.createTextNode("video/%");

videoLiteralElement.appendChild(videoLiteralTextElement);
imageLiteralElement.appendChild(imageLiteralTextElement);

videoPropElement.appendChild(videoQueryElement);
videoLikeElement.appendChild(videoPropElement);
videoLikeElement.appendChild(videoLiteralTextElement);
videoLikeElement.appendChild(videoLiteralElement);


imagePropElement.appendChild(imageQueryElement);
imageLikeElement.appendChild(imagePropElement);
imageLikeElement.appendChild(imageLiteralTextElement);
imageLikeElement.appendChild(imageLiteralElement);

}

Expand Down Expand Up @@ -330,7 +336,7 @@ private Document createQuery() {
literalElement.appendChild(literalTextElement);
} else {
equalsElement.appendChild(imageLikeElement);
//equalsElement.appendChild(videoLikeElement);
equalsElement.appendChild(videoLikeElement);
}
basicSearchElement.appendChild(orderByElement);

Expand Down