lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Uwe Schindler" <...@thetaphi.de>
Subject RE: Flex & Docs/AndPositionsEnum
Date Tue, 09 Feb 2010 12:16:28 GMT
Hi Renaud,

In flex the correct way to add additional posting data to these classes would be the usage
of custom attributes, registered in the attributes() AttributeSource.

Due to some limitations, there is currently no working support in MultiReaders to have a "view"
on the underlying Enums, but we are working on that.

In general what you do (if it works in future):
Define an interface for your extensions based on the Attribute interface and also provide
the implementation class. Then call YourEnums.attributes().addAttribute(YourInterface.class)
in the ctor of your enum, store a local reference to the attribute and fill this on iteration.
Any consumer of this Enum can check using TermPositions.attributes().hasAttribute/getAttribute/addAttribute
for the existence of the the same and then read the attributes during iteration. There is
no need to change the Enum class API at all.

It works in the same way like the TokenStreams since 2.9/3.0.

Uwe

-----
Uwe Schindler
H.-H.-Meier-Allee 63, D-28213 Bremen
http://www.thetaphi.de
eMail: uwe@thetaphi.de


> -----Original Message-----
> From: Renaud Delbru [mailto:renaud.delbru@deri.org]
> Sent: Tuesday, February 09, 2010 1:05 PM
> To: java-user
> Cc: Michael McCandless
> Subject: Flex & Docs/AndPositionsEnum
> 
> Hi Michael,
> 
> I have updated my lucene-1458, and I discovered there was big
> modifications in the StandardCodec interface.
> I updated my own codecs to this new interface, but I encounter a
> problem. My codecs are creating DocsAndPositionsEnum subclasses that
> allow to access more information than simply the doc, freq and position
> (I have other information encoded into the Prox file).
> In the code, to be able to manipulate the additional interface that my
> classes provide, I was casting the DocsAndPositionsEnum object returned
> by IndexReader#termPositionsEnum() into the correct subclass. While
> this
> approach was working in the previous flewx branch, this does not work
> anymore with the last committed changes. In certain cases, the
> IndexReader#termPositionsEnum() does not return the
> DocsAndPositionsEnum
> created by the StandardPostingsReader, but a MultiDocsAndPositionsEnum.
> However, I am not able either to subclass the MultiDocsAndPositionsEnum
> or to wrap it into a decorator because it is declared as 'private
> static
> final' in DirectoryReader.
> 
> Are these classes (MultiTermEnum, MultiDocsAndPositionsEnum, etc.)
> hidden in a voluntary manner ? Or is there is another way to extends
> StandardCodec without having to deal with these classes ?
> 
> Cheers
> --
> Renaud Delbru
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message