Added missing vocabulary navigator increment on results from RWI

pull/167/head
luccioman 7 years ago
parent 46c9da6428
commit 1b90479a76

@ -1219,7 +1219,20 @@ public final class SearchEvent implements ScoreMapUpdatesListener {
for (String vocName : genericFacets) {
final String fieldName = CollectionSchema.VOCABULARY_PREFIX + vocName + CollectionSchema.VOCABULARY_TERMS_SUFFIX;
if (facets == null || !facets.containsKey(fieldName)) {
Object docValue = doc.getFieldValue(fieldName);
incrementVocNavigator(doc, vocName, fieldName);
}
}
}
}
/**
* Increment a vocabulary navigator with the given document
* @param doc a document entry. Must not be null.
* @param vocName the name of the vocabulary. Must not be null.
* @param fieldName the name of the field eventually holding the vocabulary information in the document entry
*/
protected void incrementVocNavigator(final URIMetadataNode doc, final String vocName, final String fieldName) {
final Object docValue = doc.getFieldValue(fieldName);
if(docValue instanceof String) {
ScoreMap<String> vocNav = this.vocabularyNavigator.get(vocName);
if (vocNav == null) {
@ -1234,7 +1247,7 @@ public final class SearchEvent implements ScoreMapUpdatesListener {
vocNav = new ConcurrentScoreMap<String>();
this.vocabularyNavigator.put(vocName, vocNav);
}
for (Object singleDocValue : (Collection<?>) docValue) {
for (final Object singleDocValue : (Collection<?>) docValue) {
if (singleDocValue instanceof String) {
vocNav.inc((String) singleDocValue);
}
@ -1242,9 +1255,6 @@ public final class SearchEvent implements ScoreMapUpdatesListener {
}
}
}
}
}
}
public void addExpectedRemoteReferences(int x) {
if ( x > 0 ) {
@ -1574,6 +1584,20 @@ public final class SearchEvent implements ScoreMapUpdatesListener {
}
}
// handle the vocabulary navigator
if (this.vocabularyNavigator != null) {
Set<String> genericFacets = new LinkedHashSet<>();
for (Tagging v : LibraryProvider.autotagging.getVocabularies()) {
genericFacets.add(v.getName());
}
genericFacets.addAll(ProbabilisticClassifier.getContextNames());
for (final String vocName : genericFacets) {
final String fieldName = CollectionSchema.VOCABULARY_PREFIX + vocName
+ CollectionSchema.VOCABULARY_TERMS_SUFFIX;
incrementVocNavigator(page, vocName, fieldName);
}
}
return page; // accept url
}
return null;

Loading…
Cancel
Save