Package org.apache.lucene.search

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


  private List doSearch(Query query,HitExtractor extractor,Filter filter,Sort sort) {
    Searcher searcher=SearcherFactoryUtils.getSearcher(getSearcherFactory());
    try {
      Hits hits=null;
      if( filter!=null && sort!=null ) {
        hits=searcher.search(query,filter,sort);
      } else if( filter!=null ) {
        hits=searcher.search(query,filter);
      } else if( sort!=null ) {
        hits=searcher.search(query,sort);
      } else {
View Full Code Here


    try {
      Hits hits=null;
      if( filter!=null && sort!=null ) {
        hits=searcher.search(query,filter,sort);
      } else if( filter!=null ) {
        hits=searcher.search(query,filter);
      } else if( sort!=null ) {
        hits=searcher.search(query,sort);
      } else {
        hits=searcher.search(query);
      }
View Full Code Here

      if( filter!=null && sort!=null ) {
        hits=searcher.search(query,filter,sort);
      } else if( filter!=null ) {
        hits=searcher.search(query,filter);
      } else if( sort!=null ) {
        hits=searcher.search(query,sort);
      } else {
        hits=searcher.search(query);
      }
      return extractHits(hits,extractor);
    } catch (IOException ex) {
View Full Code Here

      } else if( filter!=null ) {
        hits=searcher.search(query,filter);
      } else if( sort!=null ) {
        hits=searcher.search(query,sort);
      } else {
        hits=searcher.search(query);
      }
      return extractHits(hits,extractor);
    } catch (IOException ex) {
      throw new LuceneSearchException("Error during the search",ex);
    } finally {
View Full Code Here

   * @see org.apache.lucene.search.HitCollector
   */
  public void search(QueryCreator queryCreator,HitCollector results) {
    Searcher searcher=SearcherFactoryUtils.getSearcher(getSearcherFactory());
    try {
      searcher.search(queryCreator.createQuery(getAnalyzer()),results);
    } catch (IOException ex) {
      throw new LuceneSearchException("Error during the search",ex);
    } catch (ParseException ex) {
      throw new LuceneSearchException("Error during the parse of the query",ex);
    } finally {
View Full Code Here

      throw new IllegalArgumentException("query must not be null");
   
    Searcher searcher = createSearcher();
    try {
      final float[] scores = new float[1]; // inits to 0.0f (no match)
      searcher.search(query, new Collector() {
        private Scorer scorer;

        @Override
        public void collect(int doc) throws IOException {
          scores[0] = scorer.score();
View Full Code Here

    TermQuery q2 = new TermQuery(b);
    TermQuery q3 = new TermQuery(c);
    TermQuery q4 = new TermQuery(d);

       
    searcher.search(q1,
                    new CountingHitCollector() {
                      private Scorer scorer;
                      @Override
                      public final void setScorer(Scorer scorer) {
                        this.scorer = scorer;
View Full Code Here

                      }
                    });
    //System.out.println(CountingHitCollector.getCount());
       
       
    searcher.search(q2,
                    new CountingHitCollector() {
                      private Scorer scorer;
                      @Override
                      public final void setScorer(Scorer scorer) {
                        this.scorer = scorer;
View Full Code Here

        
       
       
       
       
    searcher.search(q3,
                    new CountingHitCollector() {
                      private Scorer scorer;
                      @Override
                      public final void setScorer(Scorer scorer) {
                        this.scorer = scorer;
View Full Code Here

                      }
                    });
    //System.out.println(CountingHitCollector.getCount());
       
       
    searcher.search(q4,
                    new CountingHitCollector() {
                      private Scorer scorer;
                      @Override
                      public final void setScorer(Scorer scorer) {
                        this.scorer = scorer;
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.