[solang] Search within the nao:prefLabel of tags also, during free text search



commit 9e1ddab4a1416bba46acd00cd3545305bb39ea30
Author: Debarshi Ray <rishi gnu org>
Date:   Sat Apr 10 02:24:35 2010 +0300

    Search within the nao:prefLabel of tags also, during free text search

 src/attribute/free-text.cpp |   18 +++++++++++++++---
 1 files changed, 15 insertions(+), 3 deletions(-)
---
diff --git a/src/attribute/free-text.cpp b/src/attribute/free-text.cpp
index b493c7e..7e0b9fa 100644
--- a/src/attribute/free-text.cpp
+++ b/src/attribute/free-text.cpp
@@ -39,9 +39,21 @@ FreeText::~FreeText() throw()
 Glib::ustring
 FreeText::get_query_criteria() const throw()
 {
-    return Glib::ustring::compose("nie:url ?url . "
-                                  "FILTER REGEX (?url, '%1', 'i')",
-                                  text_);
+    // FIXME: ?photo is used to denote the nmm:Photo in the actual
+    //        query in Database::search_async. Need to find a better
+    //        way to do this.
+
+    return Glib::ustring::compose(
+        "nie:url ?url ."
+        "  OPTIONAL {"
+        "    ?photo nao:hasTag ?tag ."
+        "    ?tag nao:prefLabel ?label"
+        "  }"
+        "FILTER("
+        "  REGEX(?url, '%1', 'i')"
+        "  || (BOUND(?label) && REGEX(?label, '%1', 'i'))"
+        ")",
+        text_);
 }
 
 const Glib::ustring &



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]