//# 0 errors, 188 messages
//#
/*
    //#SearchOperation.java:1:1: class: org.apache.roller.weblogger.business.search.operations.SearchOperation
 * Licensed to the Apache Software Foundation (ASF) under one or more
 *  contributor license agreements.  The ASF licenses this file to You
 * under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.  For additional information regarding
 * copyright in this work, please see the NOTICE file in the top level
 * directory of this distribution.
 */
/* Created on Jul 18, 2003 */
package org.apache.roller.weblogger.business.search.operations;

import java.io.IOException;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.lucene.analysis.standard.StandardAnalyzer;
import org.apache.lucene.index.IndexReader;
import org.apache.lucene.index.Term;
import org.apache.lucene.queryParser.MultiFieldQueryParser;
import org.apache.lucene.queryParser.ParseException;
import org.apache.lucene.search.BooleanQuery;
import org.apache.lucene.search.Hits;
import org.apache.lucene.search.IndexSearcher;
import org.apache.lucene.search.Query;
import org.apache.lucene.search.Sort;
import org.apache.lucene.search.SortField;
import org.apache.lucene.search.TermQuery;
import org.apache.roller.weblogger.business.search.IndexManagerImpl;
import org.apache.roller.weblogger.business.search.FieldConstants;
import org.apache.roller.weblogger.business.search.IndexUtil;
import org.apache.roller.weblogger.business.search.IndexManager;


/**
 * An operation that searches the index.
 * @author Mindaugas Idzelis (min@idzelis.com)
 */
public class SearchOperation extends ReadFromIndexOperation {
    //~ Static fields/initializers =============================================
    
