Examples of Weight


Examples of org.apache.commons.math3.optimization.Weight

            throw new DimensionMismatchException(t.length, w.length);
        }

        return optimizeInternal(maxEval, f,
                                new Target(t),
                                new Weight(w),
                                new InitialGuess(startPoint));
    }

Examples of org.apache.lucene.search.Weight

          try {
            List<Query> filters = rb.getFilters();
            if (filters!=null){
              final ArrayList<DocIdSet> docsets = new ArrayList<DocIdSet>(filters.size());
                for (Query filter : filters){
                  Weight weight = filter.createWeight(rb.req.getSearcher());
                  final Scorer scorer = weight.scorer(reader, false, true);
                  docsets.add(new DocIdSet(){
                @Override
                public DocIdSetIterator iterator() throws IOException {
                  return scorer;
                }

Examples of org.apache.lucene.search.Weight

  public void browse(BrowseRequest req,
                     Collector collector,
                     Map<String, FacetAccessible> facetMap,
                     int start) throws BrowseException
  {
    Weight w = null;
    try
    {
      Query q = req.getQuery();
      if (q == null)
      {

Examples of org.apache.lucene.search.Weight

  public void browse(BrowseRequest req,
                     Collector collector,
                     Map<String, FacetAccessible> facetMap,
                     int start) throws BrowseException
  {
    Weight w = null;
    try
    {
      Query q = req.getQuery();
      if (q == null)
      {

Examples of org.apache.lucene.search.Weight

   * not a direct test of NearSpans, but a demonstration of how/when
   * this causes problems
   */
  public void testSpanNearScorerSkipTo1() throws Exception {
    SpanNearQuery q = makeQuery();
    Weight w = q.weight(searcher);
    Scorer s = w.scorer(searcher.getIndexReader(), true, false);
    assertEquals(1, s.advance(1));
  }

Examples of org.apache.lucene.search.Weight

      Sort sort = getSort();
      TopDocs hits;
      final int numHits = numHits();
      if (numHits > 0) {
        if (sort != null) {
          Weight w = q.weight(searcher);
          TopFieldCollector collector = TopFieldCollector.create(sort, numHits,
                                                                 true, withScore(),
                                                                 withMaxScore(),
                                                                 !w.scoresDocsOutOfOrder());
          searcher.search(w, null, collector);
          hits = collector.topDocs();
        } else {
          hits = searcher.search(q, numHits);
        }

Examples of org.apache.lucene.search.Weight

    // Delete by query
    IndexSearcher searcher = new IndexSearcher(reader);
    for (Entry<Query, Integer> entry : deletesFlushed.queries.entrySet()) {
      Query query = entry.getKey();
      int limit = entry.getValue().intValue();
      Weight weight = query.weight(searcher);
      Scorer scorer = weight.scorer(reader, true, false);
      if (scorer != null) {
        while(true)  {
          int doc = scorer.nextDoc();
          if (((long) docIDStart) + doc >= limit)
            break;

Examples of org.apache.lucene.search.Weight

    return readers;
  }

  public void browse(BrowseRequest req, final Collector hc, Map<String, FacetAccessible> facetMap)
      throws BrowseException {
    Weight w = null;
    try {
      Query q = req.getQuery();
      MatchAllDocsQuery matchAllDocsQuery = new MatchAllDocsQuery();
      if (q == null) {
        q = matchAllDocsQuery;

Examples of org.apache.lucene.search.Weight

  throws IOException {
    return (NodeScorer) this.getScorer(builder.getNodeQuery());
  }

  protected Scorer getScorer(final Query query) throws IOException {
    final Weight weight = searcher.createNormalizedWeight(query);
    assertTrue(searcher.getTopReaderContext() instanceof AtomicReaderContext);
    final AtomicReaderContext context = (AtomicReaderContext) searcher.getTopReaderContext();
    return weight.scorer(context, true, true, context.reader().getLiveDocs());
  }

Examples of org.apache.lucene.search.Weight

    this.addDocuments("\"Renaud Delbru\" . ",
                      "\"Renaud Delbru\" . \"Renaud Delbru\" . ");

    final Query query = npq("renaud", "delbru").getLuceneProxyQuery();

    final Weight w = query.createWeight(searcher);

    // Explain entity 0 : 1 match
    Explanation explanation = w.explain((AtomicReaderContext) reader.getContext(), 0);
    assertNotNull("explanation is null and it shouldn't be", explanation);

//    final Similarity sim = searcher.getSimilarity();
    // TODO: The similarity is randomly set
//     System.out.println("Explanation: " + explanation.toString());
//    //All this Explain does is return the term frequency
//    assertEquals("term frq is not 1",
//      sim.tf(1), explanation.getDetails()[1].getDetails()[0].getValue(), 0.01);

    // Explain entity 1 : 2 match
    explanation = w.explain((AtomicReaderContext) reader.getContext(), 1);
    assertNotNull("explanation is null and it shouldn't be", explanation);
    // TODO: The similarity is randomly set
//     System.out.println("Explanation: " + explanation.toString());
//    //All this Explain does is return the term frequency
//    assertEquals("term frq is not 2",
//      sim.tf(2), explanation.getDetails()[1].getDetails()[0].getValue(), 0f);

    // Explain non existing entity
    explanation = w.explain((AtomicReaderContext) reader.getContext(), 2);
    assertNotNull("explanation is null and it shouldn't be", explanation);
//    System.out.println("Explanation: " + explanation.toString());
    //All this Explain does is return the term frequency
    assertEquals("term frq is not 0", 0f, explanation.getValue(), 0f);
  }
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.