Mailing List Archive

Extending Doucment and Hits
Hello,
I needed in my application to override the classes Document and Hits
to make JDBCDocument and JDBCHits. I was surprised that Document and
Hits are final classes and all methods in them are final. Why this? I
couldn't make my program well because of this problem. Is there a way
to overcome it?

thanks in advance
--
regards,
Ahmed Saad

---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org
Extending Doucment and Hits [ In reply to ]
Hello,
I needed in my application to override the classes Document and Hits
to make JDBCDocument and JDBCHits. I was surprised that Document and
Hits are final classes and all methods in them are final. Why this? I
couldn't make my program well because of this problem. Is there a way
to overcome it?

thanks in advance
--
regards,
Ahmed Saad

---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org
Re: Extending Doucment and Hits [ In reply to ]
Ahmed - could you outline your use case in detail and why you think
your design demands extensions of these classes?

Erik


On Feb 18, 2006, at 3:41 PM, Ahmed El-dawy wrote:

> Hello,
> I needed in my application to override the classes Document and Hits
> to make JDBCDocument and JDBCHits. I was surprised that Document and
> Hits are final classes and all methods in them are final. Why this? I
> couldn't make my program well because of this problem. Is there a way
> to overcome it?
>
> thanks in advance
> --
> regards,
> Ahmed Saad
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-dev-help@lucene.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org
Re: Extending Doucment and Hits [ In reply to ]
Thanks for your reply.
I need to make a JDBCDocument. This document gets some of its fields
from Lucene Index. It contains a reference to a database where other
fields (larger ones) are stored. Later fields are only read upon
request (like lazy intialization). This is useful to me because when
a search is performed I need to view a snippet of the results. When
one is clicked I need to view the whole document. I needed to store
the snippet in Lucene Index and other fields in database.
JDBCDocument is constructed using an ordinary Document and a DB connection.
JDBCHits is used to return JDBCDocuments instead of normal documents.
I need to do this without changing the code of the interface which
shows the snippets and formats the whole document when it is
requested.

Ahmed Saad
On 2/18/06, Erik Hatcher <erik@ehatchersolutions.com> wrote:
> Ahmed - could you outline your use case in detail and why you think
> your design demands extensions of these classes?
>
> Erik
>
>
> On Feb 18, 2006, at 3:41 PM, Ahmed El-dawy wrote:
>
> > Hello,
> > I needed in my application to override the classes Document and Hits
> > to make JDBCDocument and JDBCHits. I was surprised that Document and
> > Hits are final classes and all methods in them are final. Why this? I
> > couldn't make my program well because of this problem. Is there a way
> > to overcome it?
> >
> > thanks in advance
> > --
> > regards,
> > Ahmed Saad
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
> > For additional commands, e-mail: java-dev-help@lucene.apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-dev-help@lucene.apache.org
>
>


--
regards,
Ahmed Saad

---------------------------------------------------------------------
To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-dev-help@lucene.apache.org
Re: Extending Doucment and Hits [ In reply to ]
I'll just reply briefly and say that this topic has come up before
and is usually shot down because what you are after can be
accomplished by wrappers on your end. You would need to modify
IndexSearcher and family to return a JDBCHits and have your JDBCHits
modified to create JDBCDocuments, which seems overkill for what
you're after. Why not just create a wrapper set of classes that do
what you need with JDBC and Hits in an aggregate fashion rather than
subclass fashion?

Erik

On Feb 19, 2006, at 2:13 AM, Ahmed El-dawy wrote:

> Thanks for your reply.
> I need to make a JDBCDocument. This document gets some of its fields
> from Lucene Index. It contains a reference to a database where other
> fields (larger ones) are stored. Later fields are only read upon
> request (like lazy intialization). This is useful to me because when
> a search is performed I need to view a snippet of the results. When
> one is clicked I need to view the whole document. I needed to store
> the snippet in Lucene Index and other fields in database.
> JDBCDocument is constructed using an ordinary Document and a DB
> connection.
> JDBCHits is used to return JDBCDocuments instead of normal documents.
> I need to do this without changing the code of the interface which
> shows the snippets and formats the whole document when it is
> requested.
>
> Ahmed Saad
> On 2/18/06, Erik Hatcher <erik@ehatchersolutions.com> wrote:
>> Ahmed - could you outline your use case in detail and why you think
>> your design demands extensions of these classes?
>>
>> Erik
>>
>>
>> On Feb 18, 2006, at 3:41 PM, Ahmed El-dawy wrote:
>>
>>> Hello,
>>> I needed in my application to override the classes Document and
>>> Hits
>>> to make JDBCDocument and JDBCHits. I was surprised that Document and
>>> Hits are final classes and all methods in them are final. Why
>>> this? I
>>> couldn't make my program well because of this problem. Is there a
>>> way
>>> to overcome it?
>>>
>>> thanks in advance
>>> --
>>> regards,
>>> Ahmed Saad
>>>
>>> --------------------------------------------------------------------
>>> -
>>> To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
>>> For additional commands, e-mail: java-dev-help@lucene.apache.org
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
>> For additional commands, e-mail: java-dev-help@lucene.apache.org
>>
>>
>
>
> --
> regards,
> Ahmed Saad
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-dev-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-dev-help@lucene.apache.org


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