Return-Path: Delivered-To: apmail-lucene-java-user-archive@www.apache.org Received: (qmail 79666 invoked from network); 1 Jun 2009 15:57:05 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 1 Jun 2009 15:57:05 -0000 Received: (qmail 91105 invoked by uid 500); 1 Jun 2009 15:56:51 -0000 Delivered-To: apmail-lucene-java-user-archive@lucene.apache.org Received: (qmail 90461 invoked by uid 500); 1 Jun 2009 15:56:49 -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 89068 invoked by uid 99); 1 Jun 2009 15:50:44 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 01 Jun 2009 15:50:44 +0000 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of marco.lazzara@gmail.com designates 74.125.78.27 as permitted sender) Received: from [74.125.78.27] (HELO ey-out-2122.google.com) (74.125.78.27) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 01 Jun 2009 15:50:35 +0000 Received: by ey-out-2122.google.com with SMTP id 22so1631072eye.53 for ; Mon, 01 Jun 2009 08:50:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type; bh=N+y8XHOhB9MSo4NSDmdjjn6Zl/EBEj8ojs1wAtPzC5k=; b=Hq5roZGgQbSfFsQNpurKVFRjB/+Sn6mD/kQgt9wBWKnfM3bxzNwZT3Pn0erKbV8Ikr wO2gpXiJLAAuqfy++XEE2VQwZJ6NCtQFHAmFoi6iUT1huC7R+THMqqqRZqB3JfuL5o4j ZQlTBQxeYGSDdTbpCHcq1EgjsnGFoD8z1qvgE= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=UujxxjUI+peKr45Y2AT6MgopU3ZE6yxmLKLJF+IScCG9o2w1weMu5WdLVxAIDV/k2F GPZWV1VKbZentC2wrA5vN3vg+jC7Tjed4ixVc9EkQGcv1rWmSu/kB+d1x/A3Kx+9fI3N IowxabIQAv8Kn4MX/ho2s8wwULKstze5SVMDA= MIME-Version: 1.0 Received: by 10.216.45.71 with SMTP id o49mr1891628web.57.1243871413304; Mon, 01 Jun 2009 08:50:13 -0700 (PDT) In-Reply-To: <45452.61381.qm@web1109.biz.mail.sk1.yahoo.com> References: <1242666786.22206.13.camel@marco-desktop> <25652c480905271014u67cc4b4bvbcac79115ccac079@mail.gmail.com> <25652c480905271040u4af261f0sacd22d58d4ddac90@mail.gmail.com> <9E65CCC5-E055-4129-9EF1-06B4938023AD@cognocys.com> <25652c480905271114r5a3d3e09ld543b04e1fff9db0@mail.gmail.com> <9EBE2EB2-1021-4492-964E-EB59D3E941BB@cognocys.com> <25652c480905271241l7abcfc59h39a011016e30bdf0@mail.gmail.com> <45452.61381.qm@web1109.biz.mail.sk1.yahoo.com> Date: Mon, 1 Jun 2009 17:50:13 +0200 Message-ID: <25652c480906010850p2b925c38h6f91a304fbf17a72@mail.gmail.com> Subject: Re: Searching index problems with tomcat From: Marco Lazzara To: java-user@lucene.apache.org Content-Type: multipart/alternative; boundary=0016367d69d8bc7e3e046b4b61b1 X-Virus-Checked: Checked by ClamAV on apache.org --0016367d69d8bc7e3e046b4b61b1 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit In order to let you know about my problem I decided to use swt for the standalone app and to use Google Web Toolkit for web app!!!! :):) bye ML 2009/5/27 N Hira > > Cool! > > 1. So you are creating a parser with { name, synonyms, propIn }, correct? > > 2. Sorry -- I meant the output of "query.toString()"; I'm expecting to see > something like this when the sentence parameter is set to philipcimiano: > name:philipcimiano synonyms:philipcimiano propIn:philipcimiano > > 3. Out of curiosity, what is the value of topDocs.totalHits for your > search? > > -h > > > > ----- Original Message ---- > From: Marco Lazzara > To: java-user@lucene.apache.org > Sent: Wednesday, May 27, 2009 2:41:44 PM > Subject: Re: Searching index problems with tomcat > > I've made a bad copy-paste. this is the full class > > The output of philipcimiano is ex#pub1-author-ex#res2-name-philipcimiano > I've made a bad copy-paste. this is the full class > > public class RDFinder { > > private Analyzer analyzer; > private Directory directory; > private IndexSearcher isearcher; > private MultiFieldQueryParser parser; > private Query query; > private TreeMap> resultingpaths; > private PrintWriter outFile; > > public RDFinder(String indexpath, String[] indexField) throws > CorruptIndexException, IOException{ > > //Creazione dell'oggetto per la ricerca indicando la struttura > (directory) su cui lavorare e l'analyzer > analyzer = new StandardAnalyzer(); > directory = FSDirectory.getDirectory(indexpath); > isearcher = new IndexSearcher(directory); > parser = new MultiFieldQueryParser(indexField, analyzer); > resultingpaths = new TreeMap>(); > outFile = null; > > } > > public TreeMap> Search(String sentence, String > Field) throws ParseException, IOException{ > query = parser.parse(sentence); > > try > { > > FileWriter fw = new FileWriter ("paths"); > BufferedWriter bw = new BufferedWriter (fw); > outFile = new PrintWriter (bw); > > } > catch (FileNotFoundException exception){} > catch (IOException exception){} > > //ArrayList results = new ArrayList(); > > //Effettua la ricerca ottenendo l'oggetto TopDocs > TopDocs topDocs = isearcher.search(query,1000); > //Stampa del conteggio numero di hits. > //System.out.println("Numero di hits " + topDocs.totalHits); > > //Array dei risultati > ScoreDoc[] scoreDocs = topDocs.scoreDocs; > for (ScoreDoc sc : scoreDocs) > { > //System.out.print(i++ + ": - "); > //Attraverso l'oggetto scoreDoc e' possibile ottenere un indice che > passato all metodo > //indexSearcher.doc restituisce un Document dal quale estrarre i > vari campi > > Field[] response = isearcher.doc(sc.doc).getFields(Field); > //System.out.println("Risultato "); > > for (int k = 0; k String res = response[k].stringValue(); > if (!res.trim().equals("")) > { > > outFile.println(res); > outFile.flush(); > res = res.toLowerCase(); > int lung = CountChar(res, '-')+1; > > //if (resultingpaths.containsKey(res.length())) > if (resultingpaths.containsKey(lung)) > //resultingpaths.get(res.length()).add(res); > resultingpaths.get(lung).add(res); > else { > ArrayList respaths = new ArrayList(); > respaths.add(res); > //resultingpaths.put(res.length(), respaths); > resultingpaths.put(lung, respaths); > } > //results.add(res); > > } > } > //codice che c'era prima > /*String res = isearcher.doc(sc.doc).get(Field); > System.out.println(res); > results.add(res);*/ > } > isearcher.close(); > return resultingpaths; > } > > public boolean Exists(String node) throws ParseException, IOException{ > > query = parser.parse(node); > > > > //Effettua la ricerca ottenendo l'oggetto TopDocs > TopDocs topDocs = isearcher.search(query,1); > > > //Array dei risultati > ScoreDoc[] scoreDocs = topDocs.scoreDocs; > > return (scoreDocs.length >= 1); > > } > > public String[] InputKeywords(String sentence){ > > QueryTermVector QTV = new QueryTermVector(sentence, analyzer); > return QTV.getTerms(); > > } > > public int CountChar(String s, char c){ > int count = 0; > for (int i = 0; i < s.length(); i++) > if (s.charAt(i) == c) count++; > return count; > } > > } > > [ message truncated by mailer@cognocys.com -- too many replies ] > > --------------------------------------------------------------------- > To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org > For additional commands, e-mail: java-user-help@lucene.apache.org > > --0016367d69d8bc7e3e046b4b61b1--