You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@lucene.apache.org by "Simon Willnauer (JIRA)" <ji...@apache.org> on 2009/11/13 21:50:39 UTC

[jira] Created: (LUCENE-2064) Highlighter should support all MultiFieldQuery subclasses without casts

Highlighter should support all MultiFieldQuery subclasses without casts
-----------------------------------------------------------------------

                 Key: LUCENE-2064
                 URL: https://issues.apache.org/jira/browse/LUCENE-2064
             Project: Lucene - Java
          Issue Type: Improvement
          Components: contrib/highlighter
    Affects Versions: 2.9.1
            Reporter: Simon Willnauer
            Assignee: Simon Willnauer
             Fix For: 3.1


In order to support MultiTermQuery subclasses the Highlighter component applies instanceof checks for concrete classes from the lucene core. This prevents classes like RegexQuery in contrib from being supported. Introducing dependencies on other contribs is not feasible just for being supported by the highlighter.

While the instanceof checks and subsequent casts might hopefully go somehow away  in the future but for supporting more multterm queries I have a alternative approach using a fake IndexReader that uses a RewriteMethod to force the MTQ to pass the field name to the given reader without doing any real work. It is easier to explain once you see the patch - I will upload shortly.


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (LUCENE-2064) Highlighter should support all MultiTermQuery subclasses without casts

Posted by "Mark Miller (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-2064?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12777762#action_12777762 ] 

Mark Miller commented on LUCENE-2064:
-------------------------------------

I still think getFields on multitermquery is a better option than a Fieldable interface. But if we would drop back to this method anyway, I see no reason to anything with field and multitermquery at all really - unless another use case prompts it.

> Highlighter should support all MultiTermQuery subclasses without casts
> ----------------------------------------------------------------------
>
>                 Key: LUCENE-2064
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2064
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: contrib/highlighter
>    Affects Versions: 2.9.1
>            Reporter: Simon Willnauer
>            Assignee: Simon Willnauer
>             Fix For: 3.0
>
>         Attachments: LUCENE-2064.txt
>
>
> In order to support MultiTermQuery subclasses the Highlighter component applies instanceof checks for concrete classes from the lucene core. This prevents classes like RegexQuery in contrib from being supported. Introducing dependencies on other contribs is not feasible just for being supported by the highlighter.
> While the instanceof checks and subsequent casts might hopefully go somehow away  in the future but for supporting more multterm queries I have a alternative approach using a fake IndexReader that uses a RewriteMethod to force the MTQ to pass the field name to the given reader without doing any real work. It is easier to explain once you see the patch - I will upload shortly.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (LUCENE-2064) Highlighter should support all MultiTermQuery subclasses without casts

Posted by "Uwe Schindler (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-2064?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12777897#action_12777897 ] 

Uwe Schindler commented on LUCENE-2064:
---------------------------------------

+1

> Highlighter should support all MultiTermQuery subclasses without casts
> ----------------------------------------------------------------------
>
>                 Key: LUCENE-2064
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2064
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: contrib/highlighter
>    Affects Versions: 2.9.1
>            Reporter: Simon Willnauer
>            Assignee: Simon Willnauer
>             Fix For: 3.0
>
>         Attachments: LUCENE-2064.patch, LUCENE-2064.patch, LUCENE-2064.txt
>
>
> In order to support MultiTermQuery subclasses the Highlighter component applies instanceof checks for concrete classes from the lucene core. This prevents classes like RegexQuery in contrib from being supported. Introducing dependencies on other contribs is not feasible just for being supported by the highlighter.
> While the instanceof checks and subsequent casts might hopefully go somehow away  in the future but for supporting more multterm queries I have a alternative approach using a fake IndexReader that uses a RewriteMethod to force the MTQ to pass the field name to the given reader without doing any real work. It is easier to explain once you see the patch - I will upload shortly.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Updated: (LUCENE-2064) Highlighter should support all MultiFieldQuery subclasses without casts

Posted by "Uwe Schindler (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENE-2064?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Uwe Schindler updated LUCENE-2064:
----------------------------------

    Fix Version/s:     (was: 3.1)
                   3.0

Sorry I was somehow like completely drunk.... I laughed so much about this patch! Only UnexpectedSuccessException is missing in it.

> Highlighter should support all MultiFieldQuery subclasses without casts
> -----------------------------------------------------------------------
>
>                 Key: LUCENE-2064
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2064
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: contrib/highlighter
>    Affects Versions: 2.9.1
>            Reporter: Simon Willnauer
>            Assignee: Simon Willnauer
>             Fix For: 3.0
>
>         Attachments: LUCENE-2064.txt
>
>
> In order to support MultiTermQuery subclasses the Highlighter component applies instanceof checks for concrete classes from the lucene core. This prevents classes like RegexQuery in contrib from being supported. Introducing dependencies on other contribs is not feasible just for being supported by the highlighter.
> While the instanceof checks and subsequent casts might hopefully go somehow away  in the future but for supporting more multterm queries I have a alternative approach using a fake IndexReader that uses a RewriteMethod to force the MTQ to pass the field name to the given reader without doing any real work. It is easier to explain once you see the patch - I will upload shortly.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (LUCENE-2064) Highlighter should support all MultiTermQuery subclasses without casts

Posted by "Uwe Schindler (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-2064?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12777756#action_12777756 ] 

Uwe Schindler commented on LUCENE-2064:
---------------------------------------

One comment to the patch:
If a MTQ subclass does something special during rewrite or in its FilteredTermEnum and calls any other method of FakeReader, it throws NPE. You should catch this Exception and in this case fall back to extract no terms.

