lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ali Rouhi <rouhi....@gmail.com>
Subject Why is Hits.java not Serializable?
Date Wed, 10 Aug 2005 06:37:52 GMT
Hello

I am looking at the RemoteSearchable code for inspiration on how to do
remote searches (I will probably use something like SEDA to implement
the rpc to avoid heavy thread creation issues of rmi, my question
should apply to any implementation of a remote searcher however).

I see that RemoteSearchable does not extend Searcher, but implements
Searchable only. In particular this means that the "public Hits
search(){...}" interfaces of Searcher are not implemented in
RemoteSearchable. In my case, this is transparent to the client, since
I obtain RemoteSearchables from multiple remote indexes and combine
them using MultiSearcer (which does implement "public Hits
search(){...}").

I am concerned about what goes on under the hood here. Which form of
the Searchable interface gets called on the server? The javadoc for
example says that "void search(Query query, Filter filter,
HitCollector results)" should not be used unless one is after all of
the results. So if I'm only interested in the top 100 hits, this seems
not to be a good thing if this particular interface gets called. Maybe
the form that returns "TopDocs" gets called (the javadoc gives an
"expert" qualification for this interface). I could dig into the code
to see what happens, but I am hoping an expert can answer this
question in much shorter order.

Another way to ask this question is, why is  Hits.java not declared
serializable, so that the the search methods which return Hits objects
can be exposed via the Searchable interface rather than the abstract
class Searcher? Hits would have to declared Serializable since
Searchable implements java.rmi.Remote (presumably because it is
implemented by RemoteSearchable!).

I can think of  3 reasons why search methods returning Hits objects
are not exposed in Searchable:

1) Someone forgot to declare Hits Serializable
2) There is a fundamental reason the forms of search which return Hits
objects cannot be called remotely, some non optimal form of search
will get called on the server(s) and I can't do anything about it. For
example "void search(Query query, Filter filter, HitCollector
results)" gets called.
3) Under the hood everything takes care of itself. When I call the
"public Hits search(){...}" on the client, and use the Hits object to
retrieve the 100 most relevant or top sorting results, a non optimal
form of search does *not* get called on the server (maybe a form
returning "TopDocs" is called). In this case I'm worrying
unnecessarily!?

My hoped for answers are 3) or at least 1). Or I may be missing
something and there is another answer.

Sorry for the long winded question, I just can't seem to ask this
question in a few words.

Many thanks
Ali

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


Mime
View raw message