Package org.springmodules.lucene.search

Examples of org.springmodules.lucene.search.LuceneSearchException


    } else if( getIndexFactory()!=null ) {
      LuceneIndexReader indexReader = IndexReaderFactoryUtils.getIndexReader(getIndexFactory());
      Searcher indexSearcher = indexReader.createNativeSearcher();
      return new SimpleLuceneSearcher(indexSearcher);
    } else {
      throw new LuceneSearchException("Either a Directory or an Indexreader must be specified.");
    }
  }
View Full Code Here


   */
  public static LuceneSearcher getSearcher(SearcherFactory searcherFactory) {
    try {
      return doGetSearcher(searcherFactory);
    } catch (IOException ex) {
      throw new LuceneSearchException("Could not get Lucene searcher", ex);
    }
  }
View Full Code Here

   */
  protected Query createQuery(QueryCreator queryCreator) {
    try {
      return queryCreator.createQuery(getAnalyzer());
    } catch (ParseException ex) {
      throw new LuceneSearchException("Construction of the desired Query failed", ex);
    }
  }
View Full Code Here

        hits = searcher.search(query);
      }
      //return extractHits(hits, extractor);
      return queryResultCreator.createResult(hits, hitExtractor);
    } catch (IOException ex) {
      throw new LuceneSearchException("Error during the search", ex);
    } finally {
      SearcherFactoryUtils.releaseSearcher(getSearcherFactory(), searcher);
    }
  }
View Full Code Here

  public void search(QueryCreator queryCreator, HitCollector results) {
    LuceneSearcher 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 {
      SearcherFactoryUtils.releaseSearcher(getSearcherFactory(), searcher);
    }
  }
View Full Code Here

  public Object search(SearcherCallback callback) {
    LuceneSearcher searcher = SearcherFactoryUtils.getSearcher(getSearcherFactory());
    try {
      return callback.doWithSearcher(searcher);
    } catch (ParseException ex) {
      throw new LuceneSearchException("Error during parsing query", ex);
    } catch (Exception ex) {
      throw new LuceneSearchException("Error during searching", ex);
    } finally {
      SearcherFactoryUtils.releaseSearcher(getSearcherFactory(),searcher);
    }
  }
View Full Code Here

TOP

Related Classes of org.springmodules.lucene.search.LuceneSearchException

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.