lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From amar.sann...@gmail.com
Subject Re: Lucene search problem
Date Wed, 24 Dec 2008 06:03:25 GMT
hi Erick,

I agree lucene do not index the object. in the following example I have
quoted fields are indexed as chain.chainName.
I am able to retrieve recipe objects using FullTextQuery as
"chain.chainName:something' ... question is in somecase chain itself is
null.
I can be able to achieve required as below:

class Recipe {
  @DocumentId
  Integer id;
  @IndexedEmbedded
  Chain chain = new Chain();
  //gettter and setter
}

 class Chain {
  @DocumentId
  Integer id;
  @Field(index = Index.TOKENIZED, name="chainName")
  String name = "NULLNULNUL";
  //getter and setter
 }

so this means to always there is will be chain along with Recipe object with
has default name to "NULLNULNUL" and that wil be indexed..
We dont want to do that, Recipe is our persistence object and we hate to do
that.

-Amar

On Tue, Dec 23, 2008 at 8:05 PM, Erick Erickson <erickerickson@gmail.com>wrote:

> How do you intend to index these? Lucene will not
> index objects for you. You have to break the object
> down into a series of fields. At that point you can
> substitute whatever you want.
>
> Best
> Erick
>
> On Tue, Dec 23, 2008 at 3:36 AM, <amar.sannaik@gmail.com> wrote:
>
> > Hi Aaron Schon/EricK,
> >
> > That really make sense to me but it really seems easy if is the string
> > object. See the object structure I have it below hopefully that gives you
> > some idea
> >
> > class Recipe {
> > @DocumentId
> > Integer id;
> > @IndexedEmbedded
> > Chain chain;
> > //gettter and setter
> > }
> >
> > class Chain {
> > @DocumentId
> > Integer id;
> > @Field(index = Index.TOKENIZED, name="chainName")
> > String name;
> > //getter and setter
> > }
> >
> > I am creating index on the recipe object. and for some recipe.m_chain
> would
> > be null. So can you tell me how do I assign the value "NULLNULNULLNULL"
> for
> > object chain in recipe.
> >
> > I also was thinking if #FieldBridge help me this way. My plan was to have
> > default value where chain is null as you mentioned. but it does not seems
> > to
> > work for null values.
> >
> > Please suggest
> >
> > Thanks in advance.
> > -Amar
> >
> > On Tue, Dec 23, 2008 at 12:04 AM, Aaron Schon <aaron_schon@yahoo.com>
> > wrote:
> >
> > > I would second Erick's recommendation - create an arbitrary
> > representation
> > > for NULL such as "NULL" (if you are certain the term "NULL" does not
> > occur
> > > in actual docs. Alternatively, use "NULLNULNULLNULL" or something to
> that
> > > effect.
> > >
> > >
> > >
> > > ----- Original Message ----
> > > From: Erick Erickson <erickerickson@gmail.com>
> > > To: java-user@lucene.apache.org
> > > Sent: Monday, December 22, 2008 8:58:21 AM
> > > Subject: Re: Lucene search problem
> > >
> > > Try searching the mailing list archives for a fuller discussion, but
> > > the short answer is usually to index an unique value for your
> > > "null" entries, then search on that, something totally
> > > outrageous like, say AAABBBCCCDDDEEEFFF.
> > >
> > > Alternatively, you could create, at startup time, a
> > > Filter of all the docs that *do* contain terms for the
> > > field in question, flip the bits and use the Filter in your
> > > searches. (Hint: see TermDocs/TermEnum)
> > >
> > > Best
> > > Erick
> > >
> > > On Mon, Dec 22, 2008 at 8:11 AM, <amar.sannaik@gmail.com> wrote:
> > >
> > > > Hi,
> > > >
> > > > I have problem with lucene search, I am quite new to this. Can some
> > body
> > > > help or just push me to who can please.
> > > >
> > > > Problem what I am facing we need search for object whose attribute
> > > "chain"
> > > > contaning null, but lucene does not help indexing the null values..
> > > >
> > > > how can I achieve this, or please guide me the alternative way of
> doing
> > > > this.
> > > >
> > > > Thanks in advance.
> > > > -Amar
> > > >
> > >
> > >
> > >
> > >
> > >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> > > For additional commands, e-mail: java-user-help@lucene.apache.org
> > >
> > >
> >
> >
> > --
> > Amar Sannaik | Programmer | ATHARVA LIBSON Software Pvt Ltd.,
> > # 9886476270, amarsannaik@atharvalibson.com
> >
>



-- 
Amar Sannaik | Programmer | ATHARVA LIBSON Software Pvt Ltd.,
# 9886476270, amarsannaik@atharvalibson.com

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