Return-Path: Delivered-To: apmail-lucene-java-user-archive@www.apache.org Received: (qmail 49433 invoked from network); 19 Jul 2006 12:22:58 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur.apache.org with SMTP; 19 Jul 2006 12:22:58 -0000 Received: (qmail 51918 invoked by uid 500); 19 Jul 2006 12:22:53 -0000 Delivered-To: apmail-lucene-java-user-archive@lucene.apache.org Received: (qmail 51437 invoked by uid 500); 19 Jul 2006 12:22:51 -0000 Mailing-List: contact java-user-help@lucene.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: java-user@lucene.apache.org Delivered-To: mailing list java-user@lucene.apache.org Received: (qmail 51420 invoked by uid 99); 19 Jul 2006 12:22:51 -0000 Received: from asf.osuosl.org (HELO asf.osuosl.org) (140.211.166.49) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 19 Jul 2006 05:22:51 -0700 X-ASF-Spam-Status: No, hits=0.5 required=10.0 tests=DNS_FROM_RFC_ABUSE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (asf.osuosl.org: domain of p.imbemba@gmail.com designates 64.233.182.191 as permitted sender) Received: from [64.233.182.191] (HELO nf-out-0910.google.com) (64.233.182.191) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 19 Jul 2006 05:22:50 -0700 Received: by nf-out-0910.google.com with SMTP id b2so171452nfe for ; Wed, 19 Jul 2006 05:22:28 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:user-agent:x-accept-language:mime-version:to:subject:content-type; b=sGPMnSfk0zmTbyrmi05KirdJBsmq6yEjQF+UR3RlBh6BgK11ixbHTUx92smkS4pvRqs5S+BhvoMiJF/NMSsI8Xc78BKHZr//YMn5uWv7byVI9uPEXhr2wSjRq+wvnxp9b0YEof8/zV2okVGbMCkDtTUZvzZZm2e1r6qTKQAhDnM= Received: by 10.48.1.4 with SMTP id 4mr1601784nfa; Wed, 19 Jul 2006 05:22:28 -0700 (PDT) Received: from ?10.10.197.20? ( [193.206.186.101]) by mx.gmail.com with ESMTP id o9sm1378459nfa.2006.07.19.05.22.27; Wed, 19 Jul 2006 05:22:28 -0700 (PDT) Message-ID: <44BE2403.7030205@gmail.com> Date: Wed, 19 Jul 2006 14:22:27 +0200 From: Pasquale Imbemba User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.12) Gecko/20050915 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Lucene Java User Subject: Lock obtain time out Content-Type: multipart/mixed; boundary="------------050301040208030405020406" X-Virus-Checked: Checked by ClamAV on apache.org X-Spam-Rating: minotaur.apache.org 1.6.2 0/1000/N --------------050301040208030405020406 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Hi, I am checking a txt file with entries against an index generated with Lucene. Of the enclosed Searcher.java class, I use the isInLex(String noun) method, i.e. I read every line of the txt file and compare using isInLex(String noun) against the index. If it's contained it returns true otherwise it returns false. The entire comparison is started from the enclosed Merger.java class. I read here (http://issues.apache.org/jira/browse/LUCENE-307?page=comments#action_12417477) and after that I tried to close the reader (is.close() in the Searcher.java class), but the problem persists. I would be grateful for some tip as this is my first approach to Lucene... tia Pasquale --------------050301040208030405020406 Content-Type: text/java; name="Searcher.java" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="Searcher.java" package lexicon; import org.apache.lucene.store.FSDirectory; import org.apache.lucene.store.Directory; import org.apache.lucene.search.IndexSearcher; import org.apache.lucene.queryParser.QueryParser; import org.apache.lucene.search.Hits; import org.apache.lucene.analysis.standard.StandardAnalyzer; import org.apache.lucene.search.Query; public class Searcher { private final String INDEXDIR = "C:/luceneindex"; public boolean isInLex(String noun){ boolean found = false; try { Directory fsDir = FSDirectory.getDirectory(INDEXDIR, false); IndexSearcher is = new IndexSearcher(fsDir); QueryParser parser = new QueryParser("contents", new StandardAnalyzer()); Query query = parser.parse(noun); Hits hits = is.search(query); if (hits.length() >=1){ found = true; } } catch (Exception e){ System.err.println(e.getMessage()); } return found; } } --------------050301040208030405020406 Content-Type: text/java; name="Merger.java" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="Merger.java" package lexicon; import java.io.*; import java.util.Vector; import lexicon.Searcher; import file.LineCounter; public class Merger { private Searcher s; private Vector v; private String to; public void merge (String from, String to){ this.to = to; String element; s = new Searcher(); v = new Vector(); try{ InputStreamReader isr = new InputStreamReader(new FileInputStream(from)); BufferedReader bf = new BufferedReader(isr); element = bf.readLine(); while (element != null){ if (!s.isInLex(element)){ v.add(element); } element = bf.readLine(); } } catch (Exception e){ System.err.print("Error: "+ e.getMessage()); System.exit(-1); } System.out.println(LineCounter.getNumberOfRows("C:/lexpool/NounsSenzaFreq.txt") + " lines in the Baroni file."); System.out.println(v.size() + " entries to be added."); //fillLexicon(v); } private void fillLexicon(Vector v){ //TODO: write a procedure that takes the vector and stores its content to disk } } --------------050301040208030405020406 Content-Type: text/plain; charset=us-ascii --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org For additional commands, e-mail: java-user-help@lucene.apache.org --------------050301040208030405020406--