Mailing List Archive

Re: Add ability to get list of terms from a query ++
Hi all,

I also implemented an Highlight functionality based on Maik Schreiber's code
and
modified the Lucene source. I agree with Peter that it will be great to have
this changes done
in the Lucene core code.

The only difference in my functionality is that query.getTerms() returns
both TermQuery and PhraseQuery object, so that the Highlighter does not
split compound words.

I was also wondering : is there a reason why Query object do not have a
clone() method?
Do you think it could be useful?

Julien


----- Original Message -----
From: <carlson@bookandhammer.com>
To: "Lucene Developers List" <lucene-dev@jakarta.apache.org>
Sent: Thursday, February 07, 2002 9:41 PM
Subject: Add ability to get list of terms from a query


> Hi,
>
> I just added the Highlight terms functionality by Maik Schreiber to the
> contributions section.
> This code essentially gets all the terms for a given query, and then
> provides an interface to highlight the text.
>
> In order to provide this functionality he had to make some changes to
> the core Lucene code.
>
> I am suggesting providing the a query.getTerms() method. After review
> and Maik approval, we might even want to use his code.
>
> I would suggest making these changes after 1.2 is released.
>
> To check out his code and PDF describing the changes, go to
> http://www.iq-computing.de/lucene/highlight.htm
>
> Please provide feedback.
>
> Thanks
>
> --Peter
>
> ----LIST OF SUGGESTED CHANGES----
> He documented it very well. Here are the list of changes.
>
> org.apache.lucene.search.BooleanQuery - add the following method:
> public BooleanClause[] getClauses()
> {
> return (BooleanClause[]) clauses.toArray(new BooleanClause[0]);
> }
>
> org.apache.lucene.search.MultiTermQuery - mark getQuery() public
>
> org.apache.lucene.search.PhraseQuery - add the following method:
> public Term[] getTerms()
> {
> return (Term[]) terms.toArray(new Term[0]);
> }
>
> org.apache.lucene.search.PrefixQuery - mark getQuery() public
>
> org.apache.lucene.search.RangeQuery - mark getQuery() public
>
> org.apache.lucene.search.TermQuery - add the following method:
> public Term getTerm()
> {
> return term;
> }
>


--
To unsubscribe, e-mail: <mailto:lucene-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:lucene-dev-help@jakarta.apache.org>