Return-Path: Delivered-To: apmail-lucene-java-user-archive@www.apache.org Received: (qmail 71206 invoked from network); 17 Mar 2011 08:26:28 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 17 Mar 2011 08:26:28 -0000 Received: (qmail 25094 invoked by uid 500); 17 Mar 2011 08:26:26 -0000 Delivered-To: apmail-lucene-java-user-archive@lucene.apache.org Received: (qmail 25033 invoked by uid 500); 17 Mar 2011 08:26:25 -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 25025 invoked by uid 99); 17 Mar 2011 08:26:25 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 17 Mar 2011 08:26:25 +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: domain of pierre.gosse@arisem.com designates 195.68.26.146 as permitted sender) Received: from [195.68.26.146] (HELO mail.arisem.com) (195.68.26.146) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 17 Mar 2011 08:26:17 +0000 Received: from enodios.ARISEM.COM (192.168.1.105) by enodios.arisem.com (192.168.1.254) with Microsoft SMTP Server (TLS) id 14.1.289.1; Thu, 17 Mar 2011 09:25:37 +0100 Received: from enodios.ARISEM.COM ([192.168.1.105]) by enodios.ARISEM.COM ([192.168.1.105]) with mapi; Thu, 17 Mar 2011 09:25:38 +0100 From: Pierre GOSSE To: "java-user@lucene.apache.org" Date: Thu, 17 Mar 2011 09:25:36 +0100 Subject: RE: About highlighter Thread-Topic: About highlighter Thread-Index: AcvkIUtERRJ/PaNAQt+RIW/ctlA1wgAWtVZA Message-ID: <4A1AC1E08A1A4A438C4E4502E73AFC744A0A5350F9@enodios.ARISEM.COM> References: In-Reply-To: Accept-Language: fr-FR, en-US Content-Language: fr-FR X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: fr-FR, en-US Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Virus-Checked: Checked by ClamAV on apache.org 500 is the max size of text fragments to be returned by highlight. It shoul= dn't be the problem here, as far as I understand highlight. Gong li, how is defined the field "contents" ? Is it the only field on whic= h the search is made ? Pierre -----Message d'origine----- De=A0: Ian Lea [mailto:ian.lea@gmail.com]=20 Envoy=E9=A0: mercredi 16 mars 2011 22:29 =C0=A0: java-user@lucene.apache.org Objet=A0: Re: About highlighter I know nothing about highlighting but that 500 looks like a good place to start investigating. -- Ian. On Tue, Mar 15, 2011 at 8:47 PM, Cescy wrote: > Hi, > > > My highlight code is shown as following: > > > =A0QueryScorer scorer =3D new QueryScorer(query); > =A0Highlighter highlighter =3D new Highlighter(simpleHTMLFormatter, score= r); > =A0highlighter.setTextFragmenter(new SimpleSpanFragmenter(scorer, 500)); > =A0String contents =3D doc.get("contents"); > =A0TokenStream tokenStream =3D TokenSources.getAnyTokenStream(searcher.ge= tIndexReader(), topDocs.scoreDocs[i].doc, "contents", doc, analyzer); > =A0String[] snippet =3D highlighter.getBestFragments(tokenStream, content= s, 10); > > > > snippet is the result contexts and then I will print out them on the scre= en. > But If I may search for a keyword at the last few paragraph and the essay= is too long (1000-2000 words), it will return "document found" and snippet= .length=3D0 (i.e. document is found but context is NOT found). Why??? > > > How could I fix the problem? --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org For additional commands, e-mail: java-user-help@lucene.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org For additional commands, e-mail: java-user-help@lucene.apache.org