try, a boolean query with a MUST_NOT clause. something like...

BooleanQuery bq = new BooleanQuery()
Query noattach = qp.Parse("hasAttachments",...)
bq.Add(noattach, BooleanClause.Occur.MUST_NOT)


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
>>>>>
>>>>>
>>>>
>>>>
>>
>

Reply via email to