public void setDocument(DocumentImpl doc, int newMode) { document = doc; mode = newMode; IndexSpec indexConf = document.getCollection().getIndexConfiguration(document.getBroker()); if (indexConf != null) config = indexConf.getFulltextIndexSpec(); engine.setDocument(document); }
public StoredNode getReindexRoot(StoredNode node, NodePath path, boolean includeSelf) { if (node.getNodeType() == Node.ATTRIBUTE_NODE) return null; IndexSpec indexConf = node.getDocument().getCollection().getIndexConfiguration(node.getDocument().getBroker()); if (indexConf != null) { FulltextIndexSpec config = indexConf.getFulltextIndexSpec(); if (config == null) return null; boolean reindexRequired = false; int len = node.getNodeType() == Node.ELEMENT_NODE && !includeSelf ? path.length() - 1 : path.length(); for (int i = 0; i < len; i++) { QName qn = path.getComponent(i); if (config.hasQNameIndex(qn)) { reindexRequired = true; break; } } if (reindexRequired) { StoredNode topMost = null; StoredNode currentNode = node; while (currentNode != null) { if (config.hasQNameIndex(currentNode.getQName())) topMost = currentNode; currentNode = (StoredNode) currentNode.getParentNode(); } return topMost; } } return null; }
// Build location index private com.google.appengine.api.search.Index getLocationIndex() { IndexSpec indexSpec = IndexSpec.newBuilder() .setName(LOCATION_INDEX) .setConsistency(Consistency.PER_DOCUMENT) .build(); return SearchServiceFactory.getSearchService().getIndex(indexSpec); }
/** Extension point allowing the Index implementation to be modified */ protected Index getIndex() { SearchService searchService = SearchServiceFactory.getSearchService(); return searchService.getIndex(IndexSpec.newBuilder().setName(indexName)); }