use of org.openntf.domino.Document in project org.openntf.domino by OpenNTF.
the class IndexDatabase method restoreRichTextLocationMap.
@Override
public Map<CharSequence, CharSequence> restoreRichTextLocationMap(final CharSequence token, final Object mapKey) {
Map result = null;
Document doc = getValueDocument(token.toString());
String itemName = VALUE_MAP_PREFIX + String.valueOf(mapKey);
if (doc.hasItem(itemName)) {
result = doc.getItemValue(itemName, Map.class);
} else {
result = new ConcurrentHashMap<CaseInsensitiveString, Set<String>>(8, 0.9f, 1);
}
return result;
}
use of org.openntf.domino.Document in project org.openntf.domino by OpenNTF.
the class IndexDatabase method getTermDbids.
// public void writeResults(final CharSequence dbid, final DocumentScanner scanner) {
// Map<CharSequence, Map<CharSequence, Set<CharSequence>>> tlMap = scanner.getTokenLocationMap();
// saveTokenLocationMap(dbid, tlMap, scanner);
// }
/* (non-Javadoc)
* @see org.openntf.domino.big.impl.IIndexDatabase#getTermDbids(java.lang.CharSequence)
*/
@Override
public List<String> getTermDbids(final CharSequence term) {
List<String> result = new ArrayList<String>();
Document doc = getTermDocument(term);
for (Item item : doc.getItems()) {
String itemName = item.getName();
if (itemName.startsWith(TERM_MAP_PREFIX)) {
String dbid = itemName.substring(TERM_MAP_PREFIX.length());
result.add(dbid);
}
}
return result;
}
use of org.openntf.domino.Document in project org.openntf.domino by OpenNTF.
the class IndexDatabase method getTermUnidInDbsItems.
/* (non-Javadoc)
* @see org.openntf.domino.big.impl.IIndexDatabase#getTermUnidInDbsItems(java.lang.String, java.util.Collection, java.util.Collection)
*/
@Override
public Set<CharSequence> getTermUnidInDbsItems(final String term, final Collection<String> dbids, final Collection<?> itemNames) {
Set<CharSequence> unids = new HashSet<CharSequence>();
Document doc = getTermDocument(term);
for (String dbid : dbids) {
String itemName = TERM_MAP_PREFIX + dbid;
if (doc.hasItem(itemName)) {
Map termMap = doc.getItemValue(itemName, Map.class);
for (Object key : itemNames) {
CaseInsensitiveString ciskey = null;
if (key instanceof CaseInsensitiveString) {
ciskey = (CaseInsensitiveString) key;
} else if (key instanceof String) {
ciskey = new CaseInsensitiveString((String) key);
} else {
ciskey = new CaseInsensitiveString(String.valueOf(key));
}
Object termObj = termMap.get(ciskey);
if (termObj != null) {
if (termObj instanceof Collection) {
unids.addAll((Collection) termObj);
} else if (termObj instanceof CharSequence) {
unids.add(((CharSequence) termObj).toString());
} else {
unids.add(String.valueOf(termObj));
}
}
}
}
}
return unids;
}
use of org.openntf.domino.Document in project org.openntf.domino by OpenNTF.
the class IndexDatabase method restoreNameLocationMap.
/* (non-Javadoc)
* @see org.openntf.domino.big.impl.IIndexDatabase#restoreNameLocationMap(java.lang.CharSequence, java.lang.Object)
*/
@Override
public Map<CharSequence, Set<CharSequence>> restoreNameLocationMap(final CharSequence name, final Object mapKey) {
Map result = null;
Document doc = getNameDocument(name.toString());
String itemName = TERM_MAP_PREFIX + String.valueOf(mapKey);
if (doc.hasItem(itemName)) {
result = doc.getItemValue(itemName, Map.class);
} else {
result = new ConcurrentHashMap<CaseInsensitiveString, Set<String>>(8, 0.9f, 1);
}
return result;
}
use of org.openntf.domino.Document in project org.openntf.domino by OpenNTF.
the class IndexDatabase method getTermLinksInDbsItems.
/* (non-Javadoc)
* @see org.openntf.domino.big.impl.IIndexDatabase#getTermLinksInDbsItems(org.openntf.domino.Session, java.lang.String, java.lang.String, java.util.Collection, java.util.Collection)
*/
@Override
public Set<String> getTermLinksInDbsItems(final Session session, final String serverName, final String term, final Collection<CharSequence> dbids, final Collection<?> itemNames) {
Set<String> unids = new HashSet<String>();
Document doc = getTermDocument(term);
for (CharSequence dbid : dbids) {
String itemName = TERM_MAP_PREFIX + dbid;
if (doc.hasItem(itemName)) {
Map termMap = doc.getItemValue(itemName, Map.class);
// if (db != null) {
for (Object key : itemNames) {
CaseInsensitiveString ciskey = null;
if (key instanceof CaseInsensitiveString) {
ciskey = (CaseInsensitiveString) key;
} else if (key instanceof String) {
ciskey = new CaseInsensitiveString((String) key);
} else {
ciskey = new CaseInsensitiveString(String.valueOf(key));
}
Object termObj = termMap.get(ciskey);
if (termObj != null) {
if (termObj instanceof Collection) {
for (Object unid : (Collection) termObj) {
// Document curDoc = db.getDocumentByUNID((String) unid);
unids.add("http://localhost/__" + dbid + ".nsf/0/" + unid);
}
// unids.addAll((Collection) termObj);
} else if (termObj instanceof CharSequence) {
// Document curDoc = db.getDocumentByUNID((String) ((CharSequence) termObj).toString());
unids.add("http://localhost/__" + dbid + ".nsf/0/" + ((CharSequence) termObj).toString());
// unids.add(((CharSequence) termObj).toString());
} else {
unids.add(String.valueOf(termObj));
}
}
}
// }
}
}
return unids;
}
Aggregations