Return-Path: Delivered-To: apmail-lucene-java-user-archive@www.apache.org Received: (qmail 21786 invoked from network); 28 May 2009 06:12:45 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 28 May 2009 06:12:45 -0000 Received: (qmail 34755 invoked by uid 500); 28 May 2009 06:12:55 -0000 Delivered-To: apmail-lucene-java-user-archive@lucene.apache.org Received: (qmail 34687 invoked by uid 500); 28 May 2009 06:12:55 -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 34677 invoked by uid 99); 28 May 2009 06:12:55 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 28 May 2009 06:12:55 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of ritu.itzme@gmail.com designates 209.85.222.180 as permitted sender) Received: from [209.85.222.180] (HELO mail-pz0-f180.google.com) (209.85.222.180) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 28 May 2009 06:12:46 +0000 Received: by pzk10 with SMTP id 10so3504804pzk.29 for ; Wed, 27 May 2009 23:12:25 -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 :content-transfer-encoding; bh=tBrfj8MB5zPqCEQRrdhmEfG/DtpMbLDHWwdVzXEUa3w=; b=wpznRX2TAbNaXP/2HT4KRClVNPKTzCaOKaXNDPvYaS+K9lR+f33h9FLjnx0Q3Oy07v kaaldMVL+YuVD6IT+EMoKxAgXlhHsevBkojXxIkGE+XdldA0OwNvx5j/ZY2mmS7yhI7N J+m8euRpCgcCe7GMHNahRitNJci9Lix2p2j5c= 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:content-transfer-encoding; b=CskWb4a9QeKraKZt1gZSwKyOnUBJ5t52sCQyyE5icQd4J7G+kfmZD1y6gQnhew1Etf kicOaJ8qkEQ4t7AMjqv6BQYZOnOUyL0k7J6OGHrvg3VbiRC0ZNW5IejKk1bPqfGyFyH6 B66iYSug6o0dk61Uko1TjGa51qKIU9952jzXw= MIME-Version: 1.0 Received: by 10.142.105.10 with SMTP id d10mr262546wfc.253.1243491145152; Wed, 27 May 2009 23:12:25 -0700 (PDT) In-Reply-To: <8db6d74a0905272211p5da8ac63q5a36328ddbb15f8c@mail.gmail.com> References: <11011.82.210.249.81.1243412208.squirrel@webmail.xs4all.nl> <8db6d74a0905270121u1cf2b0f0sf19c8ac459fc3b6d@mail.gmail.com> <94ea00c20905270219l7185744fgb4f0a968dc5083ff@mail.gmail.com> <94ea00c20905271010s3fec19c9i286ac581d5762256@mail.gmail.com> <8db6d74a0905272211p5da8ac63q5a36328ddbb15f8c@mail.gmail.com> Date: Thu, 28 May 2009 11:42:25 +0530 Message-ID: <94ea00c20905272312p4e75d05dn32fa07d4ab8c93e2@mail.gmail.com> Subject: Re: highlighting searched results in document From: Ritu choudhary To: java-user@lucene.apache.org Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org I have added the lines you suggested and now its giving the following output , still can't get what's wrong... THE CHANGES I HAVE DONE: SimpleHTMLFormatter formatter = new SimpleHTMLFormatter("", ""); Highlighter highlighter = new Highlighter(formatter, new QueryScorer(query)); int maxNumFragmentsRequired=200; String FragmentSeparator="..."; Fragmenter fragmenter = new SimpleFragmenter(50); highlighter.setTextFragmenter(fragmenter); TokenStream tokenStream=analyzer.tokenStream(FIELD_NAME,new StringReader(text)); String result=highlighter.getBestFragments(tokenStream,text,maxNumFragmentsRequired,FragmentSeparator); System.out.println( "This is the result "+result); OUTPUT: Content field found--->>accept This is the result accept On 28/05/2009, KK wrote: > Yes, your code is wrong! > Where is the highlighter span/formatter, because from your code what I can > see is that you are just passsing the score to Queryscorer, instead you > should pass both queryscore as well as formatter > From my previous mail you can see the following code and mimic the same and > it will work without any hitch, > > QueryScorer scorer = new QueryScorer(phrase); > > SimpleHTMLFormatter formatter = > new SimpleHTMLFormatter("", > ""); > Highlighter highlighter = new Highlighter(formatter, scorer); > > and this is your code, > > Highlighter highlighter = new Highlighter(new QueryScorer(query)); > > You missed the formatter altogether but you added thestyler at the end, > though. Add it and it will work like a charm. > > --KK > > > > > > On Wed, May 27, 2009 at 10:40 PM, Ritu choudhary > wrote: > >> Am i coding it wrongly ...please reply. >> > --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org For additional commands, e-mail: java-user-help@lucene.apache.org