use of org.apache.solr.search.join.BlockJoinParentQParser.AllParentsAware in project lucene-solr by apache.
the class ChildFieldValueSourceParser method parse.
@Override
public ValueSource parse(FunctionQParser fp) throws SyntaxError {
final String sortFieldName = fp.parseArg();
final Query query;
if (fp.hasMoreArguments()) {
query = fp.parseNestedQuery();
} else {
query = fp.subQuery(fp.getParam(CommonParams.Q), BlockJoinParentQParserPlugin.NAME).getQuery();
}
BitSetProducer parentFilter;
BitSetProducer childFilter;
SchemaField sf;
try {
AllParentsAware bjQ;
if (!(query instanceof AllParentsAware)) {
throw new SyntaxError("expect a reference to block join query " + AllParentsAware.class.getSimpleName() + " in " + fp.getString());
}
bjQ = (AllParentsAware) query;
parentFilter = BlockJoinParentQParser.getCachedFilter(fp.getReq(), bjQ.getParentQuery()).filter;
childFilter = BlockJoinParentQParser.getCachedFilter(fp.getReq(), bjQ.getChildQuery()).filter;
if (sortFieldName == null || sortFieldName.equals("")) {
throw new SyntaxError("field is omitted in " + fp.getString());
}
sf = fp.getReq().getSchema().getFieldOrNull(sortFieldName);
if (null == sf) {
throw new SyntaxError(NAME + " sort param field \"" + sortFieldName + "\" can't be found in schema");
}
} catch (SyntaxError e) {
log.error("can't parse " + fp.getString(), e);
throw e;
}
return new BlockJoinSortFieldValueSource(childFilter, parentFilter, sf);
}
Aggregations