Package org.springmodules.lucene.search.core

Examples of org.springmodules.lucene.search.core.LuceneSearchTemplate


    luceneSearch.setSearcherFactory(searcherFactory);
    luceneSearch.setAnalyzer(analyzer);
   
    luceneSearch.afterPropertiesSet();
   
    LuceneSearchTemplate template = luceneSearch.getLuceneSearcherTemplate();
    assertNotNull(template);
    assertEquals(template.getClass(), DefaultLuceneSearchTemplate.class);
  }
View Full Code Here


    assertEquals(template.getClass(), DefaultLuceneSearchTemplate.class);
  }

  public void testTemplateInjection() throws Exception {
    MockControl luceneSearcherTemplateControl = MockControl.createControl(LuceneSearchTemplate.class);
    LuceneSearchTemplate luceneSearchTemplate = (LuceneSearchTemplate)luceneSearcherTemplateControl.getMock();

    LuceneSearchSupport luceneSearch = new LuceneSearchSupport() {};
    luceneSearch.setLuceneSearcherTemplate(luceneSearchTemplate);
   
    luceneSearch.afterPropertiesSet();
   
    LuceneSearchTemplate template = luceneSearch.getLuceneSearcherTemplate();
    assertNotNull(template);
    assertEquals(template.getClass(), luceneSearchTemplate.getClass());
  }
View Full Code Here

      throw new BeanInitializationException("directory property required");
    if (this.analyzer == null)
      throw new BeanInitializationException("analyzer property required");       

    if( this.template==null ) {
      this.template=new LuceneSearchTemplate(searcherFactory,analyzer);
    }
  }
View Full Code Here

        }
        return true;
    }
   
    public List<Long> findItemIdsContainingText(String text) {      
        LuceneSearchTemplate template = getLuceneSearcherTemplate();
        QueryParser parser = new QueryParser("text", getAnalyzer());
        Query query;
        try {
            query = parser.parse(text);
        } catch (ParseException e) {
            e.printStackTrace();
            throw new SearchQueryParseException(e.getMessage(), e);
        }
        HitExtractor hitExtractor = new ItemIdHitExtractor();
        return template.search(query, hitExtractor);       
    }
View Full Code Here

TOP

Related Classes of org.springmodules.lucene.search.core.LuceneSearchTemplate

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.