> Highlighter should support all MultiTermQuery subclasses without casts
> ----------------------------------------------------------------------
>
>                 Key: LUCENE-2064
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2064
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: contrib/highlighter
>    Affects Versions: 2.9.1
>            Reporter: Simon Willnauer
>            Assignee: Simon Willnauer
>             Fix For: 3.0
>
>         Attachments: LUCENE-2064.txt
>
>
> In order to support MultiTermQuery subclasses the Highlighter component applies instanceof checks for concrete classes from the lucene core. This prevents classes like RegexQuery in contrib from being supported. Introducing dependencies on other contribs is not feasible just for being supported by the highlighter.
> While the instanceof checks and subsequent casts might hopefully go somehow away  in the future but for supporting more multterm queries I have a alternative approach using a fake IndexReader that uses a RewriteMethod to force the MTQ to pass the field name to the given reader without doing any real work. It is easier to explain once you see the patch - I will upload shortly.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (LUCENE-2064) Highlighter should support all MultiTermQuery subclasses without casts

Posted by "Simon Willnauer (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-2064?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12777764#action_12777764 ] 

Simon Willnauer commented on LUCENE-2064:
-----------------------------------------

bq. Or simply use the passed in reader as delegate of FakeReader, then it will behave correctly for all methods.

I agree with the exception, but which reader are you talking about. 

Btw. I was close to name it SmartFakeReader :D

> Highlighter should support all MultiTermQuery subclasses without casts
> ----------------------------------------------------------------------
>
>                 Key: LUCENE-2064
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2064
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: contrib/highlighter
>    Affects Versions: 2.9.1
>            Reporter: Simon Willnauer
>            Assignee: Simon Willnauer
>             Fix For: 3.0
>
>         Attachments: LUCENE-2064.txt
>
>
> In order to support MultiTermQuery subclasses the Highlighter component applies instanceof checks for concrete classes from the lucene core. This prevents classes like RegexQuery in contrib from being supported. Introducing dependencies on other contribs is not feasible just for being supported by the highlighter.
> While the instanceof checks and subsequent casts might hopefully go somehow away  in the future but for supporting more multterm queries I have a alternative approach using a fake IndexReader that uses a RewriteMethod to force the MTQ to pass the field name to the given reader without doing any real work. It is easier to explain once you see the patch - I will upload shortly.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Updated: (LUCENE-2064) Highlighter should support all MultiTermQuery subclasses without casts

Posted by "Uwe Schindler (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENE-2064?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Uwe Schindler updated LUCENE-2064:
----------------------------------

    Attachment: LUCENE-2064.patch

More simple, as MemoryIndex also provides the empty TermEnum.

> Highlighter should support all MultiTermQuery subclasses without casts
> ----------------------------------------------------------------------
>
>                 Key: LUCENE-2064
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2064
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: contrib/highlighter
>    Affects Versions: 2.9.1
>            Reporter: Simon Willnauer
>            Assignee: Simon Willnauer
>             Fix For: 3.0
>
>         Attachments: LUCENE-2064.patch, LUCENE-2064.patch, LUCENE-2064.txt
>
>
> In order to support MultiTermQuery subclasses the Highlighter component applies instanceof checks for concrete classes from the lucene core. This prevents classes like RegexQuery in contrib from being supported. Introducing dependencies on other contribs is not feasible just for being supported by the highlighter.
> While the instanceof checks and subsequent casts might hopefully go somehow away  in the future but for supporting more multterm queries I have a alternative approach using a fake IndexReader that uses a RewriteMethod to force the MTQ to pass the field name to the given reader without doing any real work. It is easier to explain once you see the patch - I will upload shortly.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (LUCENE-2064) Highlighter should support all MultiFieldQuery subclasses without casts

Posted by "Mark Miller (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-2064?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12777717#action_12777717 ] 

Mark Miller commented on LUCENE-2064:
-------------------------------------

It is clever - personally I think I'd prefer the getFields method - this is kind of a hack to get the field - though a pretty clever hack. I suppose we could make the argument that this can tide us over - but it will only take a couple of minutes to add getFields as well.

I think Simon may argue that this will work in more cases by default - where external queries would have to implement the getFeilds method. Which is a good point. Still would prefer something cleaner, but perhaps that makes this worth it nonetheless. It would prob make sense to fall back to this if getFields returned an empty set anyway - which almost makes it not even worth it to do getFields as things don't get any cleaner ...

We def want the multitermquery clone - thats for sure - Uwe recently mentioned that as well and I'd been meaning to get around to it myself.

> Highlighter should support all MultiFieldQuery subclasses without casts
> -----------------------------------------------------------------------
>
>                 Key: LUCENE-2064
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2064
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: contrib/highlighter
>    Affects Versions: 2.9.1
>            Reporter: Simon Willnauer
>            Assignee: Simon Willnauer
>             Fix For: 3.0
>
>         Attachments: LUCENE-2064.txt
>
>
> In order to support MultiTermQuery subclasses the Highlighter component applies instanceof checks for concrete classes from the lucene core. This prevents classes like RegexQuery in contrib from being supported. Introducing dependencies on other contribs is not feasible just for being supported by the highlighter.
> While the instanceof checks and subsequent casts might hopefully go somehow away  in the future but for supporting more multterm queries I have a alternative approach using a fake IndexReader that uses a RewriteMethod to force the MTQ to pass the field name to the given reader without doing any real work. It is easier to explain once you see the patch - I will upload shortly.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (LUCENE-2064) Highlighter should support all MultiTermQuery subclasses without casts

