Return-Path: Delivered-To: apmail-jakarta-lucene-user-archive@www.apache.org Received: (qmail 13616 invoked from network); 29 Oct 2004 06:26:19 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 29 Oct 2004 06:26:19 -0000 Received: (qmail 65776 invoked by uid 500); 29 Oct 2004 06:26:09 -0000 Delivered-To: apmail-jakarta-lucene-user-archive@jakarta.apache.org Received: (qmail 65752 invoked by uid 500); 29 Oct 2004 06:26:08 -0000 Mailing-List: contact lucene-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Lucene Users List" Reply-To: "Lucene Users List" Delivered-To: mailing list lucene-user@jakarta.apache.org Received: (qmail 65735 invoked by uid 99); 29 Oct 2004 06:26:08 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received-SPF: pass (hermes.apache.org: local policy) Received: from [143.205.118.212] (HELO proserver2.ifit.uni-klu.ac.at) (143.205.118.212) by apache.org (qpsmtpd/0.28) with ESMTP; Thu, 28 Oct 2004 23:26:05 -0700 Received: from [143.205.118.98] ([143.205.118.98]) by proserver2.ifit.uni-klu.ac.at over TLS secured channel with Microsoft SMTPSVC(5.0.2195.6713); Fri, 29 Oct 2004 08:25:57 +0200 Message-ID: <4181E275.1090201@ifit.uni-klu.ac.at> Date: Fri, 29 Oct 2004 08:25:57 +0200 From: sergiu gordea User-Agent: Mozilla Thunderbird 0.7 (Windows/20040616) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Lucene Users List Subject: Re: Searching for a path References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 29 Oct 2004 06:25:57.0514 (UTC) FILETIME=[26A6B6A0:01C4BD80] X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N Bill Tschumy wrote: > I have a need to search an index for documents that were taken ffrom > particulars files in the filesystem. > > Each document in the index has a field named "url" that is created using: > > doc.add(Field.Text("url", urlStr)); > > I understand this is both stored and indexed. > > My search works if I do something like: > > String queryStr = "\"file:///someDir/someOtherDir/File.txt\"" > query = MultiFieldQueryParser.parse("url:" + queryString, > searchedFields, new StandardAnalyzer()); > hits = searcher.search(query); > > It is important for me to quote the path for the search to succeed > > I was hoping to speed the search up a bit by bypassing the > QueryParser. However, if I do something like > > String queryStr = "\"file:///someDir/someOtherDir/File.txt\"" > Query query = new TermQuery(new Term("url", queryStr)); > hits = searcher.search(query); For the begining I suggest you to make a system.out.println(query); and to see what is the difference between the 2 queries .... Sergiu ahh.... I see now you must to construct a PhraseQuery instead of TermQuery ... The first one is PhraseQuery the second one that you construct with the term is TermQuery. I suggest you to use QueryParser, the differemce in performance between your constructed query is just the interpretation of regular expresion to find the type of the query. Using the QueryParser will ensure you that you won't face problems that this one anymore. All the best, Sergiu > > I get zero hits. Why are these not equivalent? I think it has > something to do with the fact that the url needs to be quoted so I > search for an exact match. It does work if I have stored the url as a > "Field.Keyword" rather than as "Field.Text" and then don't need to > quote the string. However I would prefer not to have to change the > format of the index. > > Thanks for any help. > --------------------------------------------------------------------- To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: lucene-user-help@jakarta.apache.org