lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Marvin Humphrey (JIRA)" <>
Subject [jira] Commented: (LUCENE-1458) Further steps towards flexible indexing
Date Wed, 26 Nov 2008 20:52:44 GMT


Marvin Humphrey commented on LUCENE-1458:

> In Lucene we now have an indexing chain
> (package private), so that you can "tap in" at whatever point is
> appropriate - you could handle the whole doc yourself (like
> SegDataWriter); you could be fed one field at a time; you could tap in
> after inversion so you get one token at a time, etc.

That's pretty nice.  It occurred to me to try something like that, but I got a
little lost.  

The fact that the Doc object in KS uses the host language's native hashtable
and string implementations for field data complicates an already complicated
matter.  It's hard to abstract out access to field data so that the KS/Lucy
core, which knows nothing about the host language, can see it, yet still
maintain peak performance in the addDoc() loop.

In any case, I don't anticipate intractable implementation troubles with
adding IndexComponents at index-time.

> IR.getReader seems fine, though, you'd need to open each
> IndexComponent up front inside the retry loop, right?

Sure, startup's easy.  I think we just add Schema.auxiliaryComponents(),
which returns an array of IndexComponents.  The default would be to return
null or an empty array, but subclasses could override it.

Where we have problems, though, is with remote searching or multi-searching.
You can't ask a Searchable for its inner IndexReader, because it might not
have one.  That means that you can't "see" information pertaining to a custom
IndexComponent until you're at the level of the individual machine --
aggregate information, like docFreq across an entire collection spanning
multiple indexes, wouldn't be available to searches which use custom

The only remedy would be to subclass all your Searchables -- the local
IndexSearcher, the RemoteSearchable that wraps it, and the MultiSearcher that
aggregates results -- to drill down into the correct IndexReader and pass data
back up the chain.  Basically, you'd have to duplicate e.g. the call chain
that fetches documents.

> Further steps towards flexible indexing
> ---------------------------------------
>                 Key: LUCENE-1458
>                 URL:
>             Project: Lucene - Java
>          Issue Type: New Feature
>          Components: Index
>    Affects Versions: 2.9
>            Reporter: Michael McCandless
>            Assignee: Michael McCandless
>            Priority: Minor
>             Fix For: 2.9
>         Attachments: LUCENE-1458.patch, LUCENE-1458.patch, LUCENE-1458.patch, LUCENE-1458.patch
> I attached a very rough checkpoint of my current patch, to get early
> feedback.  All tests pass, though back compat tests don't pass due to
> changes to package-private APIs plus certain bugs in tests that
> happened to work (eg call TermPostions.nextPosition() too many times,
> which the new API asserts against).
> [Aside: I think, when we commit changes to package-private APIs such
> that back-compat tests don't pass, we could go back, make a branch on
> the back-compat tag, commit changes to the tests to use the new
> package private APIs on that branch, then fix nightly build to use the
> tip of that branch?o]
> There's still plenty to do before this is committable! This is a
> rather large change:
>   * Switches to a new more efficient terms dict format.  This still
>     uses tii/tis files, but the tii only stores term & long offset
>     (not a TermInfo).  At seek points, tis encodes term & freq/prox
>     offsets absolutely instead of with deltas delta.  Also, tis/tii
>     are structured by field, so we don't have to record field number
>     in every term.
> .
>     On first 1 M docs of Wikipedia, tii file is 36% smaller (0.99 MB
>     -> 0.64 MB) and tis file is 9% smaller (75.5 MB -> 68.5 MB).
> .
>     RAM usage when loading terms dict index is significantly less
>     since we only load an array of offsets and an array of String (no
>     more TermInfo array).  It should be faster to init too.
> .
>     This part is basically done.
>   * Introduces modular reader codec that strongly decouples terms dict
>     from docs/positions readers.  EG there is no more TermInfo used
>     when reading the new format.
> .
>     There's nice symmetry now between reading & writing in the codec
>     chain -- the current docs/prox format is captured in:
> {code}
> FormatPostingsTermsDictWriter/Reader
> FormatPostingsDocsWriter/Reader (.frq file) and
> FormatPostingsPositionsWriter/Reader (.prx file).
> {code}
>     This part is basically done.
>   * Introduces a new "flex" API for iterating through the fields,
>     terms, docs and positions:
> {code}
> FieldProducer -> TermsEnum -> DocsEnum -> PostingsEnum
> {code}
>     This replaces TermEnum/Docs/Positions.  SegmentReader emulates the
>     old API on top of the new API to keep back-compat.
> Next steps:
>   * Plug in new codecs (pulsing, pfor) to exercise the modularity /
>     fix any hidden assumptions.
>   * Expose new API out of IndexReader, deprecate old API but emulate
>     old API on top of new one, switch all core/contrib users to the
>     new API.
>   * Maybe switch to AttributeSources as the base class for TermsEnum,
>     DocsEnum, PostingsEnum -- this would give readers API flexibility
>     (not just index-file-format flexibility).  EG if someone wanted
>     to store payload at the term-doc level instead of
>     term-doc-position level, you could just add a new attribute.
>   * Test performance & iterate.

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message