Posted by "Simon Willnauer (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-2064?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12777923#action_12777923 ] 

Simon Willnauer commented on LUCENE-2064:
-----------------------------------------

Argh! Fixed in rev. 836176 
Thanks uwe I did look at the right one first - I hate that AM / PM issue.

> Highlighter should support all MultiTermQuery subclasses without casts
> ----------------------------------------------------------------------
>
>                 Key: LUCENE-2064
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2064
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: contrib/highlighter
>    Affects Versions: 2.9.1
>            Reporter: Simon Willnauer
>            Assignee: Simon Willnauer
>             Fix For: 3.0
>
>         Attachments: LUCENE-2064.patch, LUCENE-2064.patch, LUCENE-2064.txt
>
>
> In order to support MultiTermQuery subclasses the Highlighter component applies instanceof checks for concrete classes from the lucene core. This prevents classes like RegexQuery in contrib from being supported. Introducing dependencies on other contribs is not feasible just for being supported by the highlighter.
> While the instanceof checks and subsequent casts might hopefully go somehow away  in the future but for supporting more multterm queries I have a alternative approach using a fake IndexReader that uses a RewriteMethod to force the MTQ to pass the field name to the given reader without doing any real work. It is easier to explain once you see the patch - I will upload shortly.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (LUCENE-2064) Highlighter should support all MultiTermQuery subclasses without casts

Posted by "Mark Miller (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-2064?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12777781#action_12777781 ] 

Mark Miller commented on LUCENE-2064:
-------------------------------------

bq.  Introducing dependencies on other contribs is not feasible just for being supported by the highlighter.

Oh its feasible :) We already depend on the only contrib that currently has a multiterm query - regex - and memory index. But it looks like the regex dependency snuck in there while working on the spanregexquery support - I don't think its actually needed anymore - we should remove it. Its only a build dependency, so its not actually a big deal - just annoying if it happened to keep growing.

> Highlighter should support all MultiTermQuery subclasses without casts
> ----------------------------------------------------------------------
>
>                 Key: LUCENE-2064
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2064
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: contrib/highlighter
>    Affects Versions: 2.9.1
>            Reporter: Simon Willnauer
>            Assignee: Simon Willnauer
>             Fix For: 3.0
>
>         Attachments: LUCENE-2064.patch, LUCENE-2064.txt
>
>
> In order to support MultiTermQuery subclasses the Highlighter component applies instanceof checks for concrete classes from the lucene core. This prevents classes like RegexQuery in contrib from being supported. Introducing dependencies on other contribs is not feasible just for being supported by the highlighter.
> While the instanceof checks and subsequent casts might hopefully go somehow away  in the future but for supporting more multterm queries I have a alternative approach using a fake IndexReader that uses a RewriteMethod to force the MTQ to pass the field name to the given reader without doing any real work. It is easier to explain once you see the patch - I will upload shortly.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Resolved: (LUCENE-2064) Highlighter should support all MultiTermQuery subclasses without casts

Posted by "Simon Willnauer (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENE-2064?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Simon Willnauer resolved LUCENE-2064.
-------------------------------------

    Resolution: Fixed

> Highlighter should support all MultiTermQuery subclasses without casts
> ----------------------------------------------------------------------
>
>                 Key: LUCENE-2064
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2064
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: contrib/highlighter
>    Affects Versions: 2.9.1
>            Reporter: Simon Willnauer
>            Assignee: Simon Willnauer
>             Fix For: 3.0
>
>         Attachments: LUCENE-2064.patch, LUCENE-2064.patch, LUCENE-2064.txt
>
>
> In order to support MultiTermQuery subclasses the Highlighter component applies instanceof checks for concrete classes from the lucene core. This prevents classes like RegexQuery in contrib from being supported. Introducing dependencies on other contribs is not feasible just for being supported by the highlighter.
> While the instanceof checks and subsequent casts might hopefully go somehow away  in the future but for supporting more multterm queries I have a alternative approach using a fake IndexReader that uses a RewriteMethod to force the MTQ to pass the field name to the given reader without doing any real work. It is easier to explain once you see the patch - I will upload shortly.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Updated: (LUCENE-2064) Highlighter should support all MultiFieldQuery subclasses without casts

Posted by "Uwe Schindler (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENE-2064?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Uwe Schindler updated LUCENE-2064:
----------------------------------

    Comment: was deleted

(was: This is cool.

Highlighter & MTQ is broken in 2.9.1 - why not put this into 3.0 it is not more broken than highlighter at all, but it would prevent people from more broken in 3.0.

Thinking about this patch, but it should really make it into 3.0, because it would help people, that migrated to 3.0, and highlighter would be broken more without it.

+1 for 3.0)

> Highlighter should support all MultiFieldQuery subclasses without casts
> -----------------------------------------------------------------------
>
>                 Key: LUCENE-2064
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2064
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: contrib/highlighter
>    Affects Versions: 2.9.1
>            Reporter: Simon Willnauer
>            Assignee: Simon Willnauer
>             Fix For: 3.0
>
>         Attachments: LUCENE-2064.txt
>
>
> In order to support MultiTermQuery subclasses the Highlighter component applies instanceof checks for concrete classes from the lucene core. This prevents classes like RegexQuery in contrib from being supported. Introducing dependencies on other contribs is not feasible just for being supported by the highlighter.
> While the instanceof checks and subsequent casts might hopefully go somehow away  in the future but for supporting more multterm queries I have a alternative approach using a fake IndexReader that uses a RewriteMethod to force the MTQ to pass the field name to the given reader without doing any real work. It is easier to explain once you see the patch - I will upload shortly.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (LUCENE-2064) Highlighter should support all MultiTermQuery subclasses without casts

