lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Uwe Schindler" <...@thetaphi.de>
Subject RE: IndexSearcher.search(Weight weight, Filter filter, HitCollector results) is not there in 4.0 version
Date Tue, 22 Jan 2013 23:45:36 GMT
Hi,

the methods taking Weight are not for public use, only for internal use (e.g. subclasses).
You should not pass Weight to IndexSearcher, use the native Query instance! Why do you want
to pass a Weight to IndexSearcher? 

Every Weight is created by a Query instance, so you can always pass the original Query instance
to IndexSearcher, no usage of Weight is needed. IndexSearcher will correctly rewrite the query
and create the weight internally you don't need to handle that (and it is subject to change
and is only a implementation detail).

In addition, there are no longer a Weight-based methods that can also take a Filter (not even
protected). The reason for this is, that IndexSearcher no longer supports and executes Filters
natively, the filter handling is now completely done inside FilteredQuery; IndexSearcher does
not handle Filters anymore. The methods in IndexSearcher taking Query and Filter are for convenience,
but use new FilteredQuery(Query, Filter) internally to wrap the Query/Filter combination and
create the weight from it.

If you want to use the internal search methods with Weight, you have to refactor your code
and include the filter into your Query using FilteredQuery only passing a Weight to IndexSearcher.
But those methods are protected; you can only use them from subclasses (under the assumption
that you know what you are doing *g*).

Finally, the class HitCollector was deprecated in Lucene 2.9 and was removed in 3.0, you have
to use the new segement-based "Collector".

Uwe

-----
Uwe Schindler
H.-H.-Meier-Allee 63, D-28213 Bremen
http://www.thetaphi.de
eMail: uwe@thetaphi.de

> -----Original Message-----
> From: saisantoshi [mailto:saisantoshi76@gmail.com]
> Sent: Wednesday, January 23, 2013 12:27 AM
> To: java-user@lucene.apache.org
> Subject: IndexSearcher.search(Weight weight, Filter filter, HitCollector
> results) is not there in 4.0 version
> 
> We are using the following below method with Lucene 2.4.0
> 
> public void search(Weight weight,
>                    Filter filter,
>                    HitCollector results)
>             throws IOException
> 
> We are upgrading to the latest version and looking at the API (4.0), the above
> signature has been deleted from the 4.0 but has no indication on what other
> method needs to be used for the above one. Could someone please let us
> know if this is a documentation error or removed from 4.0. If its removed
> from 4.0, could someone please suggest an appropriate method that needs
> to be used in place of the above?
> 
> 
> 
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/IndexSearcher-search-Weight-weight-
> Filter-filter-HitCollector-results-is-not-there-in-4-0-version-tp4035488.html
> Sent from the Lucene - Java Users mailing list archive at Nabble.com.
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org


---------------------------------------------------------------------
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