lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Laxmilal Menaria" <lmena...@chambal.com>
Subject Re: Indexing multiple instances of the same field and counting their frequency afterward
Date Wed, 04 Apr 2007 13:16:43 GMT
hello,

you can try this code :

IndexReader ISer= IndexReader.open("C:/Testindex");
            TermEnum te=ISer.terms(new Term("Features","blue"));
            Term te1= te.term();
            System.out.println("Frequency of blue "+ISer.docFreq(te1));

regards,
-LM

On 4/4/07, Sengly Heng <sengly.heng@gmail.com> wrote:
>
> Dear all,
>
> My problem is a little bit strange. Instead of parsing the content of the
> document to the indexer. I am adding one by one. Here is a piece of my
> code
> :
>
> Document doc = new Document();
> doc.add(Field.Text("Features", "blue");
> doc.add(Field.Text("Features","beautiful");
> doc.add(Field.Text("Features", "black");
> doc.add(Field.Text("Features","white");
> doc.add(Field.Text("Features", "blue");
> doc.add(Field.Text("Features","blue");
>
> I'd like to know whether the internal representation of this is like when
> we
> add at once the whole content of the document as a long string? I'd like
> also to count the number of "blue" occurence from the document. How to do
> this?
>
> Thank you very much for your suggestion in advance.
>
> Regards,
>
> Sengly
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message