Posted by "Simon Willnauer (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-2064?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12777898#action_12777898 ] 

Simon Willnauer commented on LUCENE-2064:
-----------------------------------------

Commited in revision 836161

> Highlighter should support all MultiTermQuery subclasses without casts
> ----------------------------------------------------------------------
>
>                 Key: LUCENE-2064
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2064
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: contrib/highlighter
>    Affects Versions: 2.9.1
>            Reporter: Simon Willnauer
>            Assignee: Simon Willnauer
>             Fix For: 3.0
>
>         Attachments: LUCENE-2064.patch, LUCENE-2064.patch, LUCENE-2064.txt
>
>
> In order to support MultiTermQuery subclasses the Highlighter component applies instanceof checks for concrete classes from the lucene core. This prevents classes like RegexQuery in contrib from being supported. Introducing dependencies on other contribs is not feasible just for being supported by the highlighter.
> While the instanceof checks and subsequent casts might hopefully go somehow away  in the future but for supporting more multterm queries I have a alternative approach using a fake IndexReader that uses a RewriteMethod to force the MTQ to pass the field name to the given reader without doing any real work. It is easier to explain once you see the patch - I will upload shortly.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Updated: (LUCENE-2064) Highlighter should support all MultiTermQuery subclasses without casts

Posted by "Uwe Schindler (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENE-2064?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Uwe Schindler updated LUCENE-2064:
----------------------------------

    Attachment: LUCENE-2064.patch

Here the solution with empty MemoryIndex. This seems to be the quickest solution.

> Highlighter should support all MultiTermQuery subclasses without casts
> ----------------------------------------------------------------------
>
>                 Key: LUCENE-2064
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2064
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: contrib/highlighter
>    Affects Versions: 2.9.1
>            Reporter: Simon Willnauer
>            Assignee: Simon Willnauer
>             Fix For: 3.0
>
>         Attachments: LUCENE-2064.patch, LUCENE-2064.txt
>
>
> In order to support MultiTermQuery subclasses the Highlighter component applies instanceof checks for concrete classes from the lucene core. This prevents classes like RegexQuery in contrib from being supported. Introducing dependencies on other contribs is not feasible just for being supported by the highlighter.
> While the instanceof checks and subsequent casts might hopefully go somehow away  in the future but for supporting more multterm queries I have a alternative approach using a fake IndexReader that uses a RewriteMethod to force the MTQ to pass the field name to the given reader without doing any real work. It is easier to explain once you see the patch - I will upload shortly.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Updated: (LUCENE-2064) Highlighter should support all MultiFieldQuery subclasses without casts

Posted by "Simon Willnauer (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENE-2064?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Simon Willnauer updated LUCENE-2064:
------------------------------------

    Attachment: LUCENE-2064.txt

This is the patch - please let me know if I miss something especially related to the removed copyMultiTermQuery method which I replaced with a clone call.  - All tests pass.

 

> Highlighter should support all MultiFieldQuery subclasses without casts
> -----------------------------------------------------------------------
>
>                 Key: LUCENE-2064
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2064
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: contrib/highlighter
>    Affects Versions: 2.9.1
>            Reporter: Simon Willnauer
>            Assignee: Simon Willnauer
>             Fix For: 3.1
>
>         Attachments: LUCENE-2064.txt
>
>
> In order to support MultiTermQuery subclasses the Highlighter component applies instanceof checks for concrete classes from the lucene core. This prevents classes like RegexQuery in contrib from being supported. Introducing dependencies on other contribs is not feasible just for being supported by the highlighter.
> While the instanceof checks and subsequent casts might hopefully go somehow away  in the future but for supporting more multterm queries I have a alternative approach using a fake IndexReader that uses a RewriteMethod to force the MTQ to pass the field name to the given reader without doing any real work. It is easier to explain once you see the patch - I will upload shortly.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Issue Comment Edited: (LUCENE-2064) Highlighter should support all MultiTermQuery subclasses without casts

Posted by "Mark Miller (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-2064?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12777781#action_12777781 ] 

Mark Miller edited comment on LUCENE-2064 at 11/14/09 1:05 AM:
---------------------------------------------------------------

bq.  Introducing dependencies on other contribs is not feasible just for being supported by the highlighter.

Oh its feasible :) We already depend on the only contrib that currently has a multiterm query - regex - and memory index. But it looks like the regex dependency snuck in there while working on the spanregexquery support - I don't think its actually needed anymore - we should remove it. Its only a build dependency, so its not actually a big deal - just annoying if it happened to keep growing.

*edit*

Hmm - actually, it looks like we can't avoid those dependencies after all - not if we want to test those queries - looks like the contrib dependency on regex stays anyway. Forgot its just there for the tests now.

      was (Author: markrmiller@gmail.com):
    bq.  Introducing dependencies on other contribs is not feasible just for being supported by the highlighter.

Oh its feasible :) We already depend on the only contrib that currently has a multiterm query - regex - and memory index. But it looks like the regex dependency snuck in there while working on the spanregexquery support - I don't think its actually needed anymore - we should remove it. Its only a build dependency, so its not actually a big deal - just annoying if it happened to keep growing.
  
