You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by poeta simbolista <po...@gmail.com> on 2007/02/07 13:49:55 UTC

How to return results with null values?

HI
I would like to make a query and take out those with null values in a
specific field.
How to?
Thanks
-- 
View this message in context: http://www.nabble.com/How-to-return-results-with-null-values--tf3186799.html#a8844779
Sent from the Lucene - Java Users mailing list archive at Nabble.com.


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


Re: How to return results with null values?

Posted by Chris Hostetter <ho...@fucit.org>.
: > take a look at RangeFilter and set both the upper and lower terms to be
: > null --
: > or if you need a Query and can't use a filter, do the same thing with
: > ConstantScoreRangeQuery.

: This is like, it scores sth for each document that has a field, no matter
: the content?

it scores the same value for all docs that have a field value within the
range -- if the range is unbounded then it will match anything with any
value.  if you are using the QueryParser you can get this behavior with
field:[* TO *] (but i don't remember when that was commited to the trunk,
so your milage may vary)


-Hoss


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


Re: How to return results with null values?

Posted by poeta simbolista <po...@gmail.com>.

Chris Hostetter wrote:
> 
> I'm not sure wether this question is about docs that have no value for a
> field, or docs where the value of the field is null -
> 

The former.


Chris Hostetter wrote:
> 
> adding a filter on that Field that requires *some* value might help. 
> 

Yep, that is what I would like.


Chris Hostetter wrote:
> 
> take a look at RangeFilter and set both the upper and lower terms to be
> null --
> or if you need a Query and can't use a filter, do the same thing with
> ConstantScoreRangeQuery.
> 

This is like, it scores sth for each document that has a field, no matter
the content?


Chris Hostetter wrote:
> 
> 
> : A newbie here, but I would think that fields will null value will slow
> : down the search as much as fields with a specific non-conflicting
> keyword.
> :  There is still a field to be looked at, even if it does not match.
> 
> i believe you are correct ... it doesn't matter wether the Field value is
> null or "" or "some_magic__toKen_$" it's still an instance of a term.
> 
> Of course, not adding that Field value at all would actually make things a
> lot better.
> 
> I'm not sure wether this question is about docs that have no value for a
> field, or docs where the value of the field is null -- but either way
> adding a filter on that Field that requires *some* value might help. take
> a look at RangeFilter and set both the upper and lower terms to be null --
> or if you need a Query and can't use a filter, do the same thing with
> ConstantScoreRangeQuery.
> 
> if what you mean by bull is really "" then you can still do the same thing
> using "" as your lower term but don't be inclusive of the lower term.
> 
> 
> 
> -Hoss
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/How-to-return-results-with-null-values--tf3186799.html#a8870825
Sent from the Lucene - Java Users mailing list archive at Nabble.com.


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


Re: How to return results with null values?

Posted by Chris Hostetter <ho...@fucit.org>.
: A newbie here, but I would think that fields will null value will slow
: down the search as much as fields with a specific non-conflicting keyword.
:  There is still a field to be looked at, even if it does not match.

i believe you are correct ... it doesn't matter wether the Field value is
null or "" or "some_magic__toKen_$" it's still an instance of a term.

Of course, not adding that Field value at all would actually make things a
lot better.

I'm not sure wether this question is about docs that have no value for a
field, or docs where the value of the field is null -- but either way
adding a filter on that Field that requires *some* value might help. take
a look at RangeFilter and set both the upper and lower terms to be null --
or if you need a Query and can't use a filter, do the same thing with
ConstantScoreRangeQuery.

if what you mean by bull is really "" then you can still do the same thing
using "" as your lower term but don't be inclusive of the lower term.



-Hoss


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


Re: How to return results with null values?

Posted by Do...@BIPT.COM.
A newbie here, but I would think that fields will null value will slow 
down the search as much as fields with a specific non-conflicting keyword. 
 There is still a field to be looked at, even if it does not match.
Beyond that I will have to leave it to others with more background with 
the tool.  I will make one suggestion though, indexing fields with 
null/empty values only makes sense if you are looking for that specfic 
field value.
--
Don Reese
BIPT
PO Box 20159
5971 Cattleridge Blvd Ste 101
Sarasota, FL 34276
don.reese@bipt.com
941-358-8004 x139




poeta simbolista <po...@gmail.com> 
02/07/2007 10:28 AM
Please respond to
java-user@lucene.apache.org


To
java-user@lucene.apache.org
cc

Subject
Re: How to return results with null values?







Thanks for the suggestions.
Well, the thing is, some entries have a value on that facet, and some 
others
not. It may happen that all have, all have not, and any combination within
those.

Regarding the thing of adding a field with a specific non-conflicting
keyword, wouldn't it affect the performance of the queries? Especially if
there are a lot of null values, which in my case are more than 50%.

I have a facet BitSet, would it be feasible to:
- get those IDs of the entries which have the facet. ()
- go and perform a single query foreach entry with the ID, to get the 
actual
value of the facet.

Or would it be better to go through the whole index and get the values?

Thank you


Don.Reese wrote:
> 
> Sorry, under the weather today.  Meant to say, don't put fields with 
null 
> values into the index.  You do not have to have a field for the document 

