Package grassyknoll :: Package backend :: Package lucene :: Module LuceneCollection :: Class LuceneCollection
[hide private]

Class LuceneCollection

source code


a Collection.Collection with Smarts

This class implements all of the Collection.Collection methods.

Collection.CollectionResults returned include a __score__ field, a measure of relevance.

Collection.CollectionResultSets returned include as metadata:

Instance Methods [hide private]
 
__init__(self, index_dir, default_storage_norman, create=False, **storage_normans)
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
source code
 
__len__(self) source code
CollectionIds
delete(self, ids)
delete several CollectionDocuments by id
source code
CollectionResultSet
retrieve(self, ids, fields=None)
retrive several CollectionResults by id
source code
CollectionIds
create(self, docs)
XXX this should prolly return None
source code
CollectionResultSet
searchQuery(self, q, start=0, stop=None, fields=None)
search the collection.
source code
CollectionIds
list(self)
Returns: the ids in the collection
source code
 
close(self)
free resources associated with this collection
source code
 
cleanUp(self)
Remove storage directory.
source code
Smarts.SmartDoc
buildSmartDoc(self, doc) source code

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __str__

Class Methods [hide private]

Inherited from lib.meta.FactoryMixin: factory

Static Methods [hide private]
 
__oneIdQuery(id)
Returns: a lucene.Query for a single id
source code
 
__manyIdQuery(ids)
Returns: a lucene.Query for many ids
source code
dict
__resultFields(hit, fields=None)
builds fields for a Collection.CollectionResult from a hit
source code
Instance Variables [hide private]
Norman.ObjectNorman default_storage_norman
a default storage_normans to be used if no norman is specified for a Collection.CollectionDocument
string index_dir
the location of the index
dict storage_normans
norman name => a Norman consisting SmartFieldNormans describing how fields should be saved into the index
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, index_dir, default_storage_norman, create=False, **storage_normans)
(Constructor)

source code 
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
Parameters:
  • create (bool) - create the index if it doesn't exist
Overrides: object.__init__

__len__(self)
(Length operator)

source code 
Overrides: collection.Collection.Collection.__len__

__oneIdQuery(id)
Static Method

source code 
Returns:
a lucene.Query for a single id

__manyIdQuery(ids)
Static Method

source code 
Returns:
a lucene.Query for many ids

delete(self, ids)

source code 

delete several CollectionDocuments by id

XXX this should prolly return None
Returns: CollectionIds
the deleted ids
Decorators:
  • @Collection.addMetaData
Overrides: collection.Collection.Collection.delete
(inherited documentation)

retrieve(self, ids, fields=None)

source code 
retrive several CollectionResults by id
Returns: CollectionResultSet
the results
Decorators:
  • @Collection.addMetaData
Overrides: collection.Collection.Collection.retrieve
(inherited documentation)

create(self, docs)

source code 
XXX this should prolly return None
Returns: CollectionIds
the created ids
Decorators:
  • @Collection.addMetaData
Overrides: collection.Collection.Collection.create
(inherited documentation)

searchQuery(self, q, start=0, stop=None, fields=None)

source code 

search the collection.

start and stop are interpreted in Python slice sense.
Parameters:
  • q (unicode) - a Lucene query string
  • start (int) - index of first result to return.
  • stop (int) - index of last+1 result to return.
  • fields (set) - a sub-set of fields that should be returned. Defaults to None, meaning all available fields.
Returns: CollectionResultSet
the results, or None if not found
Decorators:
  • @Collection.addMetaData

list(self)

source code 
Returns: CollectionIds
the ids in the collection
Decorators:
  • @Collection.addMetaData
Overrides: collection.Collection.Collection.list
(inherited documentation)

close(self)

source code 
free resources associated with this collection
Overrides: collection.Collection.Collection.close
(inherited documentation)

cleanUp(self)

source code 
Remove storage directory.
Overrides: collection.Collection.Collection.cleanUp

buildSmartDoc(self, doc)

source code 
Returns: Smarts.SmartDoc