Examples of search()


Examples of org.apache.lucene.index.memory.MemoryIndex.search()

      throw new IllegalArgumentException("queryAnalyzer must not be null");
   
    if (DEFAULT_CAPACITY <= 0) { // cache disabled?
      MemoryIndex index = new MemoryIndex();
      index.addField(FIELD_NAME, text, textAnalyzer);
      return index.search(parse(query, queryAnalyzer));
    }

    Object key = Pool.createHashKeys(new Object[] {text, query, textAnalyzer, queryAnalyzer});
    Float score = (Float) entries.get(key); // hit/miss ratio is app specific
//    Float score = null;

Examples of org.apache.lucene.search.IndexSearcher.search()

    SortField[] s_fields = new SortField[2];
    s_fields[0] = SortField.FIELD_SCORE;
    s_fields[1] = new SortField(searching.getKeywordField(), SortField.INT, true);
    Sort sort = new Sort(s_fields);
       
        Hits hits = searcher.search(comboQuery, multiFilter, sort);
    int numResults = hits.length();
    //System.out.println(numResults + " found............................");
    int result_count = Math.min(numResults, MAX_RESULT_COUNT);
    List results = new ArrayList(result_count);
    for(int i=0;i<result_count;i++){

Examples of org.apache.lucene.search.MultiSearcher.search()

    QueryParser parser = new QueryParser(TEST_VERSION_CURRENT, FIELD_NAME, new StandardAnalyzer(TEST_VERSION_CURRENT));
    parser.setMultiTermRewriteMethod(MultiTermQuery.SCORING_BOOLEAN_QUERY_REWRITE);
    query = parser.parse("multi*");
    if (VERBOSE) System.out.println("Searching for: " + query.toString(FIELD_NAME));
    // at this point the multisearcher calls combine(query[])
    hits = multiSearcher.search(query, null, 1000);

    // query = QueryParser.parse("multi*", FIELD_NAME, new StandardAnalyzer(TEST_VERSION));
    Query expandedQueries[] = new Query[2];
    expandedQueries[0] = query.rewrite(reader1);
    expandedQueries[1] = query.rewrite(reader2);

Examples of org.apache.lucene.search.ParallelMultiSearcher.search()

   
     
      //Search   
      TopDocs result = null;
      try{
        result = multiSearcher.search(parsedQuery,myFilter,query.offset + query.limit,sortBy);
      }catch(Exception e){
        logger.debug("Sortby failed, trying non sorted search");
        result = multiSearcher.search(parsedQuery,myFilter,query.offset + query.limit);
      }
     

Examples of org.apache.lucene.search.Searcher.search()

            // Lucene 3 insists on a hard limit and will not provide
            // a total hits value. Take at least 100 which is
            // an optimal limit for Lucene as any more
            // will trigger writing results to disk.
            int maxResults = (limit == 0 ? 100 : limit) + offset;
            TopDocs docs = searcher.search(query, maxResults);
            if (limit == 0) {
                limit = docs.totalHits;
            }
            for (int i = 0, len = docs.scoreDocs.length;
                    i < limit && i + offset < docs.totalHits

Examples of org.apache.mahout.knn.search.BruteSearch.search()

          new DenseVector(new double[]{0.125 * (i & 4), i & 2, i & 1}), 1, i));
      searcher.add(referenceVectors.get(referenceVectors.size() - 1));
    }

    final List<List<WeightedThing<Vector>>> searchResults =
        searcher.search(referenceVectors, 3);
    for (List<WeightedThing<Vector>> r : searchResults) {
      assertEquals(0, r.get(0).getWeight(), 1e-8);
      assertEquals(0.5, r.get(1).getWeight(), 1e-8);
      assertEquals(1, r.get(2).getWeight(), 1e-8);
    }

Examples of org.apache.mahout.knn.search.FastProjectionSearch.search()

    sut.addAllMatrixSlicesAsWeightedVectors(data);
    log.warn("Added data with speedup of {}", numDataVectors / (dimension * 2.0 * depth * 4.0));

    long t0 = System.nanoTime();
    for (MatrixSlice query : queries) {
      List<WeightedThing<Vector>> r = sut.search(query.vector(), depth);
      Set<Integer> x = Sets.newHashSet();
      for (WeightedThing<Vector> vector : r) {
        x.add(((WeightedVector)vector.getValue()).getIndex());
      }
      double overlap = Sets.intersection(reference.get(query.index()), x).size() / (double) depth;

Examples of org.apache.mahout.knn.search.Searcher.search()

    sut.addAllMatrixSlicesAsWeightedVectors(data);
    log.warn("Added data with speedup of {}", numDataVectors / (dimension * 2.0 * depth * 4.0));

    long t0 = System.nanoTime();
    for (MatrixSlice query : queries) {
      List<WeightedThing<Vector>> r = sut.search(query.vector(), depth);
      Set<Integer> x = Sets.newHashSet();
      for (WeightedThing<Vector> vector : r) {
        x.add(((WeightedVector)vector.getValue()).getIndex());
      }
      double overlap = Sets.intersection(reference.get(query.index()), x).size() / (double) depth;

Examples of org.apache.mahout.math.neighborhood.BruteSearch.search()

    int numCols = columnCentroids.size();
    Matrix confusionMatrix = new DenseMatrix(numRows, numCols);

    for (Vector vector : datapoints) {
      WeightedThing<Vector> closestRowCentroid = rowSearcher.search(vector, 1).get(0);
      WeightedThing<Vector> closestColumnCentroid = columnSearcher.search(vector, 1).get(0);
      int row = ((Centroid) closestRowCentroid.getValue()).getIndex();
      int column = ((Centroid) closestColumnCentroid.getValue()).getIndex();
      double vectorWeight;
      if (vector instanceof WeightedVector) {
        vectorWeight = ((WeightedVector) vector).getWeight();

Examples of org.apache.mahout.math.neighborhood.ProjectionSearch.search()

    }
    for (int i = 0; i < searcher.size(); ++i) {
      summarizers.add(new OnlineSummarizer());
    }
    for (Vector v : datapoints) {
      Centroid closest = (Centroid)searcher.search(v,  1).get(0).getValue();
      OnlineSummarizer summarizer = summarizers.get(closest.getIndex());
      summarizer.add(distanceMeasure.distance(v, closest));
    }
    return summarizers;
  }
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.