> if that field has no value.
> --
> Don Reese
> BIPT
> PO Box 20159
> 5971 Cattleridge Blvd Ste 101
> Sarasota, FL 34276
> don.reese@bipt.com
> 941-358-8004 x139
> 
> 
> 
> 
> Don.Reese@BIPT.COM 
> 02/07/2007 08:14 AM
> Please respond to
> java-user@lucene.apache.org
> 
> 
> To
> java-user@lucene.apache.org
> cc
> 
> Subject
> Re: How to return results with null values?
> 
> 
> 
> 
> 
> 
> My guess is that if the field has a null empty, don't put the field in 
the 
> 
> index.
> 
> 
> 
> 
> poeta simbolista <po...@gmail.com> 
> 02/07/2007 07:50 AM
> Please respond to
> java-user@lucene.apache.org
> 
> 
> To
> java-user@lucene.apache.org
> cc
> 
> Subject
> How to return results with null values?
> 
> 
> 
> 
> 
> 
> 
> HI
> I would like to make a query and take out those with null values in a
> specific field.
> How to?
> Thanks
> -- 
> View this message in context: 
> 
http://www.nabble.com/How-to-return-results-with-null-values--tf3186799.html#a8844779
> Sent from the Lucene - Java Users mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/How-to-return-results-with-null-values--tf3186799.html#a8847539
Sent from the Lucene - Java Users mailing list archive at Nabble.com.


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




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


Re: How to return results with null values?

Posted by poeta simbolista <po...@gmail.com>.
Thanks for the suggestions.
Well, the thing is, some entries have a value on that facet, and some others
not. It may happen that all have, all have not, and any combination within
those.

Regarding the thing of adding a field with a specific non-conflicting
keyword, wouldn't it affect the performance of the queries? Especially if
there are a lot of null values, which in my case are more than 50%.

I have a facet BitSet, would it be feasible to:
- get those IDs of the entries which have the facet. ()
- go and perform a single query foreach entry with the ID, to get the actual
value of the facet.

Or would it be better to go through the whole index and get the values?

Thank you


Don.Reese wrote:
> 
> Sorry, under the weather today.  Meant to say, don't put fields with null 
> values into the index.  You do not have to have a field for the document 
> if that field has no value.
> --
> Don Reese
> BIPT
> PO Box 20159
> 5971 Cattleridge Blvd Ste 101
> Sarasota, FL 34276
> don.reese@bipt.com
> 941-358-8004 x139
> 
> 
> 
> 
> Don.Reese@BIPT.COM 
> 02/07/2007 08:14 AM
> Please respond to
> java-user@lucene.apache.org
> 
> 
> To
> java-user@lucene.apache.org
> cc
> 
> Subject
> Re: How to return results with null values?
> 
> 
> 
> 
> 
> 
> My guess is that if the field has a null empty, don't put the field in the 
> 
> index.
> 
> 
> 
> 
> poeta simbolista <po...@gmail.com> 
> 02/07/2007 07:50 AM
> Please respond to
> java-user@lucene.apache.org
> 
> 
> To
> java-user@lucene.apache.org
> cc
> 
> Subject
> How to return results with null values?
> 
> 
> 
> 
> 
> 
> 
> HI
> I would like to make a query and take out those with null values in a
> specific field.
> How to?
> Thanks
> -- 
> View this message in context: 
> http://www.nabble.com/How-to-return-results-with-null-values--tf3186799.html#a8844779
> Sent from the Lucene - Java Users mailing list archive at Nabble.com.
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
> 
> 
> 

-- 
View this message in context: http://www.nabble.com/How-to-return-results-with-null-values--tf3186799.html#a8847539
Sent from the Lucene - Java Users mailing list archive at Nabble.com.


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


Re: How to return results with null values?

Posted by Do...@BIPT.COM.
Sorry, under the weather today.  Meant to say, don't put fields with null 
values into the index.  You do not have to have a field for the document 
if that field has no value.
--
Don Reese
BIPT
PO Box 20159
5971 Cattleridge Blvd Ste 101
Sarasota, FL 34276
don.reese@bipt.com
941-358-8004 x139




Don.Reese@BIPT.COM 
02/07/2007 08:14 AM
Please respond to
java-user@lucene.apache.org


To
java-user@lucene.apache.org
cc

Subject
Re: How to return results with null values?






My guess is that if the field has a null empty, don't put the field in the 

index.




poeta simbolista <po...@gmail.com> 
02/07/2007 07:50 AM
Please respond to
java-user@lucene.apache.org


To
java-user@lucene.apache.org
cc

Subject
How to return results with null values?







HI
I would like to make a query and take out those with null values in a
specific field.
How to?
Thanks
-- 
View this message in context: 
http://www.nabble.com/How-to-return-results-with-null-values--tf3186799.html#a8844779
Sent from the Lucene - Java Users mailing list archive at Nabble.com.


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




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




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


Re: How to return results with null values?

Posted by Do...@BIPT.COM.
My guess is that if the field has a null empty, don't put the field in the 
index.




poeta simbolista <po...@gmail.com> 
02/07/2007 07:50 AM
Please respond to
java-user@lucene.apache.org


To
java-user@lucene.apache.org
cc

Subject
How to return results with null values?







HI
I would like to make a query and take out those with null values in a
specific field.
How to?
Thanks
-- 
View this message in context: 
http://www.nabble.com/How-to-return-results-with-null-values--tf3186799.html#a8844779
Sent from the Lucene - Java Users mailing list archive at Nabble.com.


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




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