lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From VIGNESH S <vigneshkln...@gmail.com>
Subject Re: MultiFields.getReader() returns null
Date Wed, 17 Jul 2013 05:52:06 GMT
Hi Mike,

The Problem I mentioned is I used 3 Fields subject title, Content.

I indexed Subject and Title like this..

doc.add(new StringField(subject, mAccountId, Field.Store.YES));

doc.add(new StringField(title, mSearchParam, Field.Store.YES));

I indexed Content like this[as a TextField]

FieldType offsetsType = new FieldType(TextField.TYPE_STORED);

offsetsType.setIndexOptions(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS);
Document doc = new Document();
 Field body = new Field(ContentIndex.KEY_TEXTCONTENT, "", offsetsType);
 body.setStringValue(content);


When I use Fields fields = MultiFields.getFields(mReader),I found only two
fields coming subject and Title not the Content Field.

I changed the TextField to StringField and It is coming now..

Thanks for your Help..




On Tue, Jul 16, 2013 at 8:29 PM, Michael McCandless <
lucene@mikemccandless.com> wrote:

> I'm confused about the problem: exactly which method call is returning
> null?  What do yo umean by "it is coming in the contents of
> MultiReader"?  Maybe post a full working test showing the problem?
>
> Your indexing code looks correct, except if you are using only
> PostingsHighlighter you don't need to index term vectors.  Also, since
> you are starting from TextField.TYPE_STORED, you should only need to
> call
> offsetsType.setIndexOptions(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS)
> ... all the other settings (except term vectors) are inherited from
> TextField.TYPE_STORED.
>
> Mike McCandless
>
> http://blog.mikemccandless.com
>
>
> On Tue, Jul 16, 2013 at 9:56 AM, VIGNESH S <vigneshklncit@gmail.com>
> wrote:
> > Hi Mike,
> >
> > If i use StringField.Type_STORED instead of TextField.Type_Stored it is
> > coming in the contents of MultiReader..
> >
> >
> >
> > On Tue, Jul 16, 2013 at 7:16 PM, VIGNESH S <vigneshklncit@gmail.com>
> wrote:
> >
> >> Hi Mike,
> >>
> >> Thanks for your Reply.
> >>
> >> Contents are Getting Indexed..In MultiReader the other two fields are
> >> coming except the field(ContentIndex.KEY_TEXTCONTENT) which i indexed
> >> like below
> >>
> >> FieldType offsetsType = new FieldType(TextField.TYPE_STORED);
> >> offsetsType.setIndexed(true);
> >>  offsetsType.setStored(true);
> >> offsetsType.setStoreTermVectors(true);
> >> offsetsType.setTokenized(true);
> >>  offsetsType.setStoreTermVectorOffsets(true);
> >>
> >>
> offsetsType.setIndexOptions(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS);
> >> Document doc = new Document();
> >>  Field body = new Field(ContentIndex.KEY_TEXTCONTENT, "", offsetsType);
> >>   body.setStringValue(content);
> >>
> >> Any problem with the above indexing methodology..Basically I am Indexing
> >> like this for implementing Postings Highlighter..
> >>
> >> Please kindly help..
> >>
> >>
> >> On Tue, Jul 16, 2013 at 5:06 PM, Michael McCandless <
> >> lucene@mikemccandless.com> wrote:
> >>
> >>> MultiFields.getFields returns null if the reader has no postings.  Are
> >>> you sure you actually indexed any content?
> >>>
> >>> Mike McCandless
> >>>
> >>> http://blog.mikemccandless.com
> >>>
> >>>
> >>> On Tue, Jul 16, 2013 at 3:06 AM, VIGNESH S <vigneshklncit@gmail.com>
> >>> wrote:
> >>> > Hi,
> >>> >
> >>> > I am creating index like this in\\using Lucene 4.3.1
> >>> >
> >>> > I am using 3 fields like
> >>> >
> >>> > FieldType offsetsType = new FieldType(TextField.TYPE_STORED);
> >>> > offsetsType.setIndexed(true);
> >>> > offsetsType.setStored(true);
> >>> > offsetsType.setStoreTermVectors(true);
> >>> > offsetsType.setTokenized(true);
> >>> > offsetsType.setStoreTermVectorOffsets(true);
> >>> >
> >>>
> offsetsType.setIndexOptions(IndexOptions.DOCS_AND_FREQS_AND_POSITIONS_AND_OFFSETS);
> >>> > Document doc = new Document();
> >>> >  Field body = new Field(ContentIndex.KEY_TEXTCONTENT, "",
> offsetsType);
> >>> >  body.setStringValue(content);
> >>> >
> >>> >
> >>> > In Search, I am using code like this
> >>> >
> >>> > Fields fields = MultiFields.getFields(mReader);
> >>> >
> >>> > It returns null in Fields..What can be the problem
> >>> >
> >>> >
> >>> >
> >>> >
> >>> >
> >>> > --
> >>> > Thanks and Regards
> >>> > Vignesh Srinivasan
> >>> > 9739135640
> >>>
> >>> ---------------------------------------------------------------------
> >>> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> >>> For additional commands, e-mail: java-user-help@lucene.apache.org
> >>>
> >>>
> >>
> >>
> >> --
> >> Thanks and Regards
> >> Vignesh Srinivasan
> >> 9739135640
> >>
> >
> >
> >
> > --
> > Thanks and Regards
> > Vignesh Srinivasan
> > 9739135640
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>


-- 
Thanks and Regards
Vignesh Srinivasan
9739135640

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