Return-Path: X-Original-To: apmail-lucene-java-user-archive@www.apache.org Delivered-To: apmail-lucene-java-user-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id A68E5CA3A for ; Mon, 29 Jul 2013 11:07:22 +0000 (UTC) Received: (qmail 54978 invoked by uid 500); 29 Jul 2013 11:07:20 -0000 Delivered-To: apmail-lucene-java-user-archive@lucene.apache.org Received: (qmail 54931 invoked by uid 500); 29 Jul 2013 11:07:20 -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 54923 invoked by uid 99); 29 Jul 2013 11:07:19 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 29 Jul 2013 11:07:19 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: local policy) Received: from [116.50.78.85] (HELO mta3.rancoretech.com) (116.50.78.85) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 29 Jul 2013 11:07:13 +0000 X-IronPort-AV: E=Sophos;i="4.89,768,1367951400"; d="scan'208";a="51205903" Received: from unknown (HELO outpostfix02.ril.com) ([10.66.8.169]) by gwsmtp011.ril.com with ESMTP; 29 Jul 2013 16:36:33 +0530 Received: from rdmail.rancoretech.com (unknown [10.22.140.196]) by outpostfix02.ril.com (Postfix) with SMTP id 26E3EA15837 for ; Mon, 29 Jul 2013 16:36:35 +0530 (IST) Received: from localhost (localhost.localdomain [127.0.0.1]) by rdmail.rancoretech.com (Postfix) with ESMTP id 096B14A88BD8 for ; Mon, 29 Jul 2013 16:36:35 +0530 (IST) X-Virus-Scanned: amavisd-new at rancoretech.com Received: from rdmail.rancoretech.com ([127.0.0.1]) by localhost (rdmail.rancoretech.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 5drJKUxvDcJD for ; Mon, 29 Jul 2013 16:36:34 +0530 (IST) Received: from [10.49.16.89] (unknown [10.49.16.89]) by rdmail.rancoretech.com (Postfix) with ESMTPSA id E79234A889B6 for ; Mon, 29 Jul 2013 16:36:34 +0530 (IST) Message-ID: <51F64CBB.4060000@rancoretech.com> Date: Mon, 29 Jul 2013 16:36:35 +0530 From: Ankit Murarka User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.5) Gecko/20091204 Thunderbird/3.0 MIME-Version: 1.0 To: java-user@lucene.apache.org Subject: Did you Mean search on Indexes created by Different Files. Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org Since I am new to this, I can't stop exploring it and trying to use different features. I am now trying to implement "Did you Mean " search using SpellChecker jar and Lucene jar. The problem I faced are plenty although I have got it working.. code snippet: File dir = new File("D:\\Inde\\"); Directory directory = FSDirectory.open(dir); SpellChecker spellChecker = new SpellChecker(directory); String wordForSuggestions = "aski"; Analyzer analyzer=new CustomAnalyzerForCaseSensitive(Version.LUCENE_43); //This analyzer only has commented LowerCaseFilter. IndexWriterConfig iwc = new IndexWriterConfig(Version.LUCENE_43, analyzer); IndexWriter writer = new IndexWriter(directory, iwc); File file1=new File("D:\\Inde\\wordlist.txt"); indexDocs(writer,file1); writer.close(); spellChecker.indexDictionary( new PlainTextDictionary(new File("D:\\Inde\\wordlist.txt")), iwc, false); int suggestionsNumber = 10; String[] suggestions = spellChecker. suggestSimilar(wordForSuggestions, suggestionsNumber); if (suggestions!=null && suggestions.length>0) { for (String word : suggestions) { System.out.println("Did you mean:" + word + ""); } } else { System.out.println("No suggestions found for word:"+wordForSuggestions); } The code works fine. It suggest me 10 possible matches. Problem is here I am creating/updating indexes everytime. Say suppose I have 1000 log files and these files are indexed in D:\\LogIndexes. Instead of reading a standard dictionary and building up indexes, I wish to use these indexes to suggest me possible match.. Is it possible to do?. If yes, what can be the approach. Please provide some assistance. Next question would be to suggest a phrase. If I enter "Head ach heav" , then I should get "Head ache heavy" as one possible suggestion. haven't tried it yet but surely will be an absolute beauty to have it.. Also examples available on net for "Did you mean" are very very old and API have undergone significant changes thus making them not so very useful. -- Regards Ankit Murarka "Peace is found not in what surrounds us, but in what we hold within." --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org For additional commands, e-mail: java-user-help@lucene.apache.org