|
View:
New views
5 Messages
—
Rating Filter:
Alert me
|
|
|
getField on MultiTermQueryNow that getTerm is gone from MultiTermQuery, I'd like to add some way
to get the field. The Highlighter has to now do more nasty specialization than it already did to get the field off every type of MultiFieldQuery. So some contrib queries that worked now don't, and are going to require a dependency and instanceof handling to work again. Annoying, because its just to get the field. So I'd like to add getField or field. Unfortunately, it would have to throw UnsupportedException or return null or something for back compat, unless someone has a bright idea about how to solve this in another way (in the near term). -- - Mark http://www.lucidimagination.com --------------------------------------------------------------------- To unsubscribe, e-mail: java-dev-unsubscribe@... For additional commands, e-mail: java-dev-help@... |
|
|
Re: getField on MultiTermQueryI would try to subclass Multitermquery and call the getEnum in some
kind of a Extractor class like : public class TermExtractor extends MultiTermQuery{ private MultiTermQuery q; public TermExtractor(MultiTermQuery q){ this.q = q; } public String getField(IndexReader reader) throws IOException{ FilteredTermEnum enum1 = this.q.getEnum(reader); return enum1.currentTerm.field(); } that would give you a generic way to extract the terms field... would that help the highlighter though? simon On Fri, Nov 6, 2009 at 7:37 PM, Mark Miller <markrmiller@...> wrote: > Now that getTerm is gone from MultiTermQuery, I'd like to add some way > to get the field. The Highlighter has to now do more nasty > specialization than it already did to get the field off every type of > MultiFieldQuery. So some contrib queries that worked now don't, and are > going to require a dependency and instanceof handling to work again. > Annoying, because its just to get the field. So I'd like to add getField > or field. Unfortunately, it would have to throw UnsupportedException or > return null or something for back compat, unless someone has a bright > idea about how to solve this in another way (in the near term). > > -- > - Mark > > http://www.lucidimagination.com > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: java-dev-unsubscribe@... > For additional commands, e-mail: java-dev-help@... > > --------------------------------------------------------------------- To unsubscribe, e-mail: java-dev-unsubscribe@... For additional commands, e-mail: java-dev-help@... |
|
|
RE: getField on MultiTermQueryWe should add a getField() to the Query class itsself so we have support to
get the field in all queries. For MTQ the default impl could be the one Simon proposed. Uwe ----- Uwe Schindler H.-H.-Meier-Allee 63, D-28213 Bremen http://www.thetaphi.de eMail: uwe@... > -----Original Message----- > From: Simon Willnauer [mailto:simon.willnauer@...] > Sent: Friday, November 06, 2009 10:50 AM > To: java-dev@... > Subject: Re: getField on MultiTermQuery > > I would try to subclass Multitermquery and call the getEnum in some > kind of a Extractor class like : > > public class TermExtractor extends MultiTermQuery{ > > private MultiTermQuery q; > > public TermExtractor(MultiTermQuery q){ > this.q = q; > } > public String getField(IndexReader reader) throws IOException{ > FilteredTermEnum enum1 = this.q.getEnum(reader); > return enum1.currentTerm.field(); > } > > that would give you a generic way to extract the terms field... > > would that help the highlighter though? > > simon > > On Fri, Nov 6, 2009 at 7:37 PM, Mark Miller <markrmiller@...> wrote: > > Now that getTerm is gone from MultiTermQuery, I'd like to add some way > > to get the field. The Highlighter has to now do more nasty > > specialization than it already did to get the field off every type of > > MultiFieldQuery. So some contrib queries that worked now don't, and are > > going to require a dependency and instanceof handling to work again. > > Annoying, because its just to get the field. So I'd like to add getField > > or field. Unfortunately, it would have to throw UnsupportedException or > > return null or something for back compat, unless someone has a bright > > idea about how to solve this in another way (in the near term). > > > > -- > > - Mark > > > > http://www.lucidimagination.com > > > > > > > > > > --------------------------------------------------------------------- > > To unsubscribe, e-mail: java-dev-unsubscribe@... > > For additional commands, e-mail: java-dev-help@... > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: java-dev-unsubscribe@... > For additional commands, e-mail: java-dev-help@... --------------------------------------------------------------------- To unsubscribe, e-mail: java-dev-unsubscribe@... For additional commands, e-mail: java-dev-help@... |
|
|
Re: getField on MultiTermQueryOn Fri, Nov 6, 2009 at 1:52 PM, Uwe Schindler <uwe@...> wrote:
> We should add a getField() to the Query class itsself so we have support to > get the field in all queries. Urg... now you owe me another beer. -Yonik http://www.lucidimagination.com --------------------------------------------------------------------- To unsubscribe, e-mail: java-dev-unsubscribe@... For additional commands, e-mail: java-dev-help@... |
|
|
RE: getField on MultiTermQuery> On Fri, Nov 6, 2009 at 1:52 PM, Uwe Schindler <uwe@...> wrote:
> > We should add a getField() to the Query class itsself so we have support > to > > get the field in all queries. > > Urg... now you owe me another beer. Yes, that was a bad idea, you'll get a beer this evening :-) But a solution not only for MTQ would be (it would remove a lot of instanceof checks in Highlighter to get the terms): We define an interface (do not hurt me, but interfaces that have a clear meaning and never tend to be extended are just fine, like the AttributeSource stuff), that has a getField() method. All queries that support retrieving a field name can implement this interface: public interface FieldedQuery { String getField(); } If you have a better name, tell me, but not "SmartFancyHighlighterInterface". I think Mark Miller was quite happy about that idea. Now you just have one instanceof check there and then cast to that interface to get the field name. Uwe --------------------------------------------------------------------- To unsubscribe, e-mail: java-dev-unsubscribe@... For additional commands, e-mail: java-dev-help@... |
| Free embeddable forum powered by Nabble | Forum Help |