Jerry,
You can't add a field to an existing document, but have to delete and
reindex the item.
I'd suggest a copy of Lucene in Action to get started with those basics.
Michael
On Dec 16, 2009, at 1:43 PM, "Jerry Camel" <rlrc...@msn.com> wrote:
I have since updated my code to do just that... So to "fix" this, I
need to iterate through all the docs in the index and add in a false
value if the "hasattachments" field is not present.
Is there a specific test for presence of a field, or do I just catch
an exception?
Thanks.
--------------------------------------------------
From: "Michael Garski" <mgar...@myspace-inc.com>
Sent: Wednesday, December 16, 2009 4:38 PM
To: <lucene-net-user@incubator.apache.org>
Subject: Re: Query For Unpopulated Fields
Jerry,
If you want to query for items without attachments you will want
to index them with the value of 'false' in that field.
Michael
On Dec 16, 2009, at 1:24 PM, "Jerry Camel" <rlrc...@msn.com> wrote:
Okay... I stored a bunch of documents. One of the fields is
called "hasattachments". If the document has an attachment, I
stored the value "true" in that field. I didn't do the
converse... I never stored "false" if the document didn't have
attachments. So it appears that documents without attachments
don't have that field. So I was trying to devise a way to query
for all documents that don't have attachments.
Does that clear it up?
Thanks.
Jerry
--------------------------------------------------
From: "Shashi Kant" <sk...@sloan.mit.edu>
Sent: Wednesday, December 16, 2009 4:13 PM
To: <lucene-net-user@incubator.apache.org>
Subject: Re: Query For Unpopulated Fields
Jerry, there are several reasons other members might have stayed
quiet. I
will give you mine. Your question did not make sense to me and
it would be
helpful if you could elaborate a bit without being too verbose.
I am guessing you are looking for something like the EXCLUDE
statement in
SQL. I am not aware of any Lucene method that would do it. But
you could
approach it by storing the *fieldname* itself as a value in your
index and
query.
hth
On Wed, Dec 16, 2009 at 1:17 PM, Jerry Camel <rlrc...@msn.com>
wrote:
Anyone? ... Does no response mean it's not possible or that
it's such a
newbie question that nobody will dignify it with a response?
J
--------------------------------------------------
From: "Jerry Camel" <rlrc...@msn.com>
Sent: Tuesday, December 15, 2009 11:35 PM
To: <lucene-net-user@incubator.apache.org>
Subject: Query For Unpopulated Fields
Is it possible to query for docs that do not have a specific field
present?
Thanks.
J