    private static Log mLogger =
    //#SearchOperation.java:50: method: org.apache.roller.weblogger.business.search.operations.SearchOperation.org.apache.roller.weblogger.business.search.operations.SearchOperation__static_init
    //#SearchOperation.java:50: Warning: method not available
    //#    -- call on LogFactory org.apache.commons.logging.LogFactory:getFactory()
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.business.search.operations.SearchOperation
    //#    method: org.apache.roller.weblogger.business.search.operations.SearchOperation__static_init
    //#    unanalyzed callee: LogFactory org.apache.commons.logging.LogFactory:getFactory()
    //#SearchOperation.java:50: Warning: method not available
    //#    -- call on Log org.apache.commons.logging.LogFactory:getInstance(Class)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.business.search.operations.SearchOperation
    //#    method: org.apache.roller.weblogger.business.search.operations.SearchOperation__static_init
    //#    unanalyzed callee: Log org.apache.commons.logging.LogFactory:getInstance(Class)
    //#output(org.apache.roller.weblogger.business.search.operations.SearchOperation__static_init): SEARCH_FIELDS
    //#output(org.apache.roller.weblogger.business.search.operations.SearchOperation__static_init): SORTER
    //#output(org.apache.roller.weblogger.business.search.operations.SearchOperation__static_init): __Descendant_Table[org/apache/roller/weblogger/business/search/operations/SearchOperation]
    //#output(org.apache.roller.weblogger.business.search.operations.SearchOperation__static_init): __Dispatch_Table.beginDeleting()Lorg/apache/lucene/index/IndexReader;
    //#output(org.apache.roller.weblogger.business.search.operations.SearchOperation__static_init): __Dispatch_Table.beginWriting()Lorg/apache/lucene/index/IndexWriter;
    //#output(org.apache.roller.weblogger.business.search.operations.SearchOperation__static_init): __Dispatch_Table.doRun()V
    //#output(org.apache.roller.weblogger.business.search.operations.SearchOperation__static_init): __Dispatch_Table.endDeleting()V
    //#output(org.apache.roller.weblogger.business.search.operations.SearchOperation__static_init): __Dispatch_Table.endWriting()V
    //#output(org.apache.roller.weblogger.business.search.operations.SearchOperation__static_init): __Dispatch_Table.getDocument(Lorg/apache/roller/weblogger/pojos/WeblogEntry;)Lorg/apache/lucene/document/Document;
    //#output(org.apache.roller.weblogger.business.search.operations.SearchOperation__static_init): __Dispatch_Table.getParseError()Ljava/lang/String;
    //#output(org.apache.roller.weblogger.business.search.operations.SearchOperation__static_init): __Dispatch_Table.getResults()Lorg/apache/lucene/search/Hits;
    //#output(org.apache.roller.weblogger.business.search.operations.SearchOperation__static_init): __Dispatch_Table.getResultsCount()I
    //#output(org.apache.roller.weblogger.business.search.operations.SearchOperation__static_init): __Dispatch_Table.run()V
    //#output(org.apache.roller.weblogger.business.search.operations.SearchOperation__static_init): __Dispatch_Table.setCategory(Ljava/lang/String;)V
    //#output(org.apache.roller.weblogger.business.search.operations.SearchOperation__static_init): __Dispatch_Table.setTerm(Ljava/lang/String;)V
    //#output(org.apache.roller.weblogger.business.search.operations.SearchOperation__static_init): __Dispatch_Table.setWebsiteHandle(Ljava/lang/String;)V
    //#output(org.apache.roller.weblogger.business.search.operations.SearchOperation__static_init): mLogger
    //#output(org.apache.roller.weblogger.business.search.operations.SearchOperation__static_init): new Sort(SearchOperation__static_init#2) num objects
    //#output(org.apache.roller.weblogger.business.search.operations.SearchOperation__static_init): new String[](SearchOperation__static_init#1) num objects
    //#output(org.apache.roller.weblogger.business.search.operations.SearchOperation__static_init): SEARCH_FIELDS.length
    //#output(org.apache.roller.weblogger.business.search.operations.SearchOperation__static_init): SEARCH_FIELDS[0]
    //#output(org.apache.roller.weblogger.business.search.operations.SearchOperation__static_init): SEARCH_FIELDS[1]
    //#output(org.apache.roller.weblogger.business.search.operations.SearchOperation__static_init): SEARCH_FIELDS[2]
    //#output(org.apache.roller.weblogger.business.search.operations.SearchOperation__static_init): SEARCH_FIELDS[3]
    //#output(org.apache.roller.weblogger.business.search.operations.SearchOperation__static_init): org/apache/roller/weblogger/business/search/operations/IndexOperation.__Descendant_Table[org/apache/roller/weblogger/business/search/operations/SearchOperation]
    //#output(org.apache.roller.weblogger.business.search.operations.SearchOperation__static_init): org/apache/roller/weblogger/business/search/operations/ReadFromIndexOperation.__Descendant_Table[org/apache/roller/weblogger/business/search/operations/SearchOperation]
    //#new obj(org.apache.roller.weblogger.business.search.operations.SearchOperation__static_init): new Sort(SearchOperation__static_init#2)
    //#new obj(org.apache.roller.weblogger.business.search.operations.SearchOperation__static_init): new String[](SearchOperation__static_init#1)
    //#presumption(org.apache.roller.weblogger.business.search.operations.SearchOperation__static_init): org.apache.commons.logging.LogFactory:getFactory(...)@50 != null
    //#post(org.apache.roller.weblogger.business.search.operations.SearchOperation__static_init): SEARCH_FIELDS == &new String[](SearchOperation__static_init#1)
    //#post(org.apache.roller.weblogger.business.search.operations.SearchOperation__static_init): SORTER == &new Sort(SearchOperation__static_init#2)
    //#post(org.apache.roller.weblogger.business.search.operations.SearchOperation__static_init): __Descendant_Table[org/apache/roller/weblogger/business/search/operations/SearchOperation] == &__Dispatch_Table
    //#post(org.apache.roller.weblogger.business.search.operations.SearchOperation__static_init): org/apache/roller/weblogger/business/search/operations/IndexOperation.__Descendant_Table[org/apache/roller/weblogger/business/search/operations/SearchOperation] == &__Dispatch_Table
    //#post(org.apache.roller.weblogger.business.search.operations.SearchOperation__static_init): org/apache/roller/weblogger/business/search/operations/ReadFromIndexOperation.__Descendant_Table[org/apache/roller/weblogger/business/search/operations/SearchOperation] == &__Dispatch_Table
    //#post(org.apache.roller.weblogger.business.search.operations.SearchOperation__static_init): __Dispatch_Table.beginDeleting()Lorg/apache/lucene/index/IndexReader; == &org/apache/roller/weblogger/business/search/operations/IndexOperation.beginDeleting
    //#post(org.apache.roller.weblogger.business.search.operations.SearchOperation__static_init): __Dispatch_Table.beginWriting()Lorg/apache/lucene/index/IndexWriter; == &org/apache/roller/weblogger/business/search/operations/IndexOperation.beginWriting
    //#post(org.apache.roller.weblogger.business.search.operations.SearchOperation__static_init): __Dispatch_Table.doRun()V == &doRun
    //#post(org.apache.roller.weblogger.business.search.operations.SearchOperation__static_init): __Dispatch_Table.endDeleting()V == &org/apache/roller/weblogger/business/search/operations/IndexOperation.endDeleting
    //#post(org.apache.roller.weblogger.business.search.operations.SearchOperation__static_init): __Dispatch_Table.endWriting()V == &org/apache/roller/weblogger/business/search/operations/IndexOperation.endWriting
    //#post(org.apache.roller.weblogger.business.search.operations.SearchOperation__static_init): __Dispatch_Table.getDocument(Lorg/apache/roller/weblogger/pojos/WeblogEntry;)Lorg/apache/lucene/document/Document; == &org/apache/roller/weblogger/business/search/operations/IndexOperation.getDocument
    //#post(org.apache.roller.weblogger.business.search.operations.SearchOperation__static_init): __Dispatch_Table.getParseError()Ljava/lang/String; == &getParseError
    //#post(org.apache.roller.weblogger.business.search.operations.SearchOperation__static_init): __Dispatch_Table.getResults()Lorg/apache/lucene/search/Hits; == &getResults
    //#post(org.apache.roller.weblogger.business.search.operations.SearchOperation__static_init): __Dispatch_Table.getResultsCount()I == &getResultsCount
    //#post(org.apache.roller.weblogger.business.search.operations.SearchOperation__static_init): __Dispatch_Table.run()V == &org/apache/roller/weblogger/business/search/operations/ReadFromIndexOperation.run
    //#post(org.apache.roller.weblogger.business.search.operations.SearchOperation__static_init): __Dispatch_Table.setCategory(Ljava/lang/String;)V == &setCategory
    //#post(org.apache.roller.weblogger.business.search.operations.SearchOperation__static_init): __Dispatch_Table.setTerm(Ljava/lang/String;)V == &setTerm
    //#post(org.apache.roller.weblogger.business.search.operations.SearchOperation__static_init): __Dispatch_Table.setWebsiteHandle(Ljava/lang/String;)V == &setWebsiteHandle
    //#post(org.apache.roller.weblogger.business.search.operations.SearchOperation__static_init): init'ed(mLogger)
    //#post(org.apache.roller.weblogger.business.search.operations.SearchOperation__static_init): new Sort(SearchOperation__static_init#2) num objects == 1
    //#post(org.apache.roller.weblogger.business.search.operations.SearchOperation__static_init): new String[](SearchOperation__static_init#1) num objects == 1
    //#post(org.apache.roller.weblogger.business.search.operations.SearchOperation__static_init): SEARCH_FIELDS.length == 4
    //#post(org.apache.roller.weblogger.business.search.operations.SearchOperation__static_init): SEARCH_FIELDS[0] == &"content"
    //#post(org.apache.roller.weblogger.business.search.operations.SearchOperation__static_init): SEARCH_FIELDS[1] == &"title"
    //#post(org.apache.roller.weblogger.business.search.operations.SearchOperation__static_init): SEARCH_FIELDS[2] == &"comment"
    //#post(org.apache.roller.weblogger.business.search.operations.SearchOperation__static_init): SEARCH_FIELDS[3] == &"cat"
            LogFactory.getFactory().getInstance(SearchOperation.class);
    
