com.atlassian.bonnie
Interface Searcher

All Known Implementing Classes:
LuceneSearcher

public interface Searcher

Searches through all objects that have been indexed using a free text query. To index an object allowing it to show up in the search, use Indexer

Author:
Armond Avanes (armond555@yahoo.com)
See Also:
Searcher

Method Summary
 org.apache.lucene.search.Query buildStandardQuery(java.lang.String[] searchFields, java.lang.String query)
          Performs a search over multiple fields
 org.apache.lucene.search.Query buildStandardQuery(java.lang.String field, java.lang.String query)
           
 java.lang.String explain(org.apache.lucene.search.Query query, int docid)
           
 java.util.List getAllFieldValues(java.lang.String fieldName)
           
 org.apache.lucene.search.Query rewrite(org.apache.lucene.search.Query query)
           
 java.util.List search(org.apache.lucene.search.Query query)
          Performs the search operation and returns a List of found items.
 java.util.List search(org.apache.lucene.search.Query myquery, org.apache.lucene.search.Sort sort)
           
 int searchCount(org.apache.lucene.search.Query query)
          Run a search, but just give me back the result as a #.
 int searchCount(org.apache.lucene.search.Query query, org.apache.lucene.search.Filter filter)
           
 java.util.List searchForFields(org.apache.lucene.search.Query myquery, java.util.Set fieldsToExtract, int startIndex, int numItems)
          Search an index and return not only the item handles, but also pull arbitrary fields from the document and return them too.
 java.util.List searchForFields(org.apache.lucene.search.Query myquery, java.util.Set fieldsToExtract, int startIndex, int numItems, org.apache.lucene.search.Filter filter, int[] filteredcount)
           
 java.util.List searchForFields(org.apache.lucene.search.Query myquery, java.util.Set fieldsToExtract, int startIndex, int numItems, org.apache.lucene.search.Filter filter, org.apache.lucene.search.Sort sorter, int[] filteredcount)
           
 

Method Detail

search

public java.util.List search(org.apache.lucene.search.Query query)
Performs the search operation and returns a List of found items.


search

public java.util.List search(org.apache.lucene.search.Query myquery,
                             org.apache.lucene.search.Sort sort)

buildStandardQuery

public org.apache.lucene.search.Query buildStandardQuery(java.lang.String[] searchFields,
                                                         java.lang.String query)
Performs a search over multiple fields

Parameters:
searchFields - a sting array of fields to search accross
query - the qury to execute
Returns:
a list of Hit results

buildStandardQuery

public org.apache.lucene.search.Query buildStandardQuery(java.lang.String field,
                                                         java.lang.String query)

searchForFields

public java.util.List searchForFields(org.apache.lucene.search.Query myquery,
                                      java.util.Set fieldsToExtract,
                                      int startIndex,
                                      int numItems)
Search an index and return not only the item handles, but also pull arbitrary fields from the document and return them too.

Extracting fields from all documents could be expensive and potentially unnecessary, so the startIndex and numItems parameters allow you to control where the extraction will start from, and how many items it will continue for.

Parameters:
myquery - The query to run
fieldsToExtract - A set of field names which will be extracted from the document and returned - if the fields are null, or the set is empty, BaseDocumentBuilder.FieldName.HANDLE_FIELD_NAME will be used.
startIndex - The index to start extracting content from, or 0 for the start of the list
numItems - The number of items to be extracted in total, or Integer.MAX_VALUE for all items
Returns:
A list containing maps of the fields you wish to extract. For results outside of the startIndex/numItems range, this list will contain null values.

searchForFields

public java.util.List searchForFields(org.apache.lucene.search.Query myquery,
                                      java.util.Set fieldsToExtract,
                                      int startIndex,
                                      int numItems,
                                      org.apache.lucene.search.Filter filter,
                                      int[] filteredcount)

searchForFields

public java.util.List searchForFields(org.apache.lucene.search.Query myquery,
                                      java.util.Set fieldsToExtract,
                                      int startIndex,
                                      int numItems,
                                      org.apache.lucene.search.Filter filter,
                                      org.apache.lucene.search.Sort sorter,
                                      int[] filteredcount)

getAllFieldValues

public java.util.List getAllFieldValues(java.lang.String fieldName)

searchCount

public int searchCount(org.apache.lucene.search.Query query)
Run a search, but just give me back the result as a #.


searchCount

public int searchCount(org.apache.lucene.search.Query query,
                       org.apache.lucene.search.Filter filter)

explain

public java.lang.String explain(org.apache.lucene.search.Query query,
                                int docid)

rewrite

public org.apache.lucene.search.Query rewrite(org.apache.lucene.search.Query query)


Copyright © 2006-2009 Atlassian Software Systems Pty Ltd. All Rights Reserved.