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 Rob Outar <ro...@ideorlando.org> on 2002/11/21 15:39:37 UTC

Range Query failing

All,

	I have the following code that I know should return results but it is not,
does anything look odd with the following code?

        Term start = new Term(this.MODIFIED_DT,
DateField.dateToString(from));
        Term end = new Term(this.MODIFIED_DT, DateField.dateToString(to));
        RangeQuery q = new RangeQuery(start,end,true);
        Hits h = this.searcher.search(q);
	  System.out.println(q.toString(""));
        System.out.println(h.length());
        return this.buildReturnArray(h);

The query formed looks like this:

modified:[0d5qowrk8-0d20f7pnk]

My client code looks like this:


            String temp[] =  s.dateRangeQuery
            (new Date(f.lastModified()), new Date(f2.lastModified()));

Where f and f2 are java.io.Files whose lastModified dates have been indexed
in the following field:

  doc.add(new Field(MODIFIED_DT,
            DateField.timeToString(f.lastModified()), true, true, true));

Although tokenize is set to true, no tokeninging takes place, it's a hack to
allow for case insensitive searching using the following analyzer:

   public TokenStream tokenStream(String field, final Reader reader) {
        // do not tokenize any field
        TokenStream t = new CharTokenizer(reader) {
            protected boolean isTokenChar(char c) {
                return true;
            }
        };
        //case insensitive search
        t = new LowerCaseFilter(t);

        return t;
    }

Let me know if I am doing something wrong.

Thanks,

Rob


-----Original Message-----
From: Craig Walls [mailto:wallsc@michaels.com]
Sent: Thursday, November 21, 2002 9:16 AM
To: Lucene Users List
Subject: Re: Fun project?



I've been toying with a similar idea for a couple of months now. Very
similar to
what you describe except that the app would be focused on indexing and
sharing
GEDCOM (genealogy data) files in a P2P network.

My plan is to use Lucene to index the GEDCOM files with searchable fields
such as
surname, location (of birth, marriage, death, etc) and dates of various
events in
an individual's life. The client itself would probably be a Swing app, but
I've
been tinkering with Thinlets lately and they're starting to appeal to me.
Finally, I had planned on using JXTA to implement the P2P part. Mostly
because
that's all I know about and partly because I have a friend who authored a
book on
JXTA that I can annoy with questions if necessary. (Incidentally--and
slightly
off-topic, in case anyone wants to try something like this with JXTA, let me
save
you some headache: I recommend against using Peer Resolver for performing
the
search...it only *sorta* works. A better choice, according to my author
friend,
would be propogate pipes, but I've not tried this yet.)


"Robert A. Decker" wrote:

> I wish I had time to work on this for fun, but I was thinking about what
> could be a fun lucene project...
>
> One could build a peer-to-peer document search application. Each client
> would index the documents on its harddrive, or documents in a particular
> directory. When the user at the computer does a search it will look at the
> documents on its harddrive, but also send out a request for the search on
> the P2P network.
>
> First though, are there any P2P java frameworks out there? One could build
> one, perhaps with OpenJMS, but it would be nice if one already existed.
>
> Hmm... if anyone else thinks this would be cool I'd be willing to work on
> this with you.
>
> thanks,
> Robert A. Decker
>
> http://www.robdecker.com/
> http://www.planetside.com/
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
For additional commands, e-mail:
<ma...@jakarta.apache.org>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>