Package org.springmodules.lucene.search.factory

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


   * Test for List search(QueryCreator, HitExtractor, Sort)
   */
  final public void testSearchQueryCreatorHitExtractorSort() 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.createControl(HitExtractor.class);
    HitExtractor hitExtractor = (HitExtractor)hitExtractorControl.getMock();

    //query
    Query query = new TermQuery(new Term("field", "sample"));
   
    //sort
    Sort sort = new Sort("sort");
   
    //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


   * Test for List search(QueryCreator, HitExtractor, QueryResultCreator, Sort)
   */
  final public void testSearchQueryCreatorHitExtractorQueryResultCreatorSort() 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.createControl(HitExtractor.class);
    HitExtractor hitExtractor = (HitExtractor)hitExtractorControl.getMock();
    MockControl queryResultCreatorControl = MockControl.createStrictControl(QueryResultCreator.class);
    QueryResultCreator queryResultCreator = (QueryResultCreator)queryResultCreatorControl.getMock();

    //query
    Query query = new TermQuery(new Term("field", "sample"));
   
    //sort
    Sort sort = new Sort("sort");
   
    //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

   * Test for List search(QueryCreator, HitExtractor, Filter, Sort)
   */
  final public void testSearchQueryCreatorHitExtractorFilterSort() 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"));
   
    //filter
    TermQuery filterQuery = new TermQuery(new Term("filter", "another"));
    Filter filter = new QueryFilter(filterQuery);

    //sort
    Sort sort = new Sort("sort");
   
    //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

   * Test for List search(QueryCreator, HitExtractor, QueryResultCreator, Filter, Sort)
   */
  final public void testSearchQueryCreatorHitExtractorQueryResultCreatorFilterSort() 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();
    MockControl queryResultCreatorControl = MockControl.createStrictControl(QueryResultCreator.class);
    QueryResultCreator queryResultCreator = (QueryResultCreator)queryResultCreatorControl.getMock();

    //query
    Query query = new TermQuery(new Term("field", "sample"));
   
    //filter
    TermQuery filterQuery = new TermQuery(new Term("filter", "another"));
    Filter filter = new QueryFilter(filterQuery);

    //sort
    Sort sort = new Sort("sort");
   
    //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

  /*
   * Test for Object search(SearcherCallback)
   */
  final public void testSearchSearcherCallback() throws Exception {
    MockControl searcherFactoryControl = MockControl.createStrictControl(SearcherFactory.class);
    SearcherFactory searcherFactory = (SearcherFactory)searcherFactoryControl.getMock();
    MockControl searcherControl = MockControl.createStrictControl(LuceneSearcher.class);
    LuceneSearcher searcher = (LuceneSearcher)searcherControl.getMock();
    MockControl searcherCallbackControl = MockControl.createStrictControl(SearcherCallback.class);
    SearcherCallback searcherCallback = (SearcherCallback)searcherCallbackControl.getMock();

    searcherFactory.getSearcher();
    searcherFactoryControl.setReturnValue(searcher, 1);
   
    searcherCallback.doWithSearcher(searcher);
    searcherCallbackControl.setReturnValue("return", 1);
   
View Full Code Here

TOP

Related Classes of org.springmodules.lucene.search.factory.SearcherFactory

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.