    private static String[] SEARCH_FIELDS = new String[]{
        FieldConstants.CONTENT, FieldConstants.TITLE,
        FieldConstants.C_CONTENT, FieldConstants.CATEGORY
    };
    
    private static Sort SORTER = new Sort( new SortField(
    //#SearchOperation.java:58: Warning: method not available
    //#    -- call on void org.apache.lucene.search.SortField(String, int, bool)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.business.search.operations.SearchOperation
    //#    method: org.apache.roller.weblogger.business.search.operations.SearchOperation__static_init
    //#    unanalyzed callee: void org.apache.lucene.search.SortField(String, int, bool)
    //#SearchOperation.java:58: Warning: method not available
    //#    -- call on void org.apache.lucene.search.Sort(SortField)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.business.search.operations.SearchOperation
    //#    method: org.apache.roller.weblogger.business.search.operations.SearchOperation__static_init
    //#    unanalyzed callee: void org.apache.lucene.search.Sort(SortField)
    //#SearchOperation.java:58: end of method: org.apache.roller.weblogger.business.search.operations.SearchOperation.org.apache.roller.weblogger.business.search.operations.SearchOperation__static_init
            FieldConstants.PUBLISHED, SortField.STRING, true) );
    
    //~ Instance fields ========================================================
    
    private String term;
    private String websiteHandle;
    private String category;
    private Hits searchresults;
    private String parseError;
    
