Java 类org.apache.lucene.search.join.ToChildBlockJoinQuery 实例源码
项目:search
文件:ChildDocTransformerFactory.java
@Override
public void transform(SolrDocument doc, int docid) {
FieldType idFt = idField.getType();
Object parentIdField = doc.getFirstValue(idField.getName());
String parentIdExt = parentIdField instanceof IndexableField
? idFt.toExternal((IndexableField)parentIdField)
: parentIdField.toString();
try {
Query parentQuery = idFt.getFieldQuery(null, idField, parentIdExt);
Query query = new ToChildBlockJoinQuery(parentQuery, parentsFilter, false);
DocList children = context.searcher.getDocList(query, childFilterQuery, new Sort(), 0, limit);
if(children.matches() > 0) {
DocIterator i = children.iterator();
while(i.hasNext()) {
Integer childDocNum = i.next();
Document childDoc = context.searcher.doc(childDocNum);
SolrDocument solrChildDoc = ResponseWriterUtil.toSolrDocument(childDoc, schema);
// TODO: future enhancement...
// support an fl local param in the transformer, which is used to build
// a private ReturnFields instance that we use to prune unwanted field
// names from solrChildDoc
doc.addChildDocument(solrChildDoc);
}
}
} catch (IOException e) {
doc.put(name, "Could not fetch child Documents");
}
}
项目:read-open-source-code
文件:ChildDocTransformerFactory.java
@Override
public void transform(SolrDocument doc, int docid) {
FieldType idFt = idField.getType();
Object parentIdField = doc.getFirstValue(idField.getName());
String parentIdExt = parentIdField instanceof IndexableField
? idFt.toExternal((IndexableField)parentIdField)
: parentIdField.toString();
try {
Query parentQuery = idFt.getFieldQuery(null, idField, parentIdExt);
Query query = new ToChildBlockJoinQuery(parentQuery, parentsFilter, false);
DocList children = context.searcher.getDocList(query, childFilterQuery, new Sort(), 0, limit);
if(children.matches() > 0) {
DocIterator i = children.iterator();
while(i.hasNext()) {
Integer childDocNum = i.next();
Document childDoc = context.searcher.doc(childDocNum);
SolrDocument solrChildDoc = ResponseWriterUtil.toSolrDocument(childDoc, schema);
// TODO: future enhancement...
// support an fl local param in the transformer, which is used to build
// a private ReturnFields instance that we use to prune unwanted field
// names from solrChildDoc
doc.addChildDocument(solrChildDoc);
}
}
} catch (IOException e) {
doc.put(name, "Could not fetch child Documents");
}
}
项目:search
文件:BlockJoinChildQParser.java
protected Query createQuery(Query parentListQuery, Query query) {
return new ToChildBlockJoinQuery(query, getFilter(parentListQuery), false);
}
项目:read-open-source-code
文件:BlockJoinChildQParser.java
protected Query createQuery(Query parentListQuery, Query query) {
return new ToChildBlockJoinQuery(query, getFilter(parentListQuery), false);
}
项目:read-open-source-code
文件:BlockJoinChildQParser.java
protected Query createQuery(Query parentListQuery, Query query) {
return new ToChildBlockJoinQuery(query, getFilter(parentListQuery), false);
}