lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael McCandless <luc...@mikemccandless.com>
Subject Re: Reaching the posting lists
Date Wed, 21 Apr 2010 13:20:08 GMT
They are indeed abstract in the IndexReader base class, but, the
concrete implementation you get from IndexReader.open or
IndexWriter.getReader implements the methods to return
TermDocs/Positions, and, they return concrete implementations of these
abstract classes.

Mike

2010/4/21 Yağız Kargın <xerxes862@gmail.com>:
> Thanks for the answer. However those classes and methods are abstract.
> Should I write my own implementation? Since Lucene is able to do
> indexing and searching, I think there should be already implementation
> of these things.
>
> Sorry, if Mike's answer also includes this obviously. But I couldn't
> get it, I need some further explanation.
>
> Thanks,
> Yagiz
>
> 2010/4/20 Michael McCandless <lucene@mikemccandless.com>:
>> You have to open an IndexReader in order to walk the postings of newly
>> indexed docs.
>>
>> EG after indexing the doc, ask for a new near-real-time reader
>> (IndexWriter.getReader()), then use the postings API
>> (TermDocs/TermPositions in 3.0.x, but in trunk, with the flex API,
>> DocsEnum/DocsAndPositionsEnum) via IndexReader.
>>
>> Mike
>>
>> On Tue, Apr 20, 2010 at 3:39 AM, Yağız Kargın <xerxes862@gmail.com> wrote:
>>> Hi all,
>>>
>>> I have a question about usage of lucene, I want to figure out how I
>>> can get one or all posting lists, after adding a document to the
>>> index, but without materializing it in files. So after I add a
>>> document (let's say "to be or not to be"), I am asking if I can get
>>> something like this:
>>>
>>> to -> (docID, tf(to));
>>> be -> (docID, tf(be));
>>> ...
>>> ...
>>>
>>> Or this code can help better understanding:
>>>
>>> indexWriter.addDocument(doc);
>>> someObject.someMethod(); -> and this will return all posting lists
>>> created for "doc" in some data structure that i can use.
>>>
>>> As far as I know "addDocument(doc)" writes the results gotten from the
>>> "doc" in files, but it will be better if I can get the posting lists
>>> before they are wrote in files. Maybe something like this:
>>>
>>> someObject.giveMeAllPostingListsOfThisDocument(doc); -> and this will
>>> return all posting lists created for "doc" in some data structure that
>>> i can use.
>>>
>>> how can I write methods like those above (if we don't have same kind
>>> of things), or where can I get the desired data from?
>>>
>>> I will be glad if you can help me.
>>>
>>> Best,
>>> Yagiz Kargin
>>>
>>> ---------------------------------------------------------------------
>>> 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
>>
>>
>
>
>
> --
> Yağız Kargın (Yagiz Kargin)
>
> ---------------------------------------------------------------------
> 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