[Yanel-commits] rev 49406 - public/yanel/trunk/src/contributions/resources/search/src/java/org/wyona/yanel/impl/resources/search

michi at wyona.com michi at wyona.com
Sat May 8 16:38:01 CEST 2010


Author: michi
Date: 2010-05-08 16:38:01 +0200 (Sat, 08 May 2010)
New Revision: 49406

Modified:
   public/yanel/trunk/src/contributions/resources/search/src/java/org/wyona/yanel/impl/resources/search/SearchResource.java
Log:
allow to search re properties

Modified: public/yanel/trunk/src/contributions/resources/search/src/java/org/wyona/yanel/impl/resources/search/SearchResource.java
===================================================================
--- public/yanel/trunk/src/contributions/resources/search/src/java/org/wyona/yanel/impl/resources/search/SearchResource.java	2010-05-08 14:37:24 UTC (rev 49405)
+++ public/yanel/trunk/src/contributions/resources/search/src/java/org/wyona/yanel/impl/resources/search/SearchResource.java	2010-05-08 14:38:01 UTC (rev 49406)
@@ -131,7 +131,17 @@
      */
     private Result[] getLocalResults(String query) throws Exception {
         if (query != null && query.length() > 0) {
-            org.wyona.yarep.core.Node[] nodes = getRealm().getRepository().getSearcher().search(query);
+
+            org.wyona.yarep.core.Node[] nodes = null;
+            String propertyName = getResourceConfigProperty("property-name");
+            if (propertyName != null) {
+                log.warn("DEBUG: Search property '" + propertyName + "': " + query);
+                nodes = getRealm().getRepository().getSearcher().searchProperty(propertyName, query, "/");
+            } else {
+                log.warn("DEBUG: Search fulltext: " + query);
+                nodes = getRealm().getRepository().getSearcher().search(query);
+            }
+
             if (nodes != null && nodes.length > 0) {
                 Result[] results = new Result[nodes.length];
                 for (int i = 0; i < nodes.length; i++) {



More information about the Yanel-commits mailing list