Examples of SearcherFactory


Examples of org.apache.lucene.search.SearcherFactory

   
    for(String collectionName : collectionNames) {
     
      logger.info("collection name {}", collectionName);
     
      SearcherFactory searcherFactory = new SearcherFactory();
      IndexWriter indexWriter = indexWriterManager.getIndexWriter(collectionName);
      SearcherManager searcherManager = null;
     
      try {
     
View Full Code Here

Examples of org.apache.lucene.search.SearcherFactory

   * uses can tolerate seeing some deleted docs, since
   * reopen time is faster if deletes need not be applied. */
  public NRTManager(TrackingIndexWriter writer, SearcherFactory searcherFactory, boolean applyAllDeletes) throws IOException {
    this.writer = writer;
    if (searcherFactory == null) {
      searcherFactory = new SearcherFactory();
    }
    this.searcherFactory = searcherFactory;
    current = SearcherManager.getSearcher(searcherFactory, IndexReader.open(writer.getIndexWriter(), applyAllDeletes));
  }
View Full Code Here

Examples of org.apache.lucene.search.SearcherFactory

    private final FullTextIndexShared index;
    private final SearcherManager searcherManager;

    public Searcher(FullTextIndexShared index, Analyzer analyzer) throws IOException {
        this.index = index;
        this.searcherManager = new SearcherManager(index.open(), new SearcherFactory());
    }
View Full Code Here

Examples of org.apache.lucene.search.SearcherFactory

            // The index needs to exist before creating the searcher manager so do a quick commit
            // of nothing in case the index doesn't exist already.
            this.indexWriter.commit();
        }

        this.searcherManager = new SearcherManager(FSDirectory.open(indexDir), new SearcherFactory());
  }
View Full Code Here

Examples of org.springmodules.lucene.search.factory.SearcherFactory

    } catch(Exception ex) {}
  }

  public void testSearcherFactorySpecified() throws Exception {
    MockControl searcherFactoryControl = MockControl.createControl(SearcherFactory.class);
    SearcherFactory searcherFactory = (SearcherFactory)searcherFactoryControl.getMock();

    LuceneSearchSupport luceneSearch = new LuceneSearchSupport() {};
    luceneSearch.setSearcherFactory(searcherFactory);

    try {
View Full Code Here

Examples of org.springmodules.lucene.search.factory.SearcherFactory

    } catch(Exception ex) {}
  }

  public void testSearcherFactoryAnalyzerSpecified() throws Exception {
    MockControl searcherFactoryControl = MockControl.createControl(SearcherFactory.class);
    SearcherFactory searcherFactory = (SearcherFactory)searcherFactoryControl.getMock();
    MockControl analyzerControl = MockClassControl.createControl(Analyzer.class);
    Analyzer analyzer = (Analyzer)analyzerControl.getMock();

    LuceneSearchSupport luceneSearch = new LuceneSearchSupport() {};
    luceneSearch.setSearcherFactory(searcherFactory);
View Full Code Here

Examples of org.springmodules.lucene.search.factory.SearcherFactory

    luceneSearch.afterPropertiesSet();
  }

  public void testTemplateCreation() throws Exception {
    MockControl searcherFactoryControl = MockControl.createControl(SearcherFactory.class);
    SearcherFactory searcherFactory = (SearcherFactory)searcherFactoryControl.getMock();
    MockControl analyzerControl = MockClassControl.createControl(Analyzer.class);
    Analyzer analyzer = (Analyzer)analyzerControl.getMock();

    LuceneSearchSupport luceneSearch = new LuceneSearchSupport() {};
    luceneSearch.setSearcherFactory(searcherFactory);
View Full Code Here

Examples of org.springmodules.lucene.search.factory.SearcherFactory

*/
public class ParsedLuceneSearchQueryTests extends AbstractLuceneTestCase {

  final public void testSearch() {
    //Initialization of the searcher
    SearcherFactory searcherFactory = new SimpleSearcherFactory(directory);

    //Initialization of the query
    LuceneSearchQuery query=new ParsedLuceneSearchQuery(searcherFactory,new SimpleAnalyzer()) {
      protected QueryParams configureSearchQuery(String textToSearch) {
        return new QueryParams("field", textToSearch);
View Full Code Here

Examples of org.springmodules.lucene.search.factory.SearcherFactory

*/
public class SimpleLuceneSearchQueryTests extends AbstractLuceneTestCase {

  final public void testSearch() {
    //Initialization of the searcher
    SearcherFactory searcherFactory = new SimpleSearcherFactory(directory);

    //Initialization of the query
    LuceneSearchQuery query = new SimpleLuceneSearchQuery(searcherFactory,null) {
      protected Query constructSearchQuery(String textToSearch) throws ParseException {
        return new TermQuery(new Term("field", textToSearch));
View Full Code Here

Examples of org.springmodules.lucene.search.factory.SearcherFactory

   * Test for List search(QueryCreator, HitExtractor)
   */
  final public void testSearchQueryCreatorHitExtractor() throws Exception {
    Analyzer analyzer = new SimpleAnalyzer();
    MockControl searcherFactoryControl = MockControl.createStrictControl(SearcherFactory.class);
    SearcherFactory searcherFactory = (SearcherFactory)searcherFactoryControl.getMock();
    MockControl searcherControl = MockControl.createStrictControl(LuceneSearcher.class);
    LuceneSearcher searcher = (LuceneSearcher)searcherControl.getMock();
    MockControl queryCreatorControl = MockControl.createStrictControl(QueryCreator.class);
    QueryCreator queryCreator = (QueryCreator)queryCreatorControl.getMock();
    MockControl hitsControl = MockControl.createStrictControl(LuceneHits.class);
    LuceneHits hits = (LuceneHits)hitsControl.getMock();
    MockControl hitExtractorControl = MockControl.createStrictControl(HitExtractor.class);
    HitExtractor hitExtractor = (HitExtractor)hitExtractorControl.getMock();

    //query
    Query query = new TermQuery(new Term("field", "sample"));
   
    //document
    Document document = new Document();
    document.add(new Field("field", "a sample", Field.Store.YES, Field.Index.TOKENIZED));
    document.add(new Field("filter", "a sample filter", Field.Store.YES, Field.Index.TOKENIZED));
    document.add(new Field("sort", "2", Field.Store.YES, Field.Index.UN_TOKENIZED));
    Object obj = new Object();

    searcherFactory.getSearcher();
    searcherFactoryControl.setReturnValue(searcher, 1);
   
    queryCreator.createQuery(analyzer);
    queryCreatorControl.setReturnValue(query, 1);
   
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.