Package org.apache.lucene.queries.function.valuesource

Examples of org.apache.lucene.queries.function.valuesource.IntFieldSource


      return ((Expression)o).getValueSource(this);
    }
    SortField field = (SortField) o;
    switch(field.getType()) {
      case INT:
        return new IntFieldSource(field.getField(), (IntParser) field.getParser());
      case LONG:
        return new LongFieldSource(field.getField(), (LongParser) field.getParser());
      case FLOAT:
        return new FloatFieldSource(field.getField(), (FloatParser) field.getParser());
      case DOUBLE:
View Full Code Here


        )),
        new float[] { 1f, 1f });
  }
 
  public void testInt() throws Exception {
    assertHits(new FunctionQuery(new IntFieldSource("int")),
        new float[] { 35f, 54f });
  }
View Full Code Here

        3, 1, 4)),
        new float[] { 0.1f, 0.1f });
  }
 
  public void testScale() throws Exception {
    assertHits(new FunctionQuery(new ScaleFloatFunction(new IntFieldSource("int"), 0, 1)),
       new float[] { 0.0f, 1.0f });
  }
View Full Code Here

    // for all non-deleted docs in the index); normally
    // you'd use a "normal" query and one of the
    // Facets.search utility methods:
    searcher.search(new MatchAllDocsQuery(), c);

    TaxonomyFacetSumValueSource facets = new TaxonomyFacetSumValueSource(taxoReader, new FacetsConfig(), c, new IntFieldSource("num"));

    // Retrieve & verify results:
    assertEquals("dim=Author path=[] value=145.0 childCount=4\n  Lisa (50.0)\n  Frank (45.0)\n  Susan (40.0)\n  Bob (10.0)\n", facets.getTopChildren(10, "Author").toString());

    taxoReader.close();
View Full Code Here

    taxoWriter.close();

    FacetsCollector c = new FacetsCollector();
    searcher.search(new MatchAllDocsQuery(), c);   

    TaxonomyFacetSumValueSource facets = new TaxonomyFacetSumValueSource(taxoReader, new FacetsConfig(), c, new IntFieldSource("num"));

    // Ask for top 10 labels for any dims that have counts:
    List<FacetResult> results = facets.getAllDims(10);

    assertEquals(3, results.size());
View Full Code Here

    taxoWriter.close();

    FacetsCollector c = new FacetsCollector();
    searcher.search(new MatchAllDocsQuery(), c);   

    TaxonomyFacetSumValueSource facets = new TaxonomyFacetSumValueSource(taxoReader, config, c, new IntFieldSource("num"));

    // Ask for top 10 labels for any dims that have counts:
    List<FacetResult> results = facets.getAllDims(10);
    assertTrue(results.isEmpty());
View Full Code Here

    IndexReader reader = writer.getReader();
    writer.close();
    IndexSearcher searcher = newSearcher(reader);

    // Get ValueSource from FieldCache
    IntFieldSource src = new IntFieldSource("value");
    // ...and make it a sort criterion
    SortField sf = src.getSortField(false).rewrite(searcher);
    Sort orderBy = new Sort(sf);

    // Get hits sorted by our FunctionValues (ascending values)
    Query q = new MatchAllDocsQuery();
    TopDocs hits = searcher.search(q, Integer.MAX_VALUE, orderBy);
View Full Code Here

    // for all non-deleted docs in the index); normally
    // you'd use a "normal" query and one of the
    // Facets.search utility methods:
    searcher.search(new MatchAllDocsQuery(), c);

    TaxonomyFacetSumValueSource facets = new TaxonomyFacetSumValueSource(taxoReader, new FacetsConfig(), c, new IntFieldSource("num"));

    // Retrieve & verify results:
    assertEquals("dim=Author path=[] value=145.0 childCount=4\n  Lisa (50.0)\n  Frank (45.0)\n  Susan (40.0)\n  Bob (10.0)\n", facets.getTopChildren(10, "Author").toString());

    taxoReader.close();
View Full Code Here

    taxoWriter.close();

    FacetsCollector c = new FacetsCollector();
    searcher.search(new MatchAllDocsQuery(), c);   

    TaxonomyFacetSumValueSource facets = new TaxonomyFacetSumValueSource(taxoReader, new FacetsConfig(), c, new IntFieldSource("num"));

    // Ask for top 10 labels for any dims that have counts:
    List<FacetResult> results = facets.getAllDims(10);

    assertEquals(3, results.size());
View Full Code Here

    taxoWriter.close();

    FacetsCollector c = new FacetsCollector();
    searcher.search(new MatchAllDocsQuery(), c);   

    TaxonomyFacetSumValueSource facets = new TaxonomyFacetSumValueSource(taxoReader, config, c, new IntFieldSource("num"));

    // Ask for top 10 labels for any dims that have counts:
    List<FacetResult> results = facets.getAllDims(10);
    assertTrue(results.isEmpty());
View Full Code Here

TOP

Related Classes of org.apache.lucene.queries.function.valuesource.IntFieldSource

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.