com.binaryfantasy.murq.search
Class ContentIndex

java.lang.Object
  extended by com.binaryfantasy.murq.search.ContentIndex

public class ContentIndex
extends Object

ContentIndex encapsulates the indexing and searching of content persisted by Murq using Apache Lucene.

FOR INTERNAL USE ONLY.

Author:
Bill Weiss

Constructor Summary
ContentIndex(MurqSource src)
          Constructs a new ContentIndex object, either from data in the specified src or creating new index data.
 
Method Summary
 void add(ContentIndex index)
          Adds the index data from the specified index to this ContentIndex.
 void add(IContent content)
          Adds indexing information from the provided content to the index, removing and previous index data associated with it.
 Set<IContent> find(MurqQuery query)
          Performs a search of all content and returns a Set of matching content, or an empty Set if no matches are found.
 org.apache.lucene.search.Hits find(org.apache.lucene.search.Query query)
          Performs a search of all content and returns Lucene Hits of matching content.
 IContent findRandom(MurqQuery query)
          Returns a single, random IContent from the results returned from the specified query, or null if no matches are found.
 Set<SourceKey> findSourceKeys(MurqQuery query)
          Performs a search of all content and returns a Set of SourceKeys of matching content, or an empty Set if no matches are found.
 void remove(SourceKey key)
          Removes index data about the content associated with the specified key.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ContentIndex

public ContentIndex(MurqSource src)
Constructs a new ContentIndex object, either from data in the specified src or creating new index data.

Parameters:
src - the MurqSource used for persistance.
Method Detail

findRandom

public IContent findRandom(MurqQuery query)
Returns a single, random IContent from the results returned from the specified query, or null if no matches are found.

Parameters:
query - defines the search, from which the random result will be selected.
Returns:
a single, random IContent from the results returned from the specified query, or null if no matches are found.

find

public Set<IContent> find(MurqQuery query)
Performs a search of all content and returns a Set of matching content, or an empty Set if no matches are found.

Parameters:
query - defines the search terms.
Returns:
the of matching content, or an empty Set if no matches are found.
Throws:
IllegalArgumentException - if the queryStr is null or if it cannot be parsed.
IllegalStateException - if this Murq instance is closed.

findSourceKeys

public Set<SourceKey> findSourceKeys(MurqQuery query)
Performs a search of all content and returns a Set of SourceKeys of matching content, or an empty Set if no matches are found.

Parameters:
query - defines the search terms.
Returns:
the SourceKeys of matching content, or an empty Set if no matches are found.
Throws:
IllegalArgumentException - if the query is null.

find

public org.apache.lucene.search.Hits find(org.apache.lucene.search.Query query)
Performs a search of all content and returns Lucene Hits of matching content.

Parameters:
query - defines the search terms.
Returns:
Lucene Hits of matching content.
Throws:
IllegalArgumentException - if the query is null.

add

public void add(IContent content)
Adds indexing information from the provided content to the index, removing and previous index data associated with it.

Parameters:
content - the content to be indexed.

remove

public void remove(SourceKey key)
Removes index data about the content associated with the specified key.

Parameters:
key - the SourceKey associated with the content.

add

public void add(ContentIndex index)
Adds the index data from the specified index to this ContentIndex.

Parameters:
index - the ContentIndex containing the data to be added.


Copyright (c) 2000-2006, BinaryFantasy.com