Examples of FacetField


Examples of org.apache.lucene.facet.FacetField

    // Writes facet ords to a separate directory from the main index
    DirectoryTaxonomyWriter taxoWriter = new DirectoryTaxonomyWriter(taxoDir);

    Document doc = new Document();
    doc.add(new FacetField("Author", "Bob"));
    doc.add(new FacetField("Publish Date", "2010", "10", "15"));
    indexWriter.addDocument(config.build(taxoWriter, doc));

    doc = new Document();
    doc.add(new FacetField("Author", "Lisa"));
    doc.add(new FacetField("Publish Date", "2010", "10", "20"));
    indexWriter.addDocument(config.build(taxoWriter, doc));

    doc = new Document();
    doc.add(new FacetField("Author", "Lisa"));
    doc.add(new FacetField("Publish Date", "2012", "1", "1"));
    indexWriter.addDocument(config.build(taxoWriter, doc));

    doc = new Document();
    doc.add(new FacetField("Author", "Susan"));
    doc.add(new FacetField("Publish Date", "2012", "1", "7"));
    indexWriter.addDocument(config.build(taxoWriter, doc));

    doc = new Document();
    doc.add(new FacetField("Author", "Frank"));
    doc.add(new FacetField("Publish Date", "1999", "5", "5"));
    indexWriter.addDocument(config.build(taxoWriter, doc));
   
    indexWriter.close();
    taxoWriter.close();
  }
View Full Code Here

Examples of org.apache.lucene.facet.FacetField

public class IndexAndTaxonomyRevisionTest extends ReplicatorTestCase {
 
  private Document newDocument(TaxonomyWriter taxoWriter) throws IOException {
    FacetsConfig config = new FacetsConfig();
    Document doc = new Document();
    doc.add(new FacetField("A", "1"));
    return config.build(taxoWriter, doc);
  }
View Full Code Here

Examples of org.apache.lucene.facet.FacetField

  static FacetField newCategory() {
    Random r = random();
    String l1 = "l1." + r.nextInt(10); // l1.0-l1.9 (10 categories)
    String l2 = "l2." + r.nextInt(30); // l2.0-l2.29 (30 categories)
    String l3 = "l3." + r.nextInt(100); // l3.0-l3.99 (100 categories)
    return new FacetField(l1, l2, l3);
  }
View Full Code Here

Examples of org.apache.lucene.facet.FacetField

          while (numDocs.decrementAndGet() > 0) {
            try {
              Document doc = new Document();
              int numCats = random.nextInt(3) + 1; // 1-3
              while (numCats-- > 0) {
                FacetField ff = newCategory();
                doc.add(ff);

                FacetLabel label = new FacetLabel(ff.dim, ff.path);
                // add all prefixes to values
                int level = label.length;
View Full Code Here

Examples of org.apache.lucene.facet.FacetField

                  paths.add(path);
                  break;
                }
              }
            }
            doc.add(new FacetField("field", path));
          }
          try {
            w.addDocument(config.build(tw, doc));
            if (mgr != null && random().nextDouble() < 0.1) {
              w.commit();
View Full Code Here

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

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

                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

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

        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

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

    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

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

    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
TOP
Copyright © 2018 www.massapi.com. 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.