Changeset 382

Show
Ignore:
Timestamp:
02/08/07 19:56:17 (2 years ago)
Author:
athomas
Message:

pyndexter: Agh. Commit the remainder of the last change.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • pyndexter/trunk/pyndexter/__init__.py

    r380 r382  
    595595        """ Close the indexer. The object is subsequently not usable. 
    596596 
    597         `sync()` is automatically called by the `Framework` prior to `close()`.""" 
     597        `flush()` is automatically called by the `Framework` prior to 
     598        `close()`.""" 
    598599        raise NotImplementedError 
    599600 
     
    633634        """ Optimise the indexer. """ 
    634635 
    635     def sync(self): 
    636         """ Synchronise indexer with stored representation. """ 
     636    def flush(self): 
     637        """Flush indexer state to disk.""" 
    637638 
    638639    def state_store(self): 
     
    875876        """ Sync and close the indexer. The object is subsequently not 
    876877        usable. """ 
    877         self.sync() 
     878        self.flush() 
    878879        self.indexer.close() 
    879880 
     
    882883        self.indexer.optimise() 
    883884 
    884     def sync(self): 
    885         """ Synchronise indexer with on-disk representation. """ 
     885    def flush(self): 
     886        """Flush indexer state to disk.""" 
    886887        if self.mode == READWRITE: 
    887888            if self.mode == READWRITE and self.state_store: 
    888889                store = self.state_store.store() 
    889890                self.source.marshal(store) 
    890             self.indexer.sync() 
     891            self.indexer.flush() 
    891892 
    892893    # Helper methods 
     
    10021003 
    10031004class Excerpt(object): 
    1004     """Generate an excerpt of a Document.""" 
     1005    """Generate an excerpt of a Document. 
     1006 
     1007    Has three useful attributes: 
     1008        `current`   whether this is a current copy of the `Document` (as 
     1009                    opposed to a historical version from the `Indexer`) 
     1010        `quality`   quality of the text compared to the original, between 0. 
     1011                    and 1.0 
     1012        `text`      the excerpt text 
     1013 
     1014    """ 
    10051015    def __init__(self, doc, terms, max_len=240, fuzz=60, current=True): 
    10061016        self.text = self._shorten(doc.content, terms, max_len, fuzz) 
  • pyndexter/trunk/.todo

    r380 r382  
    6969        Use metakit for pure-Python implementation? (Check out "divmod pyndex" for ideas) 
    7070    </note> 
    71     <note priority="medium" time="1170604364"
     71    <note priority="medium" time="1170604364" done="1170931795"
    7272        Deprecate Hit and just use Document - they're almost identical in functionality. 
    73         <note priority="medium" time="1170812979"> 
     73        <comment> 
     74            Bad idea. Hit now has indexed and current members, which lazily fetch from the Indexer and Framework, respectively. 
     75        </comment> 
     76        <note priority="medium" time="1170812979" done="0"> 
    7477            Perhaps Results should use the framework to try and fetch a Document, then "underlay" the hit attributes? 
    7578        </note> 
    7679    </note> 
    77     <note priority="medium" time="1170651530"> 
     80    <note priority="high" time="1170651530"> 
    7881        Add generalised "field" indexing. 
    7982    </note>