StoredField does indeed only store the field, not index it.
MatchAllDocs will find it because, by definition, it matches all docs.
 But other queries won't.

Not sure what you mean when you say you are particular about stored
fields.  If you need to get it back from the index, store it.  If you
don't, don't.  Same for indexing - don't index fields you don't need
for searching.


--
Ian.


On Mon, Feb 11, 2013 at 12:53 PM, Ramprakash Ramamoorthy
<youngestachie...@gmail.com> wrote:
> Team,
>
>            I am facing a strange issue with term queries and stored fields.
> Here is how I index and fetch the query results,
>
> Case 1 :
>   doc.add(new StoredField("published", b.getPublished()));
>   Query query = new MatchAllDocsQuery();
>
>   Results : No of hits : 8(Expected)
>
> Case 2 :
>   doc.add(new StoredField("published", b.getPublished()));
>   Query query = new TermQuery(new Term("published", "2012"));
>
>   Result : No of hits : 0 (Expected - 4)
>
>  Case 3 :
>    doc.add(new Field("published", b.getPublished(), fieldType));
>    Query query = new TermQuery(new Term("published", "2012"));
>
>     Result : No of hits : 4(Expected)
>
> Does StoredField means only store and no index? But in that case, how does
> the match all docs query work? I am puzzled.
>
> I am particular about stored fields, because of the compressed size of the
> index. How do I go about this? Or am I missing something that is obviously
> basic. Please help.
>
> --
> With Thanks and Regards,
> Ramprakash Ramamoorthy,
> India.

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

Reply via email to