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 Nick Snels <ni...@gmail.com> on 2006/12/23 20:41:18 UTC

Restrict result returned by Morelikethis

Hi,

I have made a Morelikethis query to look up documents that match a certain
document id. This results in a search of the whole index. I would like the
Morelikethis query to search only part of the index. How can I do this?

I have already tried to create a BooleanQuery, like:

BooleanQuery comboQuery = new BooleanQuery();
comboQuery.add(mltQuery, true, false);
comboQuery.add(originalQuery, true, false);

But I get the error: cannot find symbol
                           [javac] symbol  : method add(
org.apache.lucene.search.Query,boolean,boolean)

What is the correct way to restrict the search area of a Morelikethis query?
Any help is welcome. Thanks.

Kind regards,

Nick Snels

Re: Restrict result returned by Morelikethis

Posted by Nick Snels <ni...@gmail.com>.
Thanks for the reply. I was indeed using the 1.4.3 API, when I actually had
to use the 2.0 version. Thanks for pointing that out. Everything is working
now.

Kind regards,

Nick Snels


On 12/24/06, Chris Hostetter <ho...@fucit.org> wrote:
>
>
> You appear to be trying to use an old method from the java 1.4.3 API for
> BooleanQuery, but i'm assuming you are acctually using Lucene 2.0 or 1.9
> ... take a look at the 2.0 javadocs for BooleanQuery and i think you'll
> see how do what you are attempting...
>
>
> http://lucene.apache.org/java/2_0_0/api/org/apache/lucene/search/BooleanQuery.html
>
> (the approach you are taking towards your goal is sound by the way)
>
> : Date: Sat, 23 Dec 2006 20:41:18 +0100
> : From: Nick Snels <ni...@gmail.com>
> : Reply-To: java-user@lucene.apache.org
> : To: java-user@lucene.apache.org
> : Subject: Restrict result returned by Morelikethis
> :
> : Hi,
> :
> : I have made a Morelikethis query to look up documents that match a
> certain
> : document id. This results in a search of the whole index. I would like
> the
> : Morelikethis query to search only part of the index. How can I do this?
> :
> : I have already tried to create a BooleanQuery, like:
> :
> : BooleanQuery comboQuery = new BooleanQuery();
> : comboQuery.add(mltQuery, true, false);
> : comboQuery.add(originalQuery, true, false);
> :
> : But I get the error: cannot find symbol
> :                            [javac] symbol  : method add(
> : org.apache.lucene.search.Query,boolean,boolean)
> :
> : What is the correct way to restrict the search area of a Morelikethis
> query?
> : Any help is welcome. Thanks.
> :
> : Kind regards,
> :
> : Nick Snels
> :
>
>
>
> -Hoss
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
> For additional commands, e-mail: java-user-help@lucene.apache.org
>
>

Re: Restrict result returned by Morelikethis

Posted by Chris Hostetter <ho...@fucit.org>.
You appear to be trying to use an old method from the java 1.4.3 API for
BooleanQuery, but i'm assuming you are acctually using Lucene 2.0 or 1.9
... take a look at the 2.0 javadocs for BooleanQuery and i think you'll
see how do what you are attempting...

http://lucene.apache.org/java/2_0_0/api/org/apache/lucene/search/BooleanQuery.html

(the approach you are taking towards your goal is sound by the way)

: Date: Sat, 23 Dec 2006 20:41:18 +0100
: From: Nick Snels <ni...@gmail.com>
: Reply-To: java-user@lucene.apache.org
: To: java-user@lucene.apache.org
: Subject: Restrict result returned by Morelikethis
:
: Hi,
:
: I have made a Morelikethis query to look up documents that match a certain
: document id. This results in a search of the whole index. I would like the
: Morelikethis query to search only part of the index. How can I do this?
:
: I have already tried to create a BooleanQuery, like:
:
: BooleanQuery comboQuery = new BooleanQuery();
: comboQuery.add(mltQuery, true, false);
: comboQuery.add(originalQuery, true, false);
:
: But I get the error: cannot find symbol
:                            [javac] symbol  : method add(
: org.apache.lucene.search.Query,boolean,boolean)
:
: What is the correct way to restrict the search area of a Morelikethis query?
: Any help is welcome. Thanks.
:
: Kind regards,
:
: Nick Snels
:



-Hoss


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