    //~ Constructors ===========================================================
    
    /**
     * Create a new operation that searches the index.
     */
    public SearchOperation(IndexManager mgr) {
        // TODO: finish moving  IndexManager to backend, so this cast is not needed
        super((IndexManagerImpl)mgr);
    //#SearchOperation.java:76: method: void org.apache.roller.weblogger.business.search.operations.SearchOperation.org.apache.roller.weblogger.business.search.operations.SearchOperation(IndexManager)
    //#input(void org.apache.roller.weblogger.business.search.operations.SearchOperation(IndexManager)): mgr
    //#input(void org.apache.roller.weblogger.business.search.operations.SearchOperation(IndexManager)): mgr.__Tag
    //#input(void org.apache.roller.weblogger.business.search.operations.SearchOperation(IndexManager)): org/apache/roller/weblogger/business/search/IndexManagerImpl.__Descendant_Table[org/apache/roller/weblogger/business/search/IndexManagerImpl]
    //#input(void org.apache.roller.weblogger.business.search.operations.SearchOperation(IndexManager)): org/apache/roller/weblogger/business/search/IndexManagerImpl.__Descendant_Table[others]
    //#input(void org.apache.roller.weblogger.business.search.operations.SearchOperation(IndexManager)): this
    //#output(void org.apache.roller.weblogger.business.search.operations.SearchOperation(IndexManager)): this.manager
    //#pre[2] (void org.apache.roller.weblogger.business.search.operations.SearchOperation(IndexManager)): (soft) mgr.__Tag == org/apache/roller/weblogger/business/search/IndexManagerImpl
    //#post(void org.apache.roller.weblogger.business.search.operations.SearchOperation(IndexManager)): this.manager == mgr
    //#post(void org.apache.roller.weblogger.business.search.operations.SearchOperation(IndexManager)): init'ed(this.manager)
    //#unanalyzed(void org.apache.roller.weblogger.business.search.operations.SearchOperation(IndexManager)): Effects-of-calling:org.apache.roller.weblogger.business.search.operations.IndexOperation
    }
    //#SearchOperation.java:77: end of method: void org.apache.roller.weblogger.business.search.operations.SearchOperation.org.apache.roller.weblogger.business.search.operations.SearchOperation(IndexManager)
    
