Re: Find docs close to a date

2007-04-05 Thread Chris Hostetter
: My docs have a date field and I need to find the two docs with
: a date which is closest to 2007-03-25T17:22:00Z.
:
: I use the following two queries to accomplish the task.
:
: date:{* TO 2007-03-25T17:22:00Z};date descstart=0rows=1
: date:{2007-03-25T17:22:00Z TO *};date ascstart=0rows=1
:
: However I need to make a lot of queries like these. I'm wondering if
: these kinds queries are expensive. Are there better alternatives for my
: task?

off the top of my head, i can't think of any better way to do what you are
doing out of hte box with Solr ... if you wanted to write a bit of
custom java code, a FunctionQuery ValueSource that made a bell curve
arround a particular value would be a very cool/vlearn/reusable solution
to this problem.

One thing to watch out for is that this gives you the doc with the latest
date prior to your input, and the doc with the earliest date after your
input -- which is not exactly the two docs with a date which is closest
to ... the two docs with the closest dates might have dates both below
hte input, or both above the input.




-Hoss



Re: Find docs close to a date

2007-04-05 Thread nick19701


Chris Hostetter wrote:
 
 off the top of my head, i can't think of any better way to do what you are
 doing out of hte box with Solr ... if you wanted to write a bit of
 custom java code, a FunctionQuery ValueSource that made a bell curve
 arround a particular value would be a very cool/vlearn/reusable solution
 to this problem.
 
 One thing to watch out for is that this gives you the doc with the latest
 date prior to your input, and the doc with the earliest date after your
 input -- which is not exactly the two docs with a date which is closest
 to ... the two docs with the closest dates might have dates both below
 hte input, or both above the input.
 
 

Yes, I'm looking for the doc with the latest date prior to my input, 
and the doc with the earliest date after my input, not the two docs 
with a date which is closest to my input.

One application of this is to determine email's signature.
One person's email signature may change over time. So I only want
to compare one email with the emails immediately before or after
this one.

I haven't written any java code yet. But maybe someday I will
try for this one.

-- 
View this message in context: 
http://www.nabble.com/Find-docs-close-to-a-date-tf3507295.html#a9858867
Sent from the Solr - User mailing list archive at Nabble.com.