You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jena.apache.org by co...@apache.org on 2018/11/16 15:27:22 UTC
jena git commit: Merged ReduceLuceneIndex. This closes #489
Repository: jena
Updated Branches:
refs/heads/master c09d31a52 -> 8aca3ae29
Merged ReduceLuceneIndex. This closes #489
Project: http://git-wip-us.apache.org/repos/asf/jena/repo
Commit: http://git-wip-us.apache.org/repos/asf/jena/commit/8aca3ae2
Tree: http://git-wip-us.apache.org/repos/asf/jena/tree/8aca3ae2
Diff: http://git-wip-us.apache.org/repos/asf/jena/diff/8aca3ae2
Branch: refs/heads/master
Commit: 8aca3ae29f8220ccaf04a69376d130d4f081df1d
Parents: c09d31a
Author: Code Ferret <co...@apache.org>
Authored: Wed Nov 14 09:31:11 2018 -0600
Committer: Code Ferret <co...@apache.org>
Committed: Fri Nov 16 09:21:07 2018 -0600
----------------------------------------------------------------------
jena-text/pom.xml | 10 +++++-----
.../org/apache/jena/query/text/TextIndexLucene.java | 16 ++++++++++------
2 files changed, 15 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/jena/blob/8aca3ae2/jena-text/pom.xml
----------------------------------------------------------------------
diff --git a/jena-text/pom.xml b/jena-text/pom.xml
index 2d0842e..086f0b2 100644
--- a/jena-text/pom.xml
+++ b/jena-text/pom.xml
@@ -86,11 +86,11 @@
<artifactId>lucene-highlighter</artifactId>
</dependency>
- <dependency>
- <groupId>org.apache.lucene</groupId>
- <artifactId>lucene-backward-codecs</artifactId>
- <version>${ver.lucene}</version>
- </dependency>
+ <dependency>
+ <groupId>org.apache.lucene</groupId>
+ <artifactId>lucene-backward-codecs</artifactId>
+ <version>${ver.lucene}</version>
+ </dependency>
</dependencies>
http://git-wip-us.apache.org/repos/asf/jena/blob/8aca3ae2/jena-text/src/main/java/org/apache/jena/query/text/TextIndexLucene.java
----------------------------------------------------------------------
diff --git a/jena-text/src/main/java/org/apache/jena/query/text/TextIndexLucene.java b/jena-text/src/main/java/org/apache/jena/query/text/TextIndexLucene.java
index e7d3177..5150120 100644
--- a/jena-text/src/main/java/org/apache/jena/query/text/TextIndexLucene.java
+++ b/jena-text/src/main/java/org/apache/jena/query/text/TextIndexLucene.java
@@ -101,6 +101,7 @@ public class TextIndexLucene implements TextIndex {
private final Analyzer queryAnalyzer ;
private final String queryParserType ;
private final FieldType ftText ;
+ private final FieldType ftTextNotStored ; // used for lang derived fields
private final boolean isMultilingual ;
private Map<String, Analyzer> multilingualQueryAnalyzers = new HashMap<>();
@@ -155,6 +156,8 @@ public class TextIndexLucene implements TextIndex {
this.queryParserType = config.getQueryParser() ;
log.debug("TextIndexLucene defaultAnalyzer: {}, indexAnalyzer: {}, queryAnalyzer: {}, queryParserType: {}", defaultAnalyzer, indexAnalyzer, queryAnalyzer, queryParserType);
this.ftText = config.isValueStored() ? TextField.TYPE_STORED : TextField.TYPE_NOT_STORED ;
+ // the following is used for lang derived fields
+ this.ftTextNotStored = TextField.TYPE_NOT_STORED ;
if (config.isValueStored() && docDef.getLangField() == null)
log.warn("Values stored but langField not set. Returned values will not have language tag or datatype.");
@@ -327,12 +330,12 @@ public class TextIndexLucene implements TextIndex {
doc.add(new Field(langField, lang, StringField.TYPE_STORED));
if (this.isMultilingual) {
// add a field that uses a language-specific analyzer via MultilingualAnalyzer
- doc.add(new Field(e.getKey() + "_" + lang, (String) e.getValue(), ftText));
+ doc.add(new Field(e.getKey() + "_" + lang, (String) e.getValue(), ftTextNotStored));
// add fields for any defined auxiliary indexes
List<String> auxIndexes = Util.getAuxIndexes(lang);
if (auxIndexes != null) {
for (String auxTag : auxIndexes) {
- doc.add(new Field(e.getKey() + "_" + auxTag, (String) e.getValue(), ftText));
+ doc.add(new Field(e.getKey() + "_" + auxTag, (String) e.getValue(), ftTextNotStored));
}
}
}
@@ -446,7 +449,7 @@ public class TextIndexLucene implements TextIndex {
for ( ScoreDoc sd : sDocs ) {
Document doc = indexSearcher.doc(sd.doc) ;
- log.trace("simpleResults[{}]: {}", sd.doc, doc) ;
+ log.trace("simpleResults[{}]: field: {} doc: {}", sd.doc, field, doc) ;
String entity = doc.get(docDef.getEntityField()) ;
Node literal = null;
@@ -591,7 +594,8 @@ public class TextIndexLucene implements TextIndex {
private List<TextHit> query$(IndexReader indexReader, Node property, String qs, String graphURI, String lang, int limit, String highlight)
throws ParseException, IOException, InvalidTokenOffsetsException {
- String textField = docDef.getField(property) != null ? docDef.getField(property) : docDef.getPrimaryField();
+ String litField = docDef.getField(property) != null ? docDef.getField(property) : docDef.getPrimaryField();
+ String textField = litField;
String textClause = "";
String langField = getDocDef().getLangField();
@@ -645,9 +649,9 @@ public class TextIndexLucene implements TextIndex {
ScoreDoc[] sDocs = indexSearcher.search(query, limit).scoreDocs ;
if (highlight != null) {
- return highlightResults(sDocs, indexSearcher, query, textField, highlight, usingSearchFor, lang);
+ return highlightResults(sDocs, indexSearcher, query, litField, highlight, usingSearchFor, lang);
} else {
- return simpleResults(sDocs, indexSearcher, query, textField);
+ return simpleResults(sDocs, indexSearcher, query, litField);
}
}