Search in sources :

Example 1 with QueryRequestWrapper

use of com.qlangtech.tis.runtime.module.screen.IndexQuery.QueryRequestWrapper in project tis by qlangtech.

the class IndexQueryAction method doGetServerNodes.

/**
 * @param context
 */
public void doGetServerNodes(Context context) throws Exception {
    AppDomainInfo domain = this.getAppDomain();
    if (domain instanceof Nullable) {
        throw new IllegalStateException("execute phase must be Collection aware");
    }
    QueryResutStrategy queryStrategy = QueryIndexServlet.createQueryResutStrategy(domain, new QueryRequestWrapper(getRequest(), context), getResponse(), getDaoContext());
    List<ServerJoinGroup> nodes = queryStrategy.queryProcess();
    List<PSchemaField> sfields = IndexQuery.getSfields(this.getRequest(), queryStrategy, nodes);
    Map<String, Object> props = Maps.newHashMap();
    props.put("nodes", queryStrategy.selectCandiate);
    props.put("fields", sfields.stream().map((c) -> c.getName()).collect(Collectors.toList()));
    this.setBizResult(context, props);
}
Also used : AppDomainInfo(com.qlangtech.tis.manage.common.AppDomainInfo) PSchemaField(com.qlangtech.tis.solrdao.pojo.PSchemaField) QueryRequestWrapper(com.qlangtech.tis.runtime.module.screen.IndexQuery.QueryRequestWrapper) Nullable(com.qlangtech.tis.pubhook.common.Nullable)

Example 2 with QueryRequestWrapper

use of com.qlangtech.tis.runtime.module.screen.IndexQuery.QueryRequestWrapper in project tis by qlangtech.

the class IndexQueryAction method doQuery.

@Func(value = PermissionConstant.PERMISSION_INDEX_QUERY, sideEffect = false)
public void doQuery(Context context) throws Exception {
    List<String> sfields = Lists.newArrayList(this.getRequest().getParameterValues("sfields"));
    final String query = StringUtils.defaultIfEmpty((this.getString("q")).replaceAll("\r|\n", StringUtils.EMPTY), "*:*");
    Integer shownum = null;
    shownum = this.getInt("shownum", 3);
    QueryRequestWrapper request = new QueryRequestWrapper(this.getRequest(), context);
    QueryRequestContext requestContext = new QueryRequestContext(request);
    final String sort = getString("sort");
    final String[] fqs = this.getStringArray("fq");
    final QueryResutStrategy queryResutStrategy = QueryIndexServlet.createQueryResutStrategy(this.getAppDomain(), request, getResponse(), getDaoContext());
    final List<ServerJoinGroup> serverlist = queryResutStrategy.queryProcess();
    QueryIndexServlet.execuetQuery(this, this.getAppDomain(), requestContext, this.getDaoContext(), queryResutStrategy, serverlist, query, sort, fqs, shownum, sfields);
}
Also used : QueryRequestContext(com.qlangtech.tis.runtime.module.screen.IndexQuery.QueryRequestContext) QueryRequestWrapper(com.qlangtech.tis.runtime.module.screen.IndexQuery.QueryRequestWrapper) Func(com.qlangtech.tis.manage.spring.aop.Func)

Aggregations

QueryRequestWrapper (com.qlangtech.tis.runtime.module.screen.IndexQuery.QueryRequestWrapper)2 AppDomainInfo (com.qlangtech.tis.manage.common.AppDomainInfo)1 Func (com.qlangtech.tis.manage.spring.aop.Func)1 Nullable (com.qlangtech.tis.pubhook.common.Nullable)1 QueryRequestContext (com.qlangtech.tis.runtime.module.screen.IndexQuery.QueryRequestContext)1 PSchemaField (com.qlangtech.tis.solrdao.pojo.PSchemaField)1