From 7ccae9af5ba3724e42a2277bafdf14a6e7437a6f Mon Sep 17 00:00:00 2001
From: gpawel <gpawel>
Date: Fri, 18 Jan 2013 15:32:28 +0000
Subject: [PATCH] SP-466 BIS-43: Match Text not shown for metaprojects

SVN: 28131
---
 .../generic/server/dataaccess/db/HibernateSearchDAO.java   | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/HibernateSearchDAO.java b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/HibernateSearchDAO.java
index 16923f97934..1ca54589065 100644
--- a/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/HibernateSearchDAO.java
+++ b/openbis/source/java/ch/systemsx/cisd/openbis/generic/server/dataaccess/db/HibernateSearchDAO.java
@@ -192,13 +192,16 @@ final class HibernateSearchDAO extends HibernateDaoSupport implements IHibernate
 
         Query query = null;
 
+        Analyzer chosenAnalyzer = analyzer;
         if (MetaprojectSearch.isMetaprojectField(fieldName))
         {
             String searchTerm =
                     LuceneQueryBuilder.adaptQuery(
                             MetaprojectSearch.getMetaprojectUserQuery(userQuery, userId),
                             useWildcardSearchMode, false);
-            query = LuceneQueryBuilder.parseQuery(fieldName, searchTerm, new IgnoreCaseAnalyzer());
+            query =
+                    LuceneQueryBuilder.parseQuery(fieldName, searchTerm, (chosenAnalyzer =
+                            new IgnoreCaseAnalyzer()));
         } else
         {
             String searchTerm = LuceneQueryBuilder.adaptQuery(userQuery, useWildcardSearchMode);
@@ -216,7 +219,7 @@ final class HibernateSearchDAO extends HibernateDaoSupport implements IHibernate
         hibernateQuery.setFirstResult(0);
         hibernateQuery.setMaxResults(maxResults);
 
-        MyHighlighter highlighter = new MyHighlighter(query, indexReader, analyzer);
+        MyHighlighter highlighter = new MyHighlighter(query, indexReader, chosenAnalyzer);
         hibernateQuery.setResultTransformer(new MatchingEntityResultTransformer(searchableEntity,
                 fieldName, highlighter, dataProvider));
         List<?> list = hibernateQuery.list();
-- 
GitLab