Examples of LuceneHits


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

    MockControl searcherControl = MockControl.createStrictControl(LuceneSearcher.class);
    LuceneSearcher searcher = (LuceneSearcher)searcherControl.getMock();
    MockControl documentsModifierControl = MockControl.createStrictControl(DocumentsModifier.class);
    DocumentsModifier documentsModifier = (DocumentsModifier)documentsModifierControl.getMock();
    MockControl hitsControl = MockControl.createStrictControl(LuceneHits.class);
    LuceneHits hits = (LuceneHits)hitsControl.getMock();
   
    //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));
View Full Code Here

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

    LuceneIndexReader reader = IndexReaderFactoryUtils.getIndexReader(indexFactory);
    LuceneSearcher searcher = null;
    Document updatedDocument = null;
    try {
      searcher = reader.createSearcher();
      LuceneHits hits = searcher.search(new TermQuery(identifierTerm));
      checkHitsForUpdate(hits);
      updatedDocument = documentModifier.updateDocument(hits.doc(0));
    } catch(Exception ex) {
      throw new LuceneIndexAccessException("Error during updating a document.", ex);
    } finally {
      SearcherFactoryUtils.closeSearcher(searcher);
      IndexReaderFactoryUtils.releaseIndexReader(indexFactory, reader);
View Full Code Here

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

  public void updateDocuments(Term identifierTerm, DocumentsModifier documentsModifier, Analyzer analyzer) {
    LuceneIndexReader reader = IndexReaderFactoryUtils.getIndexReader(indexFactory);
    LuceneSearcher searcher = reader.createSearcher();
    List updatedDocuments = null;
    try {
      LuceneHits hits = searcher.search(new TermQuery(identifierTerm));
      updatedDocuments = documentsModifier.updateDocuments(hits);
    } catch(Exception ex) {
      throw new LuceneIndexAccessException("Error during updating a document.", ex);
    } finally {
      SearcherFactoryUtils.closeSearcher(searcher);
View Full Code Here

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

   */
  private List doSearch(Query query, HitExtractor hitExtractor,
          QueryResultCreator queryResultCreator, Filter filter, Sort sort) {
    LuceneSearcher searcher = SearcherFactoryUtils.getSearcher(getSearcherFactory());
    try {
      LuceneHits hits = null;
      if( filter!=null && sort!=null ) {
        hits = searcher.search(query, filter, sort);
      } else if( filter!=null ) {
        hits = searcher.search(query, filter);
      } else if( sort!=null ) {
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.