You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Terence Lai <tl...@trekspace.com> on 2005/07/07 21:04:51 UTC

Help on the ParallelMultiSearcher.rewrite(Query) method

Hi all,

I am currently using Lucene 1.4.2. Since my search documents are huge, I divide the search index into different index directory and make use of the ParallelMultiSearcher to perform the search.

Currently, I am working on the highlight feature using Lucene Sandbox Highlighter. One of the requirements is to convert the Query into the primitive form. I invoked the ParallelMultiSearcher.rewrite(Query). However, I got the exception, UnsupportedOperationException.

I start studying the source code. I discover that the ParallelMultiSearcher calls Query.combine() method to combine multiple primitive query into a single one. By looking at the Query.java, the method hasn't been implemented as you see below:

  /** Expert: called when re-writing queries under MultiSearcher.
   *
   * <p>Only implemented by derived queries, with no
   * {@link #createWeight(Searcher)} implementatation.
   */
  public Query combine(Query[] queries) {
    throw new UnsupportedOperationException();
  }

Does anyone know any alternative to rewrite the query if I have multiple index directories?

Thanks,
Terence




----------------------------------------------------------
Get your free email account from http://www.trekspace.com
          Your Internet Virtual Desktop!

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


Re: Help on the ParallelMultiSearcher.rewrite(Query) method

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
Terence - you need to do the rewrite using the appropriate  
IndexReader for a single index.  You can use query.rewrite(IndexReader).

     Erik


On Jul 7, 2005, at 3:04 PM, Terence Lai wrote:

> Hi all,
>
> I am currently using Lucene 1.4.2. Since my search documents are  
> huge, I divide the search index into different index directory and  
> make use of the ParallelMultiSearcher to perform the search.
>
> Currently, I am working on the highlight feature using Lucene  
> Sandbox Highlighter. One of the requirements is to convert the  
> Query into the primitive form. I invoked the  
> ParallelMultiSearcher.rewrite(Query). However, I got the exception,  
> UnsupportedOperationException.
>
> I start studying the source code. I discover that the  
> ParallelMultiSearcher calls Query.combine() method to combine  
> multiple primitive query into a single one. By looking at the  
> Query.java, the method hasn't been implemented as you see below:
>
>   /** Expert: called when re-writing queries under MultiSearcher.
>    *
>    * <p>Only implemented by derived queries, with no
>    * {@link #createWeight(Searcher)} implementatation.
>    */
>   public Query combine(Query[] queries) {
>     throw new UnsupportedOperationException();
>   }
>
> Does anyone know any alternative to rewrite the query if I have  
> multiple index directories?
>
> Thanks,
> Terence
>
>
>
>
> ----------------------------------------------------------
> Get your free email account from http://www.trekspace.com
>           Your Internet Virtual Desktop!
>
> ---------------------------------------------------------------------
> 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