blurIndexes = map;
}
Tracer trace = Trace.trace("query setup", Trace.param("table", table));
ShardServerContext shardServerContext = ShardServerContext.getShardServerContext();
ParallelCall<Entry<String, BlurIndex>, BlurResultIterable> call;
TableContext context = getTableContext(table);
FieldManager fieldManager = context.getFieldManager();
org.apache.blur.thrift.generated.Query simpleQuery = blurQuery.query;
ReadInterceptor interceptor = context.getReadInterceptor();
Filter readFilter = interceptor.getFilter();
if (rowId != null) {
if (simpleQuery.recordFilter == null) {
simpleQuery.recordFilter = "+" + BlurConstants.ROW_ID + ":" + rowId;
} else {
simpleQuery.recordFilter = "+" + BlurConstants.ROW_ID + ":" + rowId + " +(" + simpleQuery.recordFilter + ")";
}
}
Filter recordFilterForSearch = QueryParserUtil.parseFilter(table, simpleQuery.recordFilter, false, fieldManager,
_filterCache, context);
Filter rowFilterForSearch = QueryParserUtil.parseFilter(table, simpleQuery.rowFilter, true, fieldManager,
_filterCache, context);
Filter docFilter;
if (recordFilterForSearch == null && readFilter != null) {
docFilter = readFilter;
} else if (recordFilterForSearch != null && readFilter == null) {
docFilter = recordFilterForSearch;
} else if (recordFilterForSearch != null && readFilter != null) {
// @TODO dangerous call because of the bitsets that booleanfilter
// creates.
BooleanFilter booleanFilter = new BooleanFilter();
booleanFilter.add(recordFilterForSearch, Occur.MUST);
booleanFilter.add(readFilter, Occur.MUST);
docFilter = booleanFilter;
} else {
docFilter = null;
}
Query userQuery = QueryParserUtil.parseQuery(simpleQuery.query, simpleQuery.rowQuery, fieldManager,
rowFilterForSearch, docFilter, getScoreType(simpleQuery.scoreType), context);
Query facetedQuery;
FacetExecutor executor = null;
if (blurQuery.facets != null) {
long[] facetMinimums = getFacetMinimums(blurQuery.facets);
executor = new FacetExecutor(blurQuery.facets.size(), facetMinimums, facetedCounts, running);
facetedQuery = new FacetQuery(userQuery, getFacetQueries(blurQuery, fieldManager, context, rowFilterForSearch,
recordFilterForSearch), executor);
} else {
facetedQuery = userQuery;
}
Sort sort = getSort(blurQuery, fieldManager);
call = new SimpleQueryParallelCall(running, table, status, facetedQuery, blurQuery.selector,
_queriesInternalMeter, shardServerContext, runSlow, _fetchCount, _maxHeapPerRowFetch,
context.getSimilarity(), context, sort, _deepPagingCache);
trace.done();
MergerBlurResultIterable merger = new MergerBlurResultIterable(blurQuery);
BlurResultIterable merge = ForkJoin.execute(_executor, blurIndexes.entrySet(), call, new Cancel() {
@Override
public void cancel() {