    //~ Methods ================================================================
    
    public void setTerm(String term) {
        this.term = term;
    //#SearchOperation.java:82: method: void org.apache.roller.weblogger.business.search.operations.SearchOperation.setTerm(String)
    //#input(void setTerm(String)): term
    //#input(void setTerm(String)): this
    //#output(void setTerm(String)): this.term
    //#post(void setTerm(String)): this.term == term
    //#post(void setTerm(String)): init'ed(this.term)
    }
    //#SearchOperation.java:83: end of method: void org.apache.roller.weblogger.business.search.operations.SearchOperation.setTerm(String)
    
    /* (non-Javadoc)
     * @see java.lang.Runnable#run()
     */
    public void doRun() {
        searchresults = null;
    //#SearchOperation.java:89: method: void org.apache.roller.weblogger.business.search.operations.SearchOperation.doRun()
    //#input(void doRun()): SEARCH_FIELDS
    //#input(void doRun()): SORTER
    //#input(void doRun()): mLogger
    //#input(void doRun()): org/apache/roller/weblogger/business/search/IndexManagerImpl.__Descendant_Table[org/apache/roller/weblogger/business/search/IndexManagerImpl]
    //#input(void doRun()): org/apache/roller/weblogger/business/search/IndexManagerImpl.__Descendant_Table[others]
    //#input(void doRun()): org/apache/roller/weblogger/business/search/IndexManagerImpl.__Dispatch_Table.getFSDirectory(Z)Lorg/apache/lucene/store/Directory;
    //#input(void doRun()): org/apache/roller/weblogger/business/search/IndexManagerImpl.__Dispatch_Table.getIndexDirectory()Lorg/apache/lucene/store/Directory;
    //#input(void doRun()): org/apache/roller/weblogger/business/search/IndexManagerImpl.__Dispatch_Table.getSharedIndexReader()Lorg/apache/lucene/index/IndexReader;
    //#input(void doRun()): org/apache/roller/weblogger/business/search/IndexManagerImpl.mLogger
    //#input(void doRun()): this
    //#input(void doRun()): this.category
    //#input(void doRun()): this.manager
    //#input(void doRun()): this.manager.__Tag
    //#input(void doRun()): this.manager.fRAMindex
    //#input(void doRun()): this.manager.indexDir
    //#input(void doRun()): this.manager.reader
    //#input(void doRun()): this.manager.useRAMIndex
    //#input(void doRun()): this.term
    //#input(void doRun()): this.websiteHandle
    //#output(void doRun()): this.manager.reader
    //#output(void doRun()): this.parseError
    //#output(void doRun()): this.searchresults
    //#pre[1] (void doRun()): (soft) init'ed(SEARCH_FIELDS)
    //#pre[2] (void doRun()): (soft) init'ed(SORTER)
    //#pre[3] (void doRun()): (soft) mLogger != null
    //#pre[4] (void doRun()): (soft) init'ed(this.manager.reader)
    //#pre[6] (void doRun()): (soft) org/apache/roller/weblogger/business/search/IndexManagerImpl.mLogger != null
    //#pre[8] (void doRun()): (soft) init'ed(this.category)
    //#pre[9] (void doRun()): (soft) this.manager != null
    //#pre[10] (void doRun()): (soft) this.manager.__Tag == org/apache/roller/weblogger/business/search/IndexManagerImpl
    //#pre[11] (void doRun()): (soft) init'ed(this.manager.fRAMindex)
    //#pre[12] (void doRun()): (soft) init'ed(this.manager.indexDir)
    //#pre[13] (void doRun()): (soft) init'ed(this.manager.useRAMIndex)
    //#pre[14] (void doRun()): (soft) init'ed(this.term)
    //#pre[15] (void doRun()): (soft) init'ed(this.websiteHandle)
    //#post(void doRun()): init'ed(this.manager.reader)
    //#post(void doRun()): possibly_updated(this.parseError)
    //#post(void doRun()): init'ed(this.searchresults)
    //#unanalyzed(void doRun()): Effects-of-calling:java.lang.Throwable:__curr_excep_obj
    //#unanalyzed(void doRun()): Effects-of-calling:org.apache.commons.logging.Log:error
    //#unanalyzed(void doRun()): Effects-of-calling:org.apache.lucene.store.FSDirectory:getDirectory
    //#unanalyzed(void doRun()): Effects-of-calling:getIndexDirectory
    //#unanalyzed(void doRun()): Effects-of-calling:org.apache.lucene.index.IndexReader:open
    //#unanalyzed(void doRun()): Effects-of-calling:getAnalyzer
    //#unanalyzed(void doRun()): Effects-of-calling:java.io.StringReader
    //#unanalyzed(void doRun()): Effects-of-calling:org.apache.lucene.analysis.Analyzer:tokenStream
    //#unanalyzed(void doRun()): Effects-of-calling:org.apache.lucene.analysis.TokenStream:next
    //#unanalyzed(void doRun()): Effects-of-calling:org.apache.lucene.analysis.Token:termText
    //#unanalyzed(void doRun()): Effects-of-calling:org.apache.lucene.index.Term
    //#unanalyzed(void doRun()): Effects-of-calling:org.apache.lucene.analysis.standard.StandardAnalyzer
        
        IndexSearcher searcher = null;
    //#SearchOperation.java:91: Warning: unused assignment
    //#    unused assignment into searcher
    //#    severity: SUPPRESSED
    //#    class: org.apache.roller.weblogger.business.search.operations.SearchOperation
    //#    method: void doRun()
    //#    Attribs:  Uncertain
        
        try {
            IndexReader reader = manager.getSharedIndexReader();
            searcher = new IndexSearcher(reader);
    //#SearchOperation.java:95: Warning: method not available
    //#    -- call on void org.apache.lucene.search.IndexSearcher(IndexReader)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.business.search.operations.SearchOperation
    //#    method: void doRun()
    //#    unanalyzed callee: void org.apache.lucene.search.IndexSearcher(IndexReader)
            
            Query query =
    //#SearchOperation.java:97: Warning: method not available
    //#    -- call on void org.apache.lucene.analysis.standard.StandardAnalyzer()
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.business.search.operations.SearchOperation
    //#    method: void doRun()
    //#    unanalyzed callee: void org.apache.lucene.analysis.standard.StandardAnalyzer()
    //#SearchOperation.java:97: Warning: method not available
    //#    -- call on Query org.apache.lucene.queryParser.MultiFieldQueryParser:parse(String, String[], Analyzer)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.business.search.operations.SearchOperation
    //#    method: void doRun()
    //#    unanalyzed callee: Query org.apache.lucene.queryParser.MultiFieldQueryParser:parse(String, String[], Analyzer)
                    MultiFieldQueryParser.parse(
                    term, SEARCH_FIELDS, new StandardAnalyzer());
            
            Term tUsername =
                    IndexUtil.getTerm(FieldConstants.WEBSITE_HANDLE, websiteHandle);
            
            if (tUsername != null) {
                BooleanQuery bQuery = new BooleanQuery();
    //#SearchOperation.java:105: Warning: method not available
    //#    -- call on void org.apache.lucene.search.BooleanQuery()
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.business.search.operations.SearchOperation
    //#    method: void doRun()
    //#    unanalyzed callee: void org.apache.lucene.search.BooleanQuery()
                bQuery.add(query, true, false);
    //#SearchOperation.java:106: Warning: method not available
    //#    -- call on void org.apache.lucene.search.BooleanQuery:add(Query, bool, bool)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.business.search.operations.SearchOperation
    //#    method: void doRun()
    //#    unanalyzed callee: void org.apache.lucene.search.BooleanQuery:add(Query, bool, bool)
                bQuery.add(new TermQuery(tUsername), true, false);
    //#SearchOperation.java:107: Warning: method not available
    //#    -- call on void org.apache.lucene.search.TermQuery(Term)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.business.search.operations.SearchOperation
    //#    method: void doRun()
    //#    unanalyzed callee: void org.apache.lucene.search.TermQuery(Term)
    //#SearchOperation.java:107: Warning: method not available
    //#    -- call on void org.apache.lucene.search.BooleanQuery:add(Query, bool, bool)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.business.search.operations.SearchOperation
    //#    method: void doRun()
    //#    unanalyzed callee: void org.apache.lucene.search.BooleanQuery:add(Query, bool, bool)
                query = bQuery;
            }
            
            Term tCategory =
                    IndexUtil.getTerm(FieldConstants.CATEGORY, category);
            
            if (tCategory != null) {
                BooleanQuery bQuery = new BooleanQuery();
    //#SearchOperation.java:115: Warning: method not available
    //#    -- call on void org.apache.lucene.search.BooleanQuery()
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.business.search.operations.SearchOperation
    //#    method: void doRun()
    //#    unanalyzed callee: void org.apache.lucene.search.BooleanQuery()
                bQuery.add(query, true, false);
    //#SearchOperation.java:116: Warning: method not available
    //#    -- call on void org.apache.lucene.search.BooleanQuery:add(Query, bool, bool)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.business.search.operations.SearchOperation
    //#    method: void doRun()
    //#    unanalyzed callee: void org.apache.lucene.search.BooleanQuery:add(Query, bool, bool)
                bQuery.add(new TermQuery(tCategory), true, false);
    //#SearchOperation.java:117: Warning: method not available
    //#    -- call on void org.apache.lucene.search.TermQuery(Term)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.business.search.operations.SearchOperation
    //#    method: void doRun()
    //#    unanalyzed callee: void org.apache.lucene.search.TermQuery(Term)
    //#SearchOperation.java:117: Warning: method not available
    //#    -- call on void org.apache.lucene.search.BooleanQuery:add(Query, bool, bool)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.business.search.operations.SearchOperation
    //#    method: void doRun()
    //#    unanalyzed callee: void org.apache.lucene.search.BooleanQuery:add(Query, bool, bool)
                query = bQuery;
            }
            searchresults = searcher.search(query, null/*Filter*/, SORTER);
    //#SearchOperation.java:120: Warning: method not available
    //#    -- call on Hits org.apache.lucene.search.IndexSearcher:search(Query, Filter, Sort)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.business.search.operations.SearchOperation
    //#    method: void doRun()
    //#    unanalyzed callee: Hits org.apache.lucene.search.IndexSearcher:search(Query, Filter, Sort)
        } catch (IOException e) {
            mLogger.error("Error searching index", e);
    //#SearchOperation.java:122: Warning: method not available
    //#    -- call on void org.apache.commons.logging.Log:error(Object, Throwable)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.business.search.operations.SearchOperation
    //#    method: void doRun()
    //#    unanalyzed callee: void org.apache.commons.logging.Log:error(Object, Throwable)
            parseError = e.getMessage();
        } catch (ParseException e) {
            // who cares?
            parseError = e.getMessage();
    //#SearchOperation.java:126: Warning: method not available
    //#    -- call on String org.apache.lucene.queryParser.ParseException:getMessage()
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.business.search.operations.SearchOperation
    //#    method: void doRun()
    //#    unanalyzed callee: String org.apache.lucene.queryParser.ParseException:getMessage()
        }
        // don't need to close the reader, since we didn't do any writing!
    }
    //#SearchOperation.java:129: end of method: void org.apache.roller.weblogger.business.search.operations.SearchOperation.doRun()
    
