I cannot get this to work for the life of me.  I am using a Standard
analyzer now.

Question 1:  What field type should the path be it be?
     doc.add(Field.UnIndexed("path", f.getAbsolutePath())); where f is a
file object

Question 2:  What should the query be to retieve that one file?

Term:

    Term t = new Term("path",file.getAbsolutePath());
                TermQuery tQ = new TermQuery(t);
        System.out.println(tQ.toString("path"));
        Hits hits = this.searcher.search(tQ);
        System.out.println(hits.length() + " total matching documents");
or:

        /*      QueryParser parser = new QueryParser();
        System.out.println(file.getAbsolutePath());
                this.query = parser.parse(file.getAbsolutePath());
        System.out.println(this.query.toString("path"));
        Hits hits = this.searcher.search(this.query);
        System.out.println(hits.length() + " total matching documents");
        Document doc = hits.doc(0);
        System.out.println("class = " + doc.get("classification"));*/

If I can get past this hurdle I will so be on my way.


Thanks,

Rob


-----Original Message-----
From: Otis Gospodnetic [mailto:otis_gospodnetic@;yahoo.com]
Sent: Thursday, October 24, 2002 10:37 AM
To: Lucene Users List
Subject: RE: Error when trying to match file path


The Analyzer is stripping your \ characters.  Query Parser doesn't do
that...

Otis

--- Rob Outar <[EMAIL PROTECTED]> wrote:
> Some more information, with the following:
>
>               this.query =
> QueryParser.parse(file.getAbsolutePath(),"path",this.analyzer);
>         System.out.println(this.query.toString("path"));
> I got:
> F:"onesaf dev block b pair dev unittestdatafiles tools
> unitcomposer.xml"
>
> So it looks like the Query Parser is stripping out all the "\", and
> doing
> something with the F:\, would anyone happen to know why this is
> happening?
> Do I need to use a different query to get the infromation I need?
>
> Thanks,
>
> Rob
>
> -----Original Message-----
> From: Rob Outar [mailto:routar@;ideorlando.org]
> Sent: Wednesday, October 23, 2002 5:48 PM
> To: [EMAIL PROTECTED]
> Subject: Error when trying to match file path
>
>
> Hi all,
>
> I am indexing the filepath with the below:
>
>  Document doc = new Document();
>         doc.add(Field.UnIndexed("path", f.getAbsolutePath()));
>
> I then try to run the following after building the index:
>
>  this.query =
> QueryParser.parse(file.getAbsolutePath(),"path",this.analyzer);
>         Hits hits = this.searcher.search(this.query);
>
> It returns zero hits?!?
>
> What am I doing wrong?
>
> Any help would be appreciated.
>
> Thanks,
>
> Rob
>
>
> --
> To unsubscribe, e-mail:
> <mailto:lucene-user-unsubscribe@;jakarta.apache.org>
> For additional commands, e-mail:
> <mailto:lucene-user-help@;jakarta.apache.org>
>


__________________________________________________
Do you Yahoo!?
Y! Web Hosting - Let the expert host your web site
http://webhosting.yahoo.com/

--
To unsubscribe, e-mail:
<mailto:lucene-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail:
<mailto:lucene-user-help@;jakarta.apache.org>


--
To unsubscribe, e-mail:   <mailto:lucene-user-unsubscribe@;jakarta.apache.org>
For additional commands, e-mail: <mailto:lucene-user-help@;jakarta.apache.org>

Reply via email to