> Highlighter should support all MultiTermQuery subclasses without casts
> ----------------------------------------------------------------------
>
>                 Key: LUCENE-2064
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2064
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: contrib/highlighter
>    Affects Versions: 2.9.1
>            Reporter: Simon Willnauer
>            Assignee: Simon Willnauer
>             Fix For: 3.0
>
>         Attachments: LUCENE-2064.patch, LUCENE-2064.txt
>
>
> In order to support MultiTermQuery subclasses the Highlighter component applies instanceof checks for concrete classes from the lucene core. This prevents classes like RegexQuery in contrib from being supported. Introducing dependencies on other contribs is not feasible just for being supported by the highlighter.
> While the instanceof checks and subsequent casts might hopefully go somehow away  in the future but for supporting more multterm queries I have a alternative approach using a fake IndexReader that uses a RewriteMethod to force the MTQ to pass the field name to the given reader without doing any real work. It is easier to explain once you see the patch - I will upload shortly.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (LUCENE-2064) Highlighter should support all MultiFieldQuery subclasses without casts

Posted by "Uwe Schindler (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-2064?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12777714#action_12777714 ] 

Uwe Schindler commented on LUCENE-2064:
---------------------------------------

bq. I think there was some discussion on the list about allow a getField() or something for multitermqueries, but in the meantime, this patch will work for now, and its internal to the highlighter so its not like it would have to be deprecated later.

We discussed on ApacheCon about that. My idea was a Fieldable interface that provides getField and the highlighter must only check instanceof Fieldable. And cloning is really the simpliest to create a copy of MTQ, as *all* Query instances are cloneable (because Query implements Cloneable)

> Highlighter should support all MultiFieldQuery subclasses without casts
> -----------------------------------------------------------------------
>
>                 Key: LUCENE-2064
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2064
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: contrib/highlighter
>    Affects Versions: 2.9.1
>            Reporter: Simon Willnauer
>            Assignee: Simon Willnauer
>             Fix For: 3.0
>
>         Attachments: LUCENE-2064.txt
>
>
> In order to support MultiTermQuery subclasses the Highlighter component applies instanceof checks for concrete classes from the lucene core. This prevents classes like RegexQuery in contrib from being supported. Introducing dependencies on other contribs is not feasible just for being supported by the highlighter.
> While the instanceof checks and subsequent casts might hopefully go somehow away  in the future but for supporting more multterm queries I have a alternative approach using a fake IndexReader that uses a RewriteMethod to force the MTQ to pass the field name to the given reader without doing any real work. It is easier to explain once you see the patch - I will upload shortly.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (LUCENE-2064) Highlighter should support all MultiTermQuery subclasses without casts

Posted by "Simon Willnauer (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-2064?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12777884#action_12777884 ] 

Simon Willnauer commented on LUCENE-2064:
-----------------------------------------

bq. More simple, as MemoryIndex also provides the empty TermEnum. 
Good stuff - I plan to commit this soon if nobody objects.

> Highlighter should support all MultiTermQuery subclasses without casts
> ----------------------------------------------------------------------
>
>                 Key: LUCENE-2064
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2064
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: contrib/highlighter
>    Affects Versions: 2.9.1
>            Reporter: Simon Willnauer
>            Assignee: Simon Willnauer
>             Fix For: 3.0
>
>         Attachments: LUCENE-2064.patch, LUCENE-2064.patch, LUCENE-2064.txt
>
>
> In order to support MultiTermQuery subclasses the Highlighter component applies instanceof checks for concrete classes from the lucene core. This prevents classes like RegexQuery in contrib from being supported. Introducing dependencies on other contribs is not feasible just for being supported by the highlighter.
> While the instanceof checks and subsequent casts might hopefully go somehow away  in the future but for supporting more multterm queries I have a alternative approach using a fake IndexReader that uses a RewriteMethod to force the MTQ to pass the field name to the given reader without doing any real work. It is easier to explain once you see the patch - I will upload shortly.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Updated: (LUCENE-2064) Highlighter should support all MultiTermQuery subclasses without casts

Posted by "Uwe Schindler (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LUCENE-2064?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Uwe Schindler updated LUCENE-2064:
----------------------------------

    Summary: Highlighter should support all MultiTermQuery subclasses without casts  (was: Highlighter should support all MultiFieldQuery subclasses without casts)

Maybe we should add this patch for 3.0 to not break anything after upgrading to 3.0. As it is completely internal in Highlighter, it would not break anything. Requiring a method in 3.0, whcih should be 2.9 compatible and no new functionality would be not good.

In 3.1 we could add a Fieldable interface that defines getField and eerybody (could) implement it. If not, we could still use this fallback.

> Highlighter should support all MultiTermQuery subclasses without casts
> ----------------------------------------------------------------------
>
>                 Key: LUCENE-2064
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2064
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: contrib/highlighter
>    Affects Versions: 2.9.1
>            Reporter: Simon Willnauer
>            Assignee: Simon Willnauer
>             Fix For: 3.0
>
>         Attachments: LUCENE-2064.txt
>
>
> In order to support MultiTermQuery subclasses the Highlighter component applies instanceof checks for concrete classes from the lucene core. This prevents classes like RegexQuery in contrib from being supported. Introducing dependencies on other contribs is not feasible just for being supported by the highlighter.
> While the instanceof checks and subsequent casts might hopefully go somehow away  in the future but for supporting more multterm queries I have a alternative approach using a fake IndexReader that uses a RewriteMethod to force the MTQ to pass the field name to the given reader without doing any real work. It is easier to explain once you see the patch - I will upload shortly.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Issue Comment Edited: (LUCENE-2064) Highlighter should support all MultiTermQuery subclasses without casts