    public Hits getResults() {
        return searchresults;
    //#SearchOperation.java:132: method: Hits org.apache.roller.weblogger.business.search.operations.SearchOperation.getResults()
    //#input(Hits getResults()): this
    //#input(Hits getResults()): this.searchresults
    //#output(Hits getResults()): return_value
    //#pre[2] (Hits getResults()): init'ed(this.searchresults)
    //#post(Hits getResults()): return_value == this.searchresults
    //#post(Hits getResults()): init'ed(return_value)
    //#SearchOperation.java:132: end of method: Hits org.apache.roller.weblogger.business.search.operations.SearchOperation.getResults()
    }
    
    public int getResultsCount() {
        if (searchresults == null) return -1;
    //#SearchOperation.java:136: method: int org.apache.roller.weblogger.business.search.operations.SearchOperation.getResultsCount()
    //#input(int getResultsCount()): this
    //#input(int getResultsCount()): this.searchresults
    //#output(int getResultsCount()): return_value
    //#pre[2] (int getResultsCount()): init'ed(this.searchresults)
    //#post(int getResultsCount()): init'ed(return_value)
    //#test_vector(int getResultsCount()): this.searchresults: Inverse{null}, Addr_Set{null}
        
        return searchresults.length();
    //#SearchOperation.java:138: Warning: method not available
    //#    -- call on int org.apache.lucene.search.Hits:length()
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.business.search.operations.SearchOperation
    //#    method: int getResultsCount()
    //#    unanalyzed callee: int org.apache.lucene.search.Hits:length()
    //#SearchOperation.java:138: end of method: int org.apache.roller.weblogger.business.search.operations.SearchOperation.getResultsCount()
    }
    
