WIP

Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/6be0702d
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/6be0702d
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/6be0702d

Branch: refs/heads/develop
Commit: 6be0702deae02cfa62d5349b911616a70786ceed
Parents: 07097ce
Author: scnakandala <supun.nakand...@gmail.com>
Authored: Tue Oct 18 12:44:46 2016 -0400
Committer: scnakandala <supun.nakand...@gmail.com>
Committed: Tue Oct 18 12:44:46 2016 -0400

----------------------------------------------------------------------
 .../sharing/registry/db/repositories/EntityRepository.java  | 9 ++++++++-
 .../sharing/registry/SharingRegistryServiceTest.java        | 4 ++--
 2 files changed, 10 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/6be0702d/modules/sharing-registry/sharing-registry-server/src/main/java/org/apache/airavata/sharing/registry/db/repositories/EntityRepository.java
----------------------------------------------------------------------
diff --git 
a/modules/sharing-registry/sharing-registry-server/src/main/java/org/apache/airavata/sharing/registry/db/repositories/EntityRepository.java
 
b/modules/sharing-registry/sharing-registry-server/src/main/java/org/apache/airavata/sharing/registry/db/repositories/EntityRepository.java
index 6d60aa9..6064077 100644
--- 
a/modules/sharing-registry/sharing-registry-server/src/main/java/org/apache/airavata/sharing/registry/db/repositories/EntityRepository.java
+++ 
b/modules/sharing-registry/sharing-registry-server/src/main/java/org/apache/airavata/sharing/registry/db/repositories/EntityRepository.java
@@ -67,7 +67,14 @@ public class EntityRepository extends 
AbstractRepository<Entity, EntityEntity, E
             }else 
if(searchCriteria.getSearchField().equals(EntitySearchField.PERMISSION_TYPE_ID)){
                 query += "S." + DBConstants.SharingTable.PERMISSION_TYPE_ID + 
" = '" + searchCriteria.getValue() + "' AND ";
             }else 
if(searchCriteria.getSearchField().equals(EntitySearchField.FULL_TEXT)){
-                query += "E." + DBConstants.EntityTable.FULL_TEXT + " LIKE '%" 
+ searchCriteria.getValue() + "%' AND ";
+                //FULL TEXT Search with Query Expansion
+                String queryTerms = "";
+                for(String word : 
searchCriteria.getValue().trim().replaceAll(" +", " ").split(" ")){
+                    queryTerms += queryTerms + " +" + word;
+                }
+                queryTerms = queryTerms.trim();
+                query += "MATCH(E." + DBConstants.EntityTable.FULL_TEXT + ") 
AGAINST ('" + queryTerms
+                        + "' IN BOOLEAN MODE WITH QUERY EXPANSION) AND ";
             }else 
if(searchCriteria.getSearchField().equals(EntitySearchField.PARRENT_ENTITY_ID)){
                 query += "E." + DBConstants.EntityTable.PARENT_ENTITY_ID + " = 
'" + searchCriteria.getValue() + "' AND ";
             }else 
if(searchCriteria.getSearchField().equals(EntitySearchField.CREATED_TIME)){

http://git-wip-us.apache.org/repos/asf/airavata/blob/6be0702d/modules/sharing-registry/sharing-registry-server/src/test/java/org/apache/airavata/sharing/registry/SharingRegistryServiceTest.java
----------------------------------------------------------------------
diff --git 
a/modules/sharing-registry/sharing-registry-server/src/test/java/org/apache/airavata/sharing/registry/SharingRegistryServiceTest.java
 
b/modules/sharing-registry/sharing-registry-server/src/test/java/org/apache/airavata/sharing/registry/SharingRegistryServiceTest.java
index 2433da0..df9a556 100644
--- 
a/modules/sharing-registry/sharing-registry-server/src/test/java/org/apache/airavata/sharing/registry/SharingRegistryServiceTest.java
+++ 
b/modules/sharing-registry/sharing-registry-server/src/test/java/org/apache/airavata/sharing/registry/SharingRegistryServiceTest.java
@@ -293,9 +293,9 @@ public class SharingRegistryServiceTest {
 
         ArrayList<SearchCriteria> filters = new ArrayList<>();
         SearchCriteria searchCriteria = new SearchCriteria();
-        searchCriteria.setSearchCondition(SearchCondition.LIKE);
+        searchCriteria.setSearchCondition(SearchCondition.FULL_TEXT);
         searchCriteria.setValue("experiment");
-        searchCriteria.setSearchField(EntitySearchField.NAME);
+        searchCriteria.setSearchField(EntitySearchField.FULL_TEXT);
         filters.add(searchCriteria);
 
         searchCriteria = new SearchCriteria();

Reply via email to