Posted by "Uwe Schindler (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-2064?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12777756#action_12777756 ] 

Uwe Schindler edited comment on LUCENE-2064 at 11/14/09 12:12 AM:
------------------------------------------------------------------

One comment to the patch:
If a MTQ subclass does something special during rewrite or in its FilteredTermEnum and calls any other method of FakeReader, it throws NPE. You should catch this Exception and in this case fall back to extract no terms.

*EDIT*

Or simply use the passed in reader as delegate of FakeReader, then it will behave correctly for all methods.

      was (Author: thetaphi):
    One comment to the patch:
If a MTQ subclass does something special during rewrite or in its FilteredTermEnum and calls any other method of FakeReader, it throws NPE. You should catch this Exception and in this case fall back to extract no terms.
  
> Highlighter should support all MultiTermQuery subclasses without casts
> ----------------------------------------------------------------------
>
>                 Key: LUCENE-2064
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2064
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: contrib/highlighter
>    Affects Versions: 2.9.1
>            Reporter: Simon Willnauer
>            Assignee: Simon Willnauer
>             Fix For: 3.0
>
>         Attachments: LUCENE-2064.txt
>
>
> In order to support MultiTermQuery subclasses the Highlighter component applies instanceof checks for concrete classes from the lucene core. This prevents classes like RegexQuery in contrib from being supported. Introducing dependencies on other contribs is not feasible just for being supported by the highlighter.
> While the instanceof checks and subsequent casts might hopefully go somehow away  in the future but for supporting more multterm queries I have a alternative approach using a fake IndexReader that uses a RewriteMethod to force the MTQ to pass the field name to the given reader without doing any real work. It is easier to explain once you see the patch - I will upload shortly.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Issue Comment Edited: (LUCENE-2064) Highlighter should support all MultiFieldQuery subclasses without casts

Posted by "Uwe Schindler (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-2064?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12777686#action_12777686 ] 

Uwe Schindler edited comment on LUCENE-2064 at 11/13/09 10:42 PM:
------------------------------------------------------------------

This is cool.

Highlighter & MTQ is broken in 2.9.1. This patch looks completely broken, but it isn't - and my mind was also broken when I first saw the patch - because of that. This patch is cooler than all heavy commiting during ApacheCon.

+1 for 3.0 with this patch.That was what I wanted to say with my complete nonsense comment.

      was (Author: thetaphi):
    This is cool.

Highlighter & MTQ is broken in 2.9.1. This patch looks completely broken - and my mind was also broken when I first saw the patch - because of that. This patch is cooler than all heavy commiting during ApacheCon.

+1 for 3.0 with this patch.That was what I wanted to say with my complete nonsense comment.
  
> Highlighter should support all MultiFieldQuery subclasses without casts
> -----------------------------------------------------------------------
>
>                 Key: LUCENE-2064
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2064
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: contrib/highlighter
>    Affects Versions: 2.9.1
>            Reporter: Simon Willnauer
>            Assignee: Simon Willnauer
>             Fix For: 3.0
>
>         Attachments: LUCENE-2064.txt
>
>
> In order to support MultiTermQuery subclasses the Highlighter component applies instanceof checks for concrete classes from the lucene core. This prevents classes like RegexQuery in contrib from being supported. Introducing dependencies on other contribs is not feasible just for being supported by the highlighter.
> While the instanceof checks and subsequent casts might hopefully go somehow away  in the future but for supporting more multterm queries I have a alternative approach using a fake IndexReader that uses a RewriteMethod to force the MTQ to pass the field name to the given reader without doing any real work. It is easier to explain once you see the patch - I will upload shortly.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (LUCENE-2064) Highlighter should support all MultiTermQuery subclasses without casts

Posted by "Uwe Schindler (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-2064?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12777906#action_12777906 ] 

Uwe Schindler commented on LUCENE-2064:
---------------------------------------

You did not use the latest patch, which was simplier and had extra checks? The am pm problem again.

> Highlighter should support all MultiTermQuery subclasses without casts
> ----------------------------------------------------------------------
>
>                 Key: LUCENE-2064
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2064
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: contrib/highlighter
>    Affects Versions: 2.9.1
>            Reporter: Simon Willnauer
>            Assignee: Simon Willnauer
>             Fix For: 3.0
>
>         Attachments: LUCENE-2064.patch, LUCENE-2064.patch, LUCENE-2064.txt
>
>
> In order to support MultiTermQuery subclasses the Highlighter component applies instanceof checks for concrete classes from the lucene core. This prevents classes like RegexQuery in contrib from being supported. Introducing dependencies on other contribs is not feasible just for being supported by the highlighter.
> While the instanceof checks and subsequent casts might hopefully go somehow away  in the future but for supporting more multterm queries I have a alternative approach using a fake IndexReader that uses a RewriteMethod to force the MTQ to pass the field name to the given reader without doing any real work. It is easier to explain once you see the patch - I will upload shortly.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (LUCENE-2064) Highlighter should support all MultiTermQuery subclasses without casts

Posted by "Uwe Schindler (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-2064?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12777774#action_12777774 ] 

Uwe Schindler commented on LUCENE-2064:
---------------------------------------

bq. I agree with the exception, but which reader are you talking about. 

You are right, there is no IR available when instantiating (Smart)FakeReader. So catching the NPE is the only way, or implement all methods of IR to return something valid / use an empty static final unmodifiable MemoryIndex as delegate of the FakeReader.

