Package org.springmodules.lucene.search

Examples of org.springmodules.lucene.search.LuceneSearchException


   */
  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


      } else {
        hits=searcher.search(query);
      }
      return extractHits(hits,extractor);
    } 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) {
    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 {
      SearcherFactoryUtils.releaseSearcher(getSearcherFactory(),searcher);
    }
  }
View Full Code Here

   * @throws IOException if thrown by Lucene methods
   */
  protected Searcher[] createSearchers() throws IOException {
    if( (directories==null || directories.length==0)
           && (indexFactories==null || indexFactories.length==0) ) {
      throw new LuceneSearchException("Either Directories or Indexreaders must be specified.");
    }

    int size=0;
    if( directories!=null ) {
      size=directories.length;
View Full Code Here

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

      this.indexSearcher=new IndexSearcher(getDirectory());
    } else if( getIndexFactory()!=null ) {
      IndexReader indexReader=IndexReaderFactoryUtils.getIndexReader(getIndexFactory());
      this.indexSearcher=new IndexSearcher(indexReader);
    } else {
      throw new LuceneSearchException("Either a Directory or an IndexReader must be specified.");
    }
  }
View Full Code Here

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

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

   * @throws IOException if thrown by Lucene methods
   */
  protected Searcher[] createSearchers() throws IOException {
    if( (directories==null || directories.length==0)
           && (indexFactories==null || indexFactories.length==0) ) {
      throw new LuceneSearchException("Either Directories or Indexreaders must be specified.");
    }

    int size = 0;
    if( directories!=null ) {
      size = directories.length;
View Full Code Here

    } else if( getIndexFactory()!=null ) {
      LuceneIndexReader indexReader = IndexReaderFactoryUtils.getIndexReader(getIndexFactory());
      Searcher searcher = indexReader.createNativeSearcher();
      this.indexSearcher = new SimpleLuceneSearcher(searcher);
    } else {
      throw new LuceneSearchException("Either a Directory or an IndexReader must be specified.");
    }
  }
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.