You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by KLessou <kl...@gmail.com> on 2008/10/06 13:24:57 UTC

required keyword in all a document

Hi,

I would like to find all documents who contain "France, Flag, French".

I've got docs like this one :
<doc>
    <str name="id">...</str>
    <str name="k1_en">wordA,wordB,france, ...</str>
    <str name="k2_en">wordA,wordB,flag, ...</str>
    <str name="k3_en">wordA,wordB,french, ...</str>
    ...
</doc>

I can't make my query like this :
k1_en:(+france +flag +french)^100 OR k2_en:(+france +flag +french)^10 OR
k3_en:(+france +flag +french)

So, this only way to do what I want is to generate this query :

(k1_en:france^100 OR k2_en:france^10 OR k3_en:france)
AND
(k1_en:flag^100 OR k2_en:flag^10 OR k3_en:flag)
AND
(k1_en:french^100 OR k2_en:french^10 OR k3_en:french)

Is there a better/more simple way to do this ?

Thx in advance !

-- 
~~~~~
| klessou |
~~~~~

Re: required keyword in all a document

Posted by Chris Hostetter <ho...@fucit.org>.
: Sounds like the DisMax handler would work well for you.  I'm no expert, but
: I'm fairly certain that if you created a solr.DisMaxRequestHandler handler
: with "qf" containing those three fields, you could issue the query "+france
: +flag +french" and get the desired results.

correct.


-Hoss


Re: required keyword in all a document

Posted by Jason Rennie <jr...@gmail.com>.
Sounds like the DisMax handler would work well for you.  I'm no expert, but
I'm fairly certain that if you created a solr.DisMaxRequestHandler handler
with "qf" containing those three fields, you could issue the query "+france
+flag +french" and get the desired results.

Jason

On Mon, Oct 6, 2008 at 7:24 AM, KLessou <kl...@gmail.com> wrote:

> Hi,
>
> I would like to find all documents who contain "France, Flag, French".
>
> I've got docs like this one :
> <doc>
>    <str name="id">...</str>
>    <str name="k1_en">wordA,wordB,france, ...</str>
>    <str name="k2_en">wordA,wordB,flag, ...</str>
>    <str name="k3_en">wordA,wordB,french, ...</str>
>    ...
> </doc>
>
> I can't make my query like this :
> k1_en:(+france +flag +french)^100 OR k2_en:(+france +flag +french)^10 OR
> k3_en:(+france +flag +french)
>
> So, this only way to do what I want is to generate this query :
>
> (k1_en:france^100 OR k2_en:france^10 OR k3_en:france)
> AND
> (k1_en:flag^100 OR k2_en:flag^10 OR k3_en:flag)
> AND
> (k1_en:french^100 OR k2_en:french^10 OR k3_en:french)
>
> Is there a better/more simple way to do this ?
>
> Thx in advance !
>
> --
> ~~~~~
> | klessou |
> ~~~~~
>



-- 
Jason Rennie
Head of Machine Learning Technologies, StyleFeeder
http://www.stylefeeder.com/
Samantha's blog & pictures: http://samanthalyrarennie.blogspot.com/

Re: required keyword in all a document

Posted by KLessou <kl...@gmail.com>.
MultiFieldQueryParser seems to generate what I want :
http://hudson.zones.apache.org/hudson/job/Lucene-trunk/javadoc//org/apache/lucene/queryParser/MultiFieldQueryParser.html

But is there a Php version ?

On Mon, Oct 6, 2008 at 1:24 PM, KLessou <kl...@gmail.com> wrote:

> Hi,
>
> I would like to find all documents who contain "France, Flag, French".
>
> I've got docs like this one :
> <doc>
>     <str name="id">...</str>
>     <str name="k1_en">wordA,wordB,france, ...</str>
>     <str name="k2_en">wordA,wordB,flag, ...</str>
>     <str name="k3_en">wordA,wordB,french, ...</str>
>     ...
> </doc>
>
> I can't make my query like this :
> k1_en:(+france +flag +french)^100 OR k2_en:(+france +flag +french)^10 OR
> k3_en:(+france +flag +french)
>
> So, this only way to do what I want is to generate this query :
>
> (k1_en:france^100 OR k2_en:france^10 OR k3_en:france)
> AND
> (k1_en:flag^100 OR k2_en:flag^10 OR k3_en:flag)
> AND
> (k1_en:french^100 OR k2_en:french^10 OR k3_en:french)
>
> Is there a better/more simple way to do this ?
>
> Thx in advance !
>
> --
> ~~~~~
> | klessou |
> ~~~~~
>



-- 
~~~~~
| klessou |
~~~~~

Re: required keyword in all a document

Posted by KLessou <kl...@gmail.com>.
On Mon, Oct 6, 2008 at 1:24 PM, KLessou <kl...@gmail.com> wrote:

> Hi,
>
> I would like to find all documents who contain "France, Flag, French".
>
> I've got docs like this one :
> <doc>
>     <str name="id">...</str>
>     <str name="k1_en">wordA,wordB,france, ...</str>
>     <str name="k2_en">wordA,wordB,flag, ...</str>
>     <str name="k3_en">wordA,wordB,french, ...</str>
>     ...
> </doc>
>
> I can't make my query like this :
> k1_en:(+france +flag +french)^100 OR k2_en:(+france +flag +french)^10 OR
> k3_en:(+france +flag +french)
>

because I only get this type of document :
<doc>
    <str name="id">...</str>
    <str name="k1_en">wordA,wordB,france,flag,french, ...</str> <!-- all
good keywords are here -->
    <str name="k2_en">wordA,wordB, ...</str>
    <str name="k3_en">wordA,wordB, ...</str>
    ...
</doc>


>
> So, this only way to do what I want is to generate this query :
>
> (k1_en:france^100 OR k2_en:france^10 OR k3_en:france)
> AND
> (k1_en:flag^100 OR k2_en:flag^10 OR k3_en:flag)
> AND
> (k1_en:french^100 OR k2_en:french^10 OR k3_en:french)
>
> Is there a better/more simple way to do this ?
>
> Thx in advance !
>
> --
> ~~~~~
> | klessou |
> ~~~~~
>



-- 
~~~~~
| klessou |
~~~~~