> Highlighter should support all MultiTermQuery subclasses without casts
> ----------------------------------------------------------------------
>
>                 Key: LUCENE-2064
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2064
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: contrib/highlighter
>    Affects Versions: 2.9.1
>            Reporter: Simon Willnauer
>            Assignee: Simon Willnauer
>             Fix For: 3.0
>
>         Attachments: LUCENE-2064.txt
>
>
> In order to support MultiTermQuery subclasses the Highlighter component applies instanceof checks for concrete classes from the lucene core. This prevents classes like RegexQuery in contrib from being supported. Introducing dependencies on other contribs is not feasible just for being supported by the highlighter.
> While the instanceof checks and subsequent casts might hopefully go somehow away  in the future but for supporting more multterm queries I have a alternative approach using a fake IndexReader that uses a RewriteMethod to force the MTQ to pass the field name to the given reader without doing any real work. It is easier to explain once you see the patch - I will upload shortly.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (LUCENE-2064) Highlighter should support all MultiTermQuery subclasses without casts

Posted by "Robert Muir (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-2064?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12777960#action_12777960 ] 

Robert Muir commented on LUCENE-2064:
-------------------------------------

someone at apachecon told me you can fix this in your prefs... 

but i don't have a preference to change dateformat!
How can we fix this problem, its very annoying?

> Highlighter should support all MultiTermQuery subclasses without casts
> ----------------------------------------------------------------------
>
>                 Key: LUCENE-2064
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2064
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: contrib/highlighter
>    Affects Versions: 2.9.1
>            Reporter: Simon Willnauer
>            Assignee: Simon Willnauer
>             Fix For: 3.0
>
>         Attachments: LUCENE-2064.patch, LUCENE-2064.patch, LUCENE-2064.txt
>
>
> In order to support MultiTermQuery subclasses the Highlighter component applies instanceof checks for concrete classes from the lucene core. This prevents classes like RegexQuery in contrib from being supported. Introducing dependencies on other contribs is not feasible just for being supported by the highlighter.
> While the instanceof checks and subsequent casts might hopefully go somehow away  in the future but for supporting more multterm queries I have a alternative approach using a fake IndexReader that uses a RewriteMethod to force the MTQ to pass the field name to the given reader without doing any real work. It is easier to explain once you see the patch - I will upload shortly.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (LUCENE-2064) Highlighter should support all MultiFieldQuery subclasses without casts

Posted by "Uwe Schindler (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-2064?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12777686#action_12777686 ] 

Uwe Schindler commented on LUCENE-2064:
---------------------------------------

This is cool.

Highlighter & MTQ is broken in 2.9.1. This patch looks completely broken - and my mind was also broken when I first saw the patch - because of that. This patch is cooler than all heavy commiting during ApacheCon.

+1 for 3.0 with this patch.That was what I wanted to say with my complete nonsense comment.

> Highlighter should support all MultiFieldQuery subclasses without casts
> -----------------------------------------------------------------------
>
>                 Key: LUCENE-2064
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2064
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: contrib/highlighter
>    Affects Versions: 2.9.1
>            Reporter: Simon Willnauer
>            Assignee: Simon Willnauer
>             Fix For: 3.1
>
>         Attachments: LUCENE-2064.txt
>
>
> In order to support MultiTermQuery subclasses the Highlighter component applies instanceof checks for concrete classes from the lucene core. This prevents classes like RegexQuery in contrib from being supported. Introducing dependencies on other contribs is not feasible just for being supported by the highlighter.
> While the instanceof checks and subsequent casts might hopefully go somehow away  in the future but for supporting more multterm queries I have a alternative approach using a fake IndexReader that uses a RewriteMethod to force the MTQ to pass the field name to the given reader without doing any real work. It is easier to explain once you see the patch - I will upload shortly.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (LUCENE-2064) Highlighter should support all MultiTermQuery subclasses without casts

Posted by "Mark Miller (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-2064?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12777776#action_12777776 ] 

Mark Miller commented on LUCENE-2064:
-------------------------------------

As I said, thinking about it, I don't think we can end up fixing it in a better way. We can't force older impls out there to implement what we need - sure we can fix it in core easy enough, but its a real hassle to do this in another way that doesnt require outside multitermquery impls to change - we are going to have to fall back to this anyway with any current plans. So might as well nix those plans for now. I'd prefer our "futurebetterhighlighter" prompt any changes that require so much hassle. Its prob best just to stick with this method.

I'd just make it so the rest of the IndexReader methods act as if the thing is empty - letting it throw a null pointer exception and catching it makes those impls unhighlightable when they likely could be.

> Highlighter should support all MultiTermQuery subclasses without casts
> ----------------------------------------------------------------------
>
>                 Key: LUCENE-2064
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2064
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: contrib/highlighter
>    Affects Versions: 2.9.1
>            Reporter: Simon Willnauer
>            Assignee: Simon Willnauer
>             Fix For: 3.0
>
>         Attachments: LUCENE-2064.txt
>
>
> In order to support MultiTermQuery subclasses the Highlighter component applies instanceof checks for concrete classes from the lucene core. This prevents classes like RegexQuery in contrib from being supported. Introducing dependencies on other contribs is not feasible just for being supported by the highlighter.
> While the instanceof checks and subsequent casts might hopefully go somehow away  in the future but for supporting more multterm queries I have a alternative approach using a fake IndexReader that uses a RewriteMethod to force the MTQ to pass the field name to the given reader without doing any real work. It is easier to explain once you see the patch - I will upload shortly.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (LUCENE-2064) Highlighter should support all MultiFieldQuery subclasses without casts

Posted by "Uwe Schindler (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-2064?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12777682#action_12777682 ] 

