热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

javasolrrequest_JavaSolrRequestInfo.getResponseBuilder方法代码示例

importorg.apache.solr.request.SolrRequestInfo;导入方法依赖的package包类publicJoinQueryWeight(SolrIn

import org.apache.solr.request.SolrRequestInfo; //导入方法依赖的package包/类

public JoinQueryWeight(SolrIndexSearcher searcher) {

this.fromSearcher = searcher;

SolrRequestInfo info = SolrRequestInfo.getRequestInfo();

if (info != null) {

rb = info.getResponseBuilder();

}

if (fromIndex == null) {

this.fromSearcher = searcher;

} else {

if (info == null) {

throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, "Cross-core join must have SolrRequestInfo");

}

CoreContainer container = searcher.getCore().getCoreDescriptor().getCoreContainer();

final SolrCore fromCore = container.getCore(fromIndex);

if (fromCore == null) {

throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, "Cross-core join: no such core " + fromIndex);

}

if (info.getReq().getCore() == fromCore) {

// if this is the same core, use the searcher passed in... otherwise we could be warming and

// get an older searcher from the core.

fromSearcher = searcher;

} else {

// This could block if there is a static warming query with a join in it, and if useColdSearcher is true.

// Deadlock could result if two cores both had useColdSearcher and had joins that used eachother.

// This would be very predictable though (should happen every time if misconfigured)

fromRef = fromCore.getSearcher(false, true, null);

// be careful not to do anything with this searcher that requires the thread local

// SolrRequestInfo in a manner that requires the core in the request to match

fromSearcher = fromRef.get();

}

if (fromRef != null) {

final RefCounted ref = fromRef;

info.addCloseHook(new Closeable() {

@Override

public void close() {

ref.decref();

}

});

}

info.addCloseHook(new Closeable() {

@Override

public void close() {

fromCore.close();

}

});

}

this.toSearcher = searcher;

}



推荐阅读
author-avatar
百花一枝梅
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有