diff options
author | adrianocrestani <adrianocrestani@13f79535-47bb-0310-9956-ffa450edef68> | 2009-11-29 17:14:59 +0000 |
---|---|---|
committer | adrianocrestani <adrianocrestani@13f79535-47bb-0310-9956-ffa450edef68> | 2009-11-29 17:14:59 +0000 |
commit | a9941f3ba6624b88ef62a2a7bf260f50761ffbf9 (patch) | |
tree | cf72283c615b2b16c9fdd4a8c76b30c2587554a0 /sca-java-1.x/trunk/modules | |
parent | 309409eed45ee2e6d0c78272cbdecb9ea1be1997 (diff) |
fixing TUSCANY-3382
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@885247 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
3 files changed, 9 insertions, 6 deletions
diff --git a/sca-java-1.x/trunk/modules/domain-search/pom.xml b/sca-java-1.x/trunk/modules/domain-search/pom.xml index 577c3b8488..59a34a420c 100644 --- a/sca-java-1.x/trunk/modules/domain-search/pom.xml +++ b/sca-java-1.x/trunk/modules/domain-search/pom.xml @@ -68,19 +68,19 @@ <dependency> <groupId>org.apache.lucene</groupId> <artifactId>lucene-core</artifactId> - <version>2.4-SNAPSHOT</version> + <version>2.9.1</version> </dependency> <dependency> <groupId>org.apache.lucene</groupId> <artifactId>lucene-highlighter</artifactId> - <version>2.4-SNAPSHOT</version> + <version>2.9.1</version> </dependency> <dependency> <groupId>org.apache.lucene</groupId> <artifactId>lucene-memory</artifactId> - <version>2.4-SNAPSHOT</version> + <version>2.9.1</version> </dependency> </dependencies> 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(); |