summaryrefslogtreecommitdiffstats
path: root/sca-java-1.x/trunk/modules/domain-search/src/main/java
diff options
context:
space:
mode:
authoradrianocrestani <adrianocrestani@13f79535-47bb-0310-9956-ffa450edef68>2009-11-29 17:14:59 +0000
committeradrianocrestani <adrianocrestani@13f79535-47bb-0310-9956-ffa450edef68>2009-11-29 17:14:59 +0000
commita9941f3ba6624b88ef62a2a7bf260f50761ffbf9 (patch)
treecf72283c615b2b16c9fdd4a8c76b30c2587554a0 /sca-java-1.x/trunk/modules/domain-search/src/main/java
parent309409eed45ee2e6d0c78272cbdecb9ea1be1997 (diff)
fixing TUSCANY-3382
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@885247 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
-rw-r--r--sca-java-1.x/trunk/modules/domain-search/src/main/java/org/apache/tuscany/sca/domain/search/impl/DomainSearchImpl.java2
-rw-r--r--sca-java-1.x/trunk/modules/domain-search/src/main/java/org/apache/tuscany/sca/domain/search/impl/HighlightingUtil.java7
2 files changed, 6 insertions, 3 deletions
diff --git a/sca-java-1.x/trunk/modules/domain-search/src/main/java/org/apache/tuscany/sca/domain/search/impl/DomainSearchImpl.java b/sca-java-1.x/trunk/modules/domain-search/src/main/java/org/apache/tuscany/sca/domain/search/impl/DomainSearchImpl.java
index 59b80ac026..8004ac6faa 100644
--- a/sca-java-1.x/trunk/modules/domain-search/src/main/java/org/apache/tuscany/sca/domain/search/impl/DomainSearchImpl.java
+++ b/sca-java-1.x/trunk/modules/domain-search/src/main/java/org/apache/tuscany/sca/domain/search/impl/DomainSearchImpl.java
@@ -87,7 +87,7 @@ public class DomainSearchImpl implements DomainSearch {
try {
this.dir =
- new FSDirectory(new File(this.indexDirectoryPath),
+ FSDirectory.getDirectory(new File(this.indexDirectoryPath),
new SimpleFSLockFactory(this.indexDirectoryPath));
} catch (IOException e) {
diff --git a/sca-java-1.x/trunk/modules/domain-search/src/main/java/org/apache/tuscany/sca/domain/search/impl/HighlightingUtil.java b/sca-java-1.x/trunk/modules/domain-search/src/main/java/org/apache/tuscany/sca/domain/search/impl/HighlightingUtil.java
index 356eb88070..ba8e1bf021 100644
--- a/sca-java-1.x/trunk/modules/domain-search/src/main/java/org/apache/tuscany/sca/domain/search/impl/HighlightingUtil.java
+++ b/sca-java-1.x/trunk/modules/domain-search/src/main/java/org/apache/tuscany/sca/domain/search/impl/HighlightingUtil.java
@@ -29,7 +29,7 @@ import org.apache.lucene.search.highlight.Highlighter;
import org.apache.lucene.search.highlight.InvalidTokenOffsetsException;
import org.apache.lucene.search.highlight.NullFragmenter;
import org.apache.lucene.search.highlight.SimpleFragmenter;
-import org.apache.lucene.search.highlight.SpanScorer;
+import org.apache.lucene.search.highlight.QueryScorer;
import org.apache.tuscany.sca.domain.search.Result;
/**
@@ -83,8 +83,11 @@ final public class HighlightingUtil {
CachingTokenFilter tokenStream =
new CachingTokenFilter(new DomainSearchAnalyzer().tokenStream(field, new StringReader(text)));
+ QueryScorer scorer = new QueryScorer(query, field, "");
+ scorer.init(tokenStream);
+
Highlighter highlighter =
- new Highlighter(new DomainSearchFormatter(), new SpanScorer(query, field, tokenStream, ""));
+ new Highlighter(new DomainSearchFormatter(), scorer);
highlighter.setTextFragmenter(fragmenter);
tokenStream.reset();