You are viewing a plain text version of this content. The canonical link for it is here.
Posted to oak-issues@jackrabbit.apache.org by "Julian Reschke (Jira)" <ji...@apache.org> on 2019/11/22 10:54:00 UTC

[jira] [Updated] (OAK-8770) Can't get FacetResult

     [ https://issues.apache.org/jira/browse/OAK-8770?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Julian Reschke updated OAK-8770:
--------------------------------
    Summary: Can't get FacetResult  (was: Can't get fectresult)

> Can't get FacetResult
> ---------------------
>
>                 Key: OAK-8770
>                 URL: https://issues.apache.org/jira/browse/OAK-8770
>             Project: Jackrabbit Oak
>          Issue Type: Bug
>          Components: solr
>    Affects Versions: 1.14.0
>            Reporter: zhouxu
>            Priority: Minor
>
> Hello expert!
>     I cannot get FectResult with solr,my code as follow,I debug the "org.apache.jackrabbit.oak.plugins.index.solr.query.SolrQueryIndex",i can get the returned fect result from solr response(queryResponse.getFacetFields()).This question has puzzled me for many days。
>     can anyone tell me:How the solr fect data  enters into the fectresult?
>     1.get fectresult code:
>      String sql = "select [jcr:path] ,[jcr:primaryType] ,      [rep:facet(jcr:primaryType)],id,da_string,da_long,da_date,da_boolean,da_double from da_document where      contains([jcr:primaryType],'da_document') order by da_long asc";
>     Query q = qm.createQuery(sql2, Query.JCR_SQL2);
>      QueryResult result = q.execute();
>      FacetResult facetResult = new FacetResult(result);
>      Set<String> dimensions = facetResult.getDimensions(); // \{ "tags" }
>      List<FacetResult.Facet> facets = facetResult.getFacets("tags");
>      for (FacetResult.Facet facet : facets)
> {        String label = facet.getLabel();        int count = facet.getCount();    }
> 2.SolrQueryIndex code:
>     List<FacetField> returnedFieldFacet = queryResponse.getFacetFields();



--
This message was sent by Atlassian Jira
(v8.3.4#803005)