You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Anny Bridge <an...@gmail.com> on 2007/05/28 04:30:38 UTC

times of match in a document

Hi,

I use lucene in my project and it works well.

Now I hope that the search result presenting to the user include the times
of the keyword match in a document.

Is there someone do this before,Or is there any code example for this...

Thanks in Advance.
Anny

Re: times of match in a document

Posted by Daniel Noll <da...@nuix.com>.
On Monday 28 May 2007 12:30:38 Anny Bridge wrote:
> Hi,
>
> I use lucene in my project and it works well.
>
> Now I hope that the search result presenting to the user include the times
> of the keyword match in a document.
>
> Is there someone do this before,Or is there any code example for this...

See IndexReader#termDocs(), termDocs#seek(Term), termDocs#skipTo(int) and 
termDocs#freq().

If you need to do it for multiple documents and terms, you probably want to do 
it in order to reduce redundant creation of multiple TermDocs objects.

Daniel

-- 
Daniel Noll
Nuix Pty Ltd
Suite 79, 89 Jones St, Ultimo NSW 2007, Australia    Ph: +61 2 9280 0699
Web: http://nuix.com/                               Fax: +61 2 9212 6902

---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Re: times of match in a document

Posted by James liu <li...@gmail.com>.
sorry,,i not see it clearly

> match in a document.
>

2007/5/28, James liu <li...@gmail.com>:
>
> maybe solr facet fit for u
> .http://wiki.apache.org/solr/SolrFacetingOverview
>
> 2007/5/28, Anny Bridge <an...@gmail.com>:
> >
> > Hi,
> >
> > I use lucene in my project and it works well.
> >
> > Now I hope that the search result presenting to the user include the
> > times
> > of the keyword match in a document.
> >
> > Is there someone do this before,Or is there any code example for this...
> >
> >
> > Thanks in Advance.
> > Anny
> >
>
>
>
> --
> regards
> jl




-- 
regards
jl

Re: times of match in a document

Posted by James liu <li...@gmail.com>.
maybe solr facet fit for u.http://wiki.apache.org/solr/SolrFacetingOverview

2007/5/28, Anny Bridge <an...@gmail.com>:
>
> Hi,
>
> I use lucene in my project and it works well.
>
> Now I hope that the search result presenting to the user include the times
> of the keyword match in a document.
>
> Is there someone do this before,Or is there any code example for this...
>
> Thanks in Advance.
> Anny
>



-- 
regards
jl