DocIterator it = list.iterator(); List<Integer> docIds = new ArrayList<Integer>(list.size()); while (it.hasNext()) docIds.add(it.next()); SchemaField keyField = rb.req.getSearcher().getSchema().getUniqueKeyField(); if (null != keyField) if (!returnFields.contains(keyField)) rb.req.getSearcher().getReader().document(docIds.get(0), selector);
if (!(((SolrIndexReader) rb.req.getSearcher().getIndexReader()).getWrappedReader() instanceof lucandra.IndexReader)) return false; throw new IOException("Missing core name"); IndexReader reader = (IndexReader) ((SolrIndexReader) rb.req.getSearcher().getIndexReader()).getWrappedReader(); IndexReader reader = (IndexReader) ((SolrIndexReader) rb.req.getSearcher().getIndexReader()) .getWrappedReader();
Query q = QueryParsing.parseQuery(cmd.query, schema); long total = writer.deleteDocuments(subIndex, q, false); commit(subIndex, true);
@Override public DocSet andNot(DocSet other) { OpenBitSet newbits = (OpenBitSet)(bits.clone()); if (other instanceof BitDocSet) { newbits.andNot(((BitDocSet)other).bits); } else { DocIterator iter = other.iterator(); while (iter.hasNext()) newbits.clear(iter.nextDoc()); } return new BitDocSet(newbits); }
/** * Takes a list of docs (the doc ids actually) and a set of fields to load, * and reads them into an array of Documents. */ public void readDocs(Document[] docs, DocList ids, Set<String> fields) throws IOException { DocIterator iter = ids.iterator(); for (int i=0; i<docs.length; i++) { docs[i] = doc(iter.nextDoc(), fields); } }
DocSet getPositiveDocSet(Query q, DocSetAwareCollector collector) throws IOException { DocSet answer; if (filterCache != null) { answer = (DocSet)filterCache.get(q); if (answer!=null) return answer; } answer = getDocSetNC(q, null, collector); if (filterCache != null) filterCache.put(q,answer); return answer; }
@Override public SortSpec getSort(boolean useGlobal) throws ParseException { SortSpec sort = super.getSort(useGlobal); if (sortStr != null && sortStr.length()>0 && sort.getSort()==null) { Sort oldSort = QueryParsing.parseSort(sortStr, getReq().getSchema()); if( oldSort != null ) { sort.sort = oldSort; } } return sort; }
SortSpec sortSpec() throws SyntaxError { if (sortSpec == null) { sortSpec = qParser != null ? qParser.getSort(true) : QueryParsing.parseSortSpec("id asc", request); sortSpec.setOffset(0); } return sortSpec; }
public int intersectionSize(DocSet other) { // intersection is overloaded in the smaller DocSets to be more // efficient, so dispatch off of it instead. if (!(other instanceof BitDocSet)) { return other.intersectionSize(this); } // less efficient way: do the intersection then get it's size return intersection(other).size(); }
@Override public DocSet andNot(DocSet other) { int[] result = new int[size()]; int resultCount=0; for (int i=0; i<table.length; i++) { int id=table[i]; if (id >= 0 && !other.exists(id)) { result[resultCount++]=id; } } return new HashDocSet(result,0,resultCount); }
public int unionSize(DocSet other) { return this.size() + other.size() - this.intersectionSize(other); }
public DocSet intersection(DocSet other) { // intersection is overloaded in the smaller DocSets to be more // efficient, so dispatch off of it instead. if (!(other instanceof BitDocSet)) { return other.intersection(this); } // Default... handle with bitsets. OpenBitSet newbits = (OpenBitSet)(this.getBits().clone()); newbits.and(other.getBits()); return new BitDocSet(newbits); }
@Override public int intersectionSize(DocSet other) { if (other instanceof SortedIntDocSet || other instanceof HashDocSet) { return other.intersectionSize(this); } HashDocSet h = new HashDocSet(docs,offset,len); return h.intersectionSize(other); } }
@Override public DocSet intersection(DocSet other) { if (other instanceof SortedIntDocSet || other instanceof HashDocSet) { return other.intersection(this); } HashDocSet h = new HashDocSet(docs,offset,len); return h.intersection(other); }
/** * Parse a float. * * @return Float * @throws ParseException */ public Float parseFloat() throws ParseException { float value = sp.getFloat(); consumeArgumentDelimiter(); return value; }
/** * TODO: Doc * * @throws ParseException */ public String parseId() throws ParseException { String value = sp.getId(); consumeArgumentDelimiter(); return value; }
@Override public DocSet union(DocSet other) { OpenBitSet newbits = (OpenBitSet)(bits.clone()); if (other instanceof BitDocSet) { newbits.union(((BitDocSet)other).bits); } else { DocIterator iter = other.iterator(); while (iter.hasNext()) newbits.set(iter.nextDoc()); } return new BitDocSet(newbits); }