I really need some guidance with a problem that's been vexing me for days
now. I spoke with Kimchy on IRC and he suggested I post here. I have an
index with rental properties. Each property has a nested collection of
leases with a start and end date. I want the user to query with a start and
end date that will return properties that DO NOT have a lease that overlaps
with the submitted start and end. The user can also provide search terms,
number of bedrooms, etc. Doing that search was not a problem. But filtering
on the start and end dates is proving problematic.
What is happening with the above query? You're getting no results, all
results?
On Tuesday, November 13, 2012 10:02:12 AM UTC+13, jspeck wrote:
I really need some guidance with a problem that's been vexing me for days
now. I spoke with Kimchy on IRC and he suggested I post here. I have an
index with rental properties. Each property has a nested collection of
leases with a start and end date. I want the user to query with a start and
end date that will return properties that DO NOT have a lease that overlaps
with the submitted start and end. The user can also provide search terms,
number of bedrooms, etc. Doing that search was not a problem. But filtering
on the start and end dates is proving problematic.
It's returning all results. As if the nested query has no effect. What I
want is if the submitted date range overlaps any lease start or end date
then the parent must not be returned.
On Monday, November 12, 2012 5:58:28 PM UTC-5, Chris Male wrote:
What is happening with the above query? You're getting no results, all
results?
On Tuesday, November 13, 2012 10:02:12 AM UTC+13, jspeck wrote:
I really need some guidance with a problem that's been vexing me for days
now. I spoke with Kimchy on IRC and he suggested I post here. I have an
index with rental properties. Each property has a nested collection of
leases with a start and end date. I want the user to query with a start and
end date that will return properties that DO NOT have a lease that overlaps
with the submitted start and end. The user can also provide search terms,
number of bedrooms, etc. Doing that search was not a problem. But filtering
on the start and end dates is proving problematic.
It's returning all results. As if the nested query has no effect. What I
want is if the submitted date range overlaps any lease start or end date
then the parent must not be returned.
On Monday, November 12, 2012 5:58:28 PM UTC-5, Chris Male wrote:
What is happening with the above query? You're getting no results, all
results?
On Tuesday, November 13, 2012 10:02:12 AM UTC+13, jspeck wrote:
I really need some guidance with a problem that's been vexing me for days
now. I spoke with Kimchy on IRC and he suggested I post here. I have an
index with rental properties. Each property has a nested collection of
leases with a start and end date. I want the user to query with a start and
end date that will return properties that DO NOT have a lease that overlaps
with the submitted start and end. The user can also provide search terms,
number of bedrooms, etc. Doing that search was not a problem. But filtering
on the start and end dates is proving problematic.
It's returning all results. As if the nested query has no effect. What I
want is if the submitted date range overlaps any lease start or end date
then the parent must not be returned.
On Monday, November 12, 2012 5:58:28 PM UTC-5, Chris Male wrote:
What is happening with the above query? You're getting no results, all
results?
On Tuesday, November 13, 2012 10:02:12 AM UTC+13, jspeck wrote:
I really need some guidance with a problem that's been vexing me for
days
now. I spoke with Kimchy on IRC and he suggested I post here. I have
an
index with rental properties. Each property has a nested collection of
leases with a start and end date. I want the user to query with a
start and
end date that will return properties that DO NOT have a lease that
overlaps
with the submitted start and end. The user can also provide search
terms,
number of bedrooms, etc. Doing that search was not a problem. But
filtering
on the start and end dates is proving problematic.
First of all, the date field is currently indexed as a string and has to be
fixed for the range queries to work properly. The mapping for date fields
should be
The second issues is with the query itself. You are trying to find all
parents that have no nested documents intersecting with the query range.
Unfortunately, the nested query doesn't work that way. Nested queries
return all parents that have any of the matching nested document. So, in
order to flip "any" query into "none" query, we need to negate the nested
query itself. In order to do that, we can rephrase your query like this:
find all parents that don't have any document intersecting with the query:
It's returning all results. As if the nested query has no effect. What
I
want is if the submitted date range overlaps any lease start or end
date
then the parent must not be returned.
On Monday, November 12, 2012 5:58:28 PM UTC-5, Chris Male wrote:
What is happening with the above query? You're getting no results,
all
results?
On Tuesday, November 13, 2012 10:02:12 AM UTC+13, jspeck wrote:
I really need some guidance with a problem that's been vexing me for
days
now. I spoke with Kimchy on IRC and he suggested I post here. I have
an
index with rental properties. Each property has a nested collection
of
leases with a start and end date. I want the user to query with a
start and
end date that will return properties that DO NOT have a lease that
overlaps
with the submitted start and end. The user can also provide search
terms,
number of bedrooms, etc. Doing that search was not a problem. But
filtering
on the start and end dates is proving problematic.
The second issues is with the query itself. You are trying to find all
parents that have no nested documents intersecting with the query
range. Unfortunately, the nested query doesn't work that way.
But the query says "must_not" with two criteria? Why is that not what
he asked for: parents that don't have children that don't have the
specified ranges?
I after staring at this for awhile I final saw the problem. Sure some
nested objects don't have the range, but another nested of the same
parent passes the test allowing the parent to pass which is apparently
either all or close to all in Johnny's case.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.