Uwe Schindler commented on LUCENE-2064:
---------------------------------------

This is cool.

Highlighter & MTQ is broken in 2.9.1 - why not put this into 3.0 it is not more broken than highlighter at all, but it would prevent people from more broken in 3.0.

Thinking about this patch, but it should really make it into 3.0, because it would help people, that migrated to 3.0, and highlighter would be broken more without it.

+1 for 3.0

> Highlighter should support all MultiFieldQuery subclasses without casts
> -----------------------------------------------------------------------
>
>                 Key: LUCENE-2064
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2064
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: contrib/highlighter
>    Affects Versions: 2.9.1
>            Reporter: Simon Willnauer
>            Assignee: Simon Willnauer
>             Fix For: 3.1
>
>         Attachments: LUCENE-2064.txt
>
>
> In order to support MultiTermQuery subclasses the Highlighter component applies instanceof checks for concrete classes from the lucene core. This prevents classes like RegexQuery in contrib from being supported. Introducing dependencies on other contribs is not feasible just for being supported by the highlighter.
> While the instanceof checks and subsequent casts might hopefully go somehow away  in the future but for supporting more multterm queries I have a alternative approach using a fake IndexReader that uses a RewriteMethod to force the MTQ to pass the field name to the given reader without doing any real work. It is easier to explain once you see the patch - I will upload shortly.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (LUCENE-2064) Highlighter should support all MultiFieldQuery subclasses without casts

Posted by "Robert Muir (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-2064?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12777684#action_12777684 ] 

Robert Muir commented on LUCENE-2064:
-------------------------------------

Uwe, I agree, I think you should set to 3.0

I think there was some discussion on the list about allow a getField() or something for multitermqueries, but in the meantime, this patch will work for now, and its internal to the highlighter so its not like it would have to be deprecated later.


> Highlighter should support all MultiFieldQuery subclasses without casts
> -----------------------------------------------------------------------
>
>                 Key: LUCENE-2064
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2064
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: contrib/highlighter
>    Affects Versions: 2.9.1
>            Reporter: Simon Willnauer
>            Assignee: Simon Willnauer
>             Fix For: 3.1
>
>         Attachments: LUCENE-2064.txt
>
>
> In order to support MultiTermQuery subclasses the Highlighter component applies instanceof checks for concrete classes from the lucene core. This prevents classes like RegexQuery in contrib from being supported. Introducing dependencies on other contribs is not feasible just for being supported by the highlighter.
> While the instanceof checks and subsequent casts might hopefully go somehow away  in the future but for supporting more multterm queries I have a alternative approach using a fake IndexReader that uses a RewriteMethod to force the MTQ to pass the field name to the given reader without doing any real work. It is easier to explain once you see the patch - I will upload shortly.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (LUCENE-2064) Highlighter should support all MultiTermQuery subclasses without casts

Posted by "Simon Willnauer (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-2064?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12777769#action_12777769 ] 

Simon Willnauer commented on LUCENE-2064:
-----------------------------------------

As I stated above, i see this as a neat workaround until we fix this class / contrib eventually. It won't hurt performance or breaks any compatibility, its hidden deep inside the abysses of Highlighter. Most importantly it adds little functionality to the highlighter component which I believe a lot of people still using.

I will add another patch tomorrow which catches the exception.

> Highlighter should support all MultiTermQuery subclasses without casts
> ----------------------------------------------------------------------
>
>                 Key: LUCENE-2064
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2064
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: contrib/highlighter
>    Affects Versions: 2.9.1
>            Reporter: Simon Willnauer
>            Assignee: Simon Willnauer
>             Fix For: 3.0
>
>         Attachments: LUCENE-2064.txt
>
>
> In order to support MultiTermQuery subclasses the Highlighter component applies instanceof checks for concrete classes from the lucene core. This prevents classes like RegexQuery in contrib from being supported. Introducing dependencies on other contribs is not feasible just for being supported by the highlighter.
> While the instanceof checks and subsequent casts might hopefully go somehow away  in the future but for supporting more multterm queries I have a alternative approach using a fake IndexReader that uses a RewriteMethod to force the MTQ to pass the field name to the given reader without doing any real work. It is easier to explain once you see the patch - I will upload shortly.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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


[jira] Commented: (LUCENE-2064) Highlighter should support all MultiTermQuery subclasses without casts

Posted by "Mark Miller (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LUCENE-2064?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12777782#action_12777782 ] 

Mark Miller commented on LUCENE-2064:
-------------------------------------

Nice Uwe! - good idea.

> Highlighter should support all MultiTermQuery subclasses without casts
> ----------------------------------------------------------------------
>
>                 Key: LUCENE-2064
>                 URL: https://issues.apache.org/jira/browse/LUCENE-2064
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: contrib/highlighter
>    Affects Versions: 2.9.1
>            Reporter: Simon Willnauer
>            Assignee: Simon Willnauer
>             Fix For: 3.0
>
>         Attachments: LUCENE-2064.patch, LUCENE-2064.txt
>
>
> In order to support MultiTermQuery subclasses the Highlighter component applies instanceof checks for concrete classes from the lucene core. This prevents classes like RegexQuery in contrib from being supported. Introducing dependencies on other contribs is not feasible just for being supported by the highlighter.
> While the instanceof checks and subsequent casts might hopefully go somehow away  in the future but for supporting more multterm queries I have a alternative approach using a fake IndexReader that uses a RewriteMethod to force the MTQ to pass the field name to the given reader without doing any real work. It is easier to explain once you see the patch - I will upload shortly.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


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