Mailing List Archive

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;
}
Re: Add ability to get list of terms from a query [ In reply to ]
Hi All,
I didn't get any feedback + or - on making these changes.
I'll make the changes if people think it's a good idea.
The changes essentially provide public methods to get the query or the term
from the query.

Thanks

--Peter

On 2/7/02 12:41 PM, "carlson@bookandhammer.com" <carlson@bookandhammer.com>
wrote:

> 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>
RE: Add ability to get list of terms from a query [ In reply to ]
+1

> -----Original Message-----
> From: Peter Carlson [mailto:carlson@bookandhammer.com]
> Sent: Friday, February 15, 2002 11:18 AM
> To: Lucene Developers List
> Subject: Re: Add ability to get list of terms from a query
>
>
> Hi All,
> I didn't get any feedback + or - on making these changes.
> I'll make the changes if people think it's a good idea.
> The changes essentially provide public methods to get the
> query or the term
> from the query.
>
> Thanks
>
> --Peter
>
> On 2/7/02 12:41 PM, "carlson@bookandhammer.com"
> <carlson@bookandhammer.com>
> wrote:
>
> > 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>

--
To unsubscribe, e-mail: <mailto:lucene-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:lucene-dev-help@jakarta.apache.org>
Re: Add ability to get list of terms from a query [ In reply to ]
Peter,

Looks fine, these are only new methods and some accessor modifier
changes, so it shouldn't break any existing code.
I'm reading the PDF (nicely done!) now, but this looks good and
harmless, so +1.
Yummy.

Otis



--- Peter Carlson <carlson@bookandhammer.com> wrote:
> Hi All,
> I didn't get any feedback + or - on making these changes.
> I'll make the changes if people think it's a good idea.
> The changes essentially provide public methods to get the query or
> the term
> from the query.
>
> Thanks
>
> --Peter
>
> On 2/7/02 12:41 PM, "carlson@bookandhammer.com"
> <carlson@bookandhammer.com>
> wrote:
>
> > 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;
> > }



__________________________________________________
Do You Yahoo!?
Got something to say? Say it better with Yahoo! Video Mail
http://mail.yahoo.com

--
To unsubscribe, e-mail: <mailto:lucene-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:lucene-dev-help@jakarta.apache.org>
Re: Add ability to get list of terms from a query [ In reply to ]
Hm, it looks like the code is published under LGPL (see the end of the
PDF).
Wouldn't it have to be published under ASF License before it could be
included in Lucene distribution?

Otis


--- carlson@bookandhammer.com wrote:
> 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;
> }
>


__________________________________________________
Do You Yahoo!?
Got something to say? Say it better with Yahoo! Video Mail
http://mail.yahoo.com

--
To unsubscribe, e-mail: <mailto:lucene-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:lucene-dev-help@jakarta.apache.org>
Re: Add ability to get list of terms from a query [ In reply to ]
Sorry for spamming the list.
Assuming we jump over the LGPL hurdle....

Either my brain (brian?) is fried or the code at
http://www.iq-computing.de/lucene/lucene-highlight.tar.gz doesn't
really contain an implementation of TermHighlighter interface. Is that
a mistake or has that purposely been left out? My impression was that
the code includes Maik's implementation of that.

Also, I'd make a minor change to this:
public static final String highlightTerms(String text,
TermHighlighter highlighter, Query query,
Analyzer analyzer) throws IOException
{
StringBuffer newText = new StringBuffer();

I would do something like:
StringBuffer newText = new StringBuffer(text.length); // check for
text == null before?

There is also a finally block in that method that catches Exception,
but then ignores it. Perhaps that should be modified so that it
doesn't just ignore the Exception, but rather deals with it as the rest
of Lucene code deals with Exceptions...

Otis (Ich liebe Freitagen) Gospodnetic



--- carlson@bookandhammer.com wrote:
> 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;
> }
>


__________________________________________________
Do You Yahoo!?
Got something to say? Say it better with Yahoo! Video Mail
http://mail.yahoo.com

--
To unsubscribe, e-mail: <mailto:lucene-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:lucene-dev-help@jakarta.apache.org>
Re: Add ability to get list of terms from a query: field names too? [ In reply to ]
Dear developers,

A few weeks ago I asked for the ability to find the field names
used in a query. Since a Term consists of a field and its contents
I assume I can get the field names from these terms.
Is that correct?

Regards,
Ype

--

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