List of usage examples for org.apache.solr.search BitDocSet addUnique
@Override
public void addUnique(int doc)
From source file:org.alfresco.solr.query.SolrCachingOwnerScorer.java
License:Open Source License
public static SolrCachingOwnerScorer createOwnerScorer(SolrIndexSearcher searcher, Similarity similarity, String authority, SolrIndexReader reader) throws IOException { // Get hold of solr top level searcher // Execute query with caching // translate reults to leaf docs // build ordered doc list BitDocSet authorityOwnedDocs = new BitDocSet(new OpenBitSet(searcher.getReader().maxDoc())); HashMap<String, OwnerLookUp> ownerLookUp = (HashMap<String, OwnerLookUp>) searcher .cacheLookup(AlfrescoSolrEventListener.ALFRESCO_CACHE, AlfrescoSolrEventListener.KEY_OWNER_LOOKUP); if (authority.contains("\\|")) { for (String current : authority.split("|")) { OwnerLookUp lookUp = ownerLookUp.get(current); if (lookUp != null) { ResizeableArrayList<CacheEntry> indexedOderedByOwnerIdThenDoc = (ResizeableArrayList<CacheEntry>) searcher .cacheLookup(AlfrescoSolrEventListener.ALFRESCO_ARRAYLIST_CACHE, AlfrescoSolrEventListener.KEY_DBID_LEAF_PATH_BY_OWNER_ID_THEN_LEAF); for (int i = lookUp.getStart(); i < lookUp.getEnd(); i++) { authorityOwnedDocs.addUnique(indexedOderedByOwnerIdThenDoc.get(i).getLeaf()); }//from www.java2s . c o m } } } else { OwnerLookUp lookUp = ownerLookUp.get(authority); if (lookUp != null) { ResizeableArrayList<CacheEntry> indexedOderedByOwnerIdThenDoc = (ResizeableArrayList<CacheEntry>) searcher .cacheLookup(AlfrescoSolrEventListener.ALFRESCO_ARRAYLIST_CACHE, AlfrescoSolrEventListener.KEY_DBID_LEAF_PATH_BY_OWNER_ID_THEN_LEAF); for (int i = lookUp.getStart(); i < lookUp.getEnd(); i++) { authorityOwnedDocs.addUnique(indexedOderedByOwnerIdThenDoc.get(i).getLeaf()); } } } return new SolrCachingOwnerScorer(similarity, authorityOwnedDocs, reader); }