    public String getParseError() {
        return parseError;
    //#SearchOperation.java:142: method: String org.apache.roller.weblogger.business.search.operations.SearchOperation.getParseError()
    //#input(String getParseError()): this
    //#input(String getParseError()): this.parseError
    //#output(String getParseError()): return_value
    //#pre[2] (String getParseError()): init'ed(this.parseError)
    //#post(String getParseError()): return_value == this.parseError
    //#post(String getParseError()): init'ed(return_value)
    //#SearchOperation.java:142: end of method: String org.apache.roller.weblogger.business.search.operations.SearchOperation.getParseError()
    }
    
    /**
     * @param string
     */
    public void setWebsiteHandle(String websiteHandle) {
        this.websiteHandle = websiteHandle;
    //#SearchOperation.java:149: method: void org.apache.roller.weblogger.business.search.operations.SearchOperation.setWebsiteHandle(String)
    //#input(void setWebsiteHandle(String)): this
    //#input(void setWebsiteHandle(String)): websiteHandle
    //#output(void setWebsiteHandle(String)): this.websiteHandle
    //#post(void setWebsiteHandle(String)): this.websiteHandle == websiteHandle
    //#post(void setWebsiteHandle(String)): init'ed(this.websiteHandle)
    }
    //#SearchOperation.java:150: end of method: void org.apache.roller.weblogger.business.search.operations.SearchOperation.setWebsiteHandle(String)
    
    /**
     * @param parameter
     */
    public void setCategory(String category) {
        this.category = category;
    //#SearchOperation.java:156: method: void org.apache.roller.weblogger.business.search.operations.SearchOperation.setCategory(String)
    //#input(void setCategory(String)): category
    //#input(void setCategory(String)): this
    //#output(void setCategory(String)): this.category
    //#post(void setCategory(String)): this.category == category
    //#post(void setCategory(String)): init'ed(this.category)
    }
    //#SearchOperation.java:157: end of method: void org.apache.roller.weblogger.business.search.operations.SearchOperation.setCategory(String)
    
}
    //#SearchOperation.java:: end of class: org.apache.roller.weblogger.business.search.operations.SearchOperation
