Package org.apache.solr.client.solrj.response

Examples of org.apache.solr.client.solrj.response.FacetField


        try
        {
            String query = "a_dept:\"" + from +"\" OR b_dept:\"" + from +"\"";
            QueryResponse rsp = shootQuery(query, true, "focus_dept");           
            FacetField relations = rsp.getFacetField("focus_dept");           
            int otherDPconnected = relations.getValueCount();

           
            query = "a_dept:\"" + from +"\" AND b_dept:\"" + from +"\"";
            rsp = shootQuery(query, true, "focus_auth");           
            relations = rsp.getFacetField("focus_auth");
            int internalRPs = relations.getValueCount();

            query = "a_dept:\"" + from +"\" OR b_dept:\"" + from +"\"";
            rsp = shootQuery(query, true, "focus_auth");           
            relations = rsp.getFacetField("focus_auth");           
            int fromOtherDPconnected = relations.getValueCount();
           
            query = "focus_dept:\"" + from +"|||null\" OR focus_dept:\"null|||" + from +"\"";
            rsp = shootQuery(query, true, "focus_dept");
            relations = rsp.getFacetField("focus_dept")
            int externalRPs = (int)rsp.getResults().getNumFound();
            int externalCardinality = relations.getValueCount();           
           
            //need to remove n row from facet because the first match the department and one or two are matching with external
            otherDPconnected = otherDPconnected - 1 - externalCardinality;
           
            result.put("external", externalRPs);
View Full Code Here


                key1, key2, key3);
        totalResolutBean.setName(key2);
        totalResolutBean.setHits(1);
        try
        {
            FacetField times = solrResponse.getFacetDate("time");
            String[][] data = new String[times.getValues().size()][2];
            for (int i = 0; i < times.getValues().size(); i++)
            {
                data[i][0] = times.getValues().get(i).getName();
                data[i][1] = String
                        .valueOf(times.getValues().get(i).getCount());
            }
            totalResolutBean.setDataTable(data);
        }
        catch (Exception e)
        {
View Full Code Here

        query.setRows(0);

        QueryResponse qResponse = ((CrisSearchService) searchService)
                .search(query);
       
        FacetField facetField = qResponse.getFacetField("pjsponsor_filter");
       
        List<DiscoverResult.FacetResult> sponsors = new ArrayList<DiscoverResult.FacetResult>();
        List<Count> values = facetField.getValues();
        if (values != null)
        {
            for (FacetField.Count facetValue : values) {
                DiscoverResult.FacetResult fr = searchService.getDiscoveryFacet(context, facetField, facetValue);
                sponsors.add(fr);
            }
        }
        FacetField facetFieldStatus = qResponse.getFacetField("pjstatus_filter");
       
        List<DiscoverResult.FacetResult> status = new ArrayList<DiscoverResult.FacetResult>();
        List<Count> valuesStatus = facetFieldStatus.getValues();
        if (valuesStatus != null)
        {
            for (FacetField.Count facetValue : valuesStatus) {
                DiscoverResult.FacetResult fr = searchService.getDiscoveryFacet(context, facetFieldStatus, facetValue);
                status.add(fr);
View Full Code Here

    query.setRows(0);

    QueryResponse qResponse = ((CrisSearchService) searchService)
        .search(query);
   
    FacetField facetField = qResponse.getFacetField("faculty_filter");
   
    List<DiscoverResult.FacetResult> faculties = new ArrayList<DiscoverResult.FacetResult>();
    List<Count> values = facetField.getValues();
    if (values != null)
    {
      for (FacetField.Count facetValue : values) {
        DiscoverResult.FacetResult fr = searchService.getDiscoveryFacet(context, facetField, facetValue);
        faculties.add(fr);
View Full Code Here

    solrQuery.setFacetMinCount(1);
    solrQuery.setRows(0);

    QueryResponse rsp = service.search(solrQuery);

    FacetField facets = rsp.getFacetField("type");
    for(Count facet : facets.getValues()) {
      result.put(facet.getName(), Integer.valueOf((int)facet.getCount()));     
    }   
    return result;
  }
View Full Code Here

            solrQuery.addFacetField(FACET);
            solrQuery.setFacetLimit(Integer.MAX_VALUE);
            solrQuery.setFacetMinCount(1);
            solrQuery.setRows(0);
            QueryResponse rsp = service.search(solrQuery);
            FacetField facets = rsp.getFacetField(FACET);

            // for each interests get authority's authors
            List<VisualizationGraphNode> result = null;
            int counter = 0;
            external: for (Count facetElement : facets.getValues())
            {

                counter++;
                log.debug("" + counter + " of " + facets.getValueCount());
                result = new LinkedList<VisualizationGraphNode>();
                try
                {
                    String facetValue = facetElement.getName();
                    String[] splittedFacetValue = facetValue.split("\\|\\|\\|");
                    if (!splittedFacetValue[0].equals("null") && splittedFacetValue[0].equals(splittedFacetValue[1]))
                    {
                        SolrQuery solrQuery2 = new SolrQuery();
                        solrQuery2.setQuery("type:" + connection + " AND "
                                + FACET + ":\"" + ClientUtils.escapeQueryChars(facetValue) + "\" AND a_auth:[* TO *] AND b_auth:[* TO *]");

                        solrQuery2.addFacetField(FACET_AUTHOR);
                        solrQuery2.setFacetMinCount(1);
                        solrQuery2.setFacetLimit(Integer.MAX_VALUE);
                        solrQuery2.setRows(0);

                        QueryResponse rsp2 = service.search(
                                solrQuery2);
                        FacetField relations = rsp2.getFacetField(FACET_AUTHOR);
                        int i = 0;
                        internal: for (Count relation : relations.getValues())
                        {
                            log.debug("" + counter + " works on " + i + " of "
                                    + relations.getValueCount());
                            List<String> values = new LinkedList<String>();
                            values.add(splittedFacetValue[0]);

                            String aaa = relation.getName();
                            String[] split = aaa.split("\\|\\|\\|");
View Full Code Here

        // solrQuery.addFilterQuery("authors_fauthority:rp00001");
        solrQuery.setFacetLimit(Integer.MAX_VALUE);
        solrQuery.setFacetMinCount(1);
        solrQuery.setRows(0);
        QueryResponse rsp = getService().getSearcher().search(solrQuery);
        FacetField facets = rsp.getFacetField(getFacetFieldQuery());
        System.out.println(facets.getValueCount());
        // for each interests get authority's authors
        List<VisualizationGraphNode> result = null;
        int counter = 0;
        external: for (Count facetElement : facets.getValues())
        {
            counter++;

            log.debug(getConnectionName() + " - " + counter + " of "
                    + facets.getValueCount());
            System.out.println(getConnectionName() + " - " + counter + " of "
                    + facets.getValueCount());
            result = new LinkedList<VisualizationGraphNode>();
            try
            {
                String facetValue = facetElement.getName();
                List<String> relations = getValues(facetValue);

                int i = 0;
                internal: for (String relation : relations)
                {

                    log.debug("" + counter + " works on " + i + " of "
                            + relations.size());
                    System.out.println(getConnectionName() + " - " + counter
                            + " of " + facets.getValueCount() + " works on "
                            + i + " of " + relations.size());
                    String aaa = relation;
                    String[] split = aaa.split("\\|\\|\\|");

                    String a = aaa;
View Full Code Here

        // solrQuery.addFilterQuery("authors_fauthority:rp00001");
        solrQuery.setFacetLimit(Integer.MAX_VALUE);
        solrQuery.setFacetMinCount(1);
        solrQuery.setRows(0);
        QueryResponse rsp = getService().getSearcher().search(solrQuery);
        FacetField facets = rsp.getFacetField(getFacetFieldQuery());
        System.out.println(facets.getValueCount());
        // for each interests get authority's authors
        List<VisualizationGraphNode> result = null;
        int counter = 0;
        external: for (Count facetElement : facets.getValues())
        {
            counter++;

            log.debug(getConnectionName() + " - " + counter + " of "
                    + facets.getValueCount());
            System.out.println(getConnectionName() + " - " + counter + " of "
                    + facets.getValueCount());
            result = new LinkedList<VisualizationGraphNode>();
            try
            {

                String facetValue = facetElement.getName();

                solrQuery = new SolrQuery();
                String query = (useJoin()?getJoin():"") + getFacetFieldQuery() + ":\"" + ClientUtils.escapeQueryChars(facetValue) + "\"";
                solrQuery.setQuery(query);
                solrQuery.addFacetField(getFacet(facetValue));
                solrQuery.setFacetMinCount(1);
                solrQuery.setFacetLimit(getFacetLimit());
                solrQuery.setRows(0);

                rsp = getService().getSearcher().search(solrQuery);
                FacetField relations = rsp.getFacetField(getFacet(facetValue));
                int i = 0;
                internal: for (Count relation : relations.getValues())
                {

                    log.debug("" + counter + " works on " + i + " of "
                            + relations.getValueCount());
                    System.out.println(getConnectionName() + " - " + counter
                            + " of " + facets.getValueCount() + " works on "
                            + i + " of " + relations.getValueCount());
                    String aaa = relation.getName();
                    String[] split = aaa.split("\\|\\|\\|");

                    String a = aaa;
                    String a_authority = null;
                    String a_dept = null;
                    String a_displayValue = "";

                    if (split.length > 1)
                    {
                                               
                        String[] splitAuthority = split[1].split(splitterAuthority);
                       
                        a_displayValue = splitAuthority[0];
                        if (splitAuthority.length > 1)
                        {
                            a_authority = splitAuthority[1];
                            // a_dept = ResearcherPageUtils
                            // .getDepartment(a_authority);
                            a_dept = getDepartmentFromSOLR(a_authority);
                        }
                       
                    }

                    internalprivate: for (int j = i; j < relations.getValues()
                            .size(); j++)
                    {
                        List<String> values = new LinkedList<String>();
                        values.add(facetValue);

                        String bbb = relations.getValues().get(j).getName();
                        split = bbb.split("\\|\\|\\|");

                        String b = bbb;
                        String b_authority = null;
                        String b_dept = null;
View Full Code Here

        solrQuery.setFacetMinCount(1);
        solrQuery.setRows(0);

        QueryResponse rsp = service.search(solrQuery);

        FacetField facets = rsp.getFacetField(FACET_SEARCH);

        JsGraph rsGraph = null;
        String src = null;
        if (authority != null && !authority.isEmpty())
        {
            src = authority;
            rsGraph = new JsGraph();
            rsGraph.setId(authority);
            rsGraph.setName(name);
            JsGraphNodeData dataNode = new JsGraphNodeData();
            dataNode.setColor(getNodeCustomColor());
            dataNode.setType(getType());
            dataNode.setModeStyle("fill");
            rsGraph.setData(dataNode);

        }
        else
        {
            src = name;
            rsGraph = new JsGraph();
            rsGraph.setId(name);
            rsGraph.setName(name);
            JsGraphNodeData dataNodeLeaf = new JsGraphNodeData();
            dataNodeLeaf.setColor(getNodeLeafCustomColor());           
            dataNodeLeaf.setType(getType());
            dataNodeLeaf.setModeStyle("stroke");
            rsGraph.setData(dataNodeLeaf);

        }
        if (rsGraph != null)
        {
            if (facets != null && facets.getValueCount() > 0)
            {
                for (Count facet : facets.getValues())
                {
                    if (facet.getCount() > 0)
                    {

                        String node2 = (String) facet.getName();
View Full Code Here

        solrQuery.addFacetField(FACET_METRICS);
        solrQuery.setFacetLimit(Integer.MAX_VALUE);
        solrQuery.setFacetMinCount(1);
        solrQuery.setRows(0);
        QueryResponse rsp = getService().search(solrQuery);
        FacetField facets = rsp.getFacetField(FACET_METRICS);

        // for each interests get authority's authors
        List<ResearcherPage> result = new LinkedList<ResearcherPage>();
        int counter = 0;
        external: for (Count facetElement : facets.getValues())
        {
            counter++;
            log.debug("" + counter + " of " + facets.getValueCount());
            ResearcherPage researcher = null;
            try
            {
                String facetValue = facetElement.getName();

                Integer realPersistentIdentifier = ResearcherPageUtils
                        .getRealPersistentIdentifier(facetValue, ResearcherPage.class);
                researcher = applicationService
                        .get(ResearcherPage.class, realPersistentIdentifier);
                //researcher.getDynamicField().setAnagraficaLazy(applicationService.getAnagraficaByRP(realPersistentIdentifier));
           
                solrQuery = new SolrQuery();
                solrQuery.setQuery("type:" + getType() + " AND entity:" + ConstantNetwork.ENTITY_RP + " AND " + FACET_METRICS + ":\"" + facetValue + "\"");
                solrQuery.addFacetField(FACET_SEARCH);
                solrQuery.setFacetMinCount(1);
                solrQuery.setFacetLimit(Integer.MAX_VALUE);
                solrQuery.setRows(0);

                rsp = getService().search(solrQuery);
                FacetField relations = rsp.getFacetField(FACET_SEARCH);
                int i = 0;
                int nConnections = 0;
                int maxStrength = 0;
                int sumStrength = 0;
                List<Long> quadraticVarianceArrays = new ArrayList<Long>();
                nConnections = Integer.valueOf(relations
                        .getValueCount() - 1);
                internal: for (Count relation : relations.getValues())
                {

                    log.debug("" + counter + " works on " + i + " of "
                            + relations.getValueCount());

                    if (i == 0)
                    {                    
                        i++;
                        continue internal;
View Full Code Here

TOP

Related Classes of org.apache.solr.client.solrj.response.FacetField

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.