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 Kamal Palei <pa...@gmail.com> on 2013/05/13 12:28:10 UTC
Mandatory words search in SOLR
Hi SOLR Experts
When I search documents with keyword as *java, mysql* then I get the
documents containing either *java* or *mysql* or both.
Is it possible to get the documents those contains both *java* and *mysql*.
In that case, how the query would look like.
Thanks a lot
Kamal
Re: Mandatory words search in SOLR
Posted by Kamal Palei <pa...@gmail.com>.
Hi François
As per suggestion, I used 'mm' param and was able to do search for
mandatory fields.
In Drupal, one need to do as
$query->addParam('mm' , '100%');
in query alter hook.
Thanks a lot for guiding me.
Best Regards
Kamal
On Mon, May 13, 2013 at 5:56 PM, Kamal Palei <pa...@gmail.com> wrote:
> Hi François
> Thanks for input. The major problem I face is , I make use of Drupal (as a
> framework) and apachesolr_module provided by Drupal. Where I am not sure,
> how do I directly modify the query. However this is not a right forum to
> ask Drupal related questions. If somebody here knows both Drupal 7 and SOLR
> well, kindly let me know.
>
>
> One more doubt, lets say I want to search some mandatory words and some
> optional words. Say I want to search all documents those contains all Java,
> mysql, php keywords along with atleast one keyword out of TCL, Perl,
> Selenium.
>
> *Basically I am looking at few mandatory keywords and few optional
> keywords.*
>
> Is it possible to search this way. If so, kindly guide me how the query
> should look like.
>
> Best Regards
> Kamal
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> On Mon, May 13, 2013 at 5:31 PM, François Schiettecatte <
> fschiettecatte@gmail.com> wrote:
>
>> Kamal
>>
>> You could also use the 'mm' parameter to require a minimum match, or you
>> could prepend '+' to each required term.
>>
>> Cheers
>>
>> François
>>
>>
>> On May 13, 2013, at 7:57 AM, Kamal Palei <pa...@gmail.com> wrote:
>>
>> > Hi Rafał Kuć
>> > I added q.op=AND as per you suggested. I see though some initial record
>> > document contains both keywords (*java* and *mysql*), towards end I see
>> > still there are number of
>> > documents, they have only one key word either *java* or *mysql*.
>> >
>> > Is it the SOLR behaviour or can I ask for a *strict search only if all
>> my
>> > keywords are present, then only* *fetch record* else not.
>> >
>> > BR,
>> > Kamal
>> >
>> >
>> >
>> > On Mon, May 13, 2013 at 4:02 PM, Rafał Kuć <r....@solr.pl> wrote:
>> >
>> >> Hello!
>> >>
>> >> Change the default query operator. For example add the q.op=AND to
>> >> your query.
>> >>
>> >> --
>> >> Regards,
>> >> Rafał Kuć
>> >> Sematext :: http://sematext.com/ :: Solr - Lucene - Nutch -
>> ElasticSearch
>> >>
>> >>> Hi SOLR Experts
>> >>> When I search documents with keyword as *java, mysql* then I get the
>> >>> documents containing either *java* or *mysql* or both.
>> >>
>> >>> Is it possible to get the documents those contains both *java* and
>> >> *mysql*.
>> >>
>> >>> In that case, how the query would look like.
>> >>
>> >>> Thanks a lot
>> >>> Kamal
>> >>
>> >>
>>
>>
>
Re: Mandatory words search in SOLR
Posted by Kamal Palei <pa...@gmail.com>.
Hi François
Thanks for input. The major problem I face is , I make use of Drupal (as a
framework) and apachesolr_module provided by Drupal. Where I am not sure,
how do I directly modify the query. However this is not a right forum to
ask Drupal related questions. If somebody here knows both Drupal 7 and SOLR
well, kindly let me know.
One more doubt, lets say I want to search some mandatory words and some
optional words. Say I want to search all documents those contains all Java,
mysql, php keywords along with atleast one keyword out of TCL, Perl,
Selenium.
*Basically I am looking at few mandatory keywords and few optional keywords.
*
Is it possible to search this way. If so, kindly guide me how the query
should look like.
Best Regards
Kamal
On Mon, May 13, 2013 at 5:31 PM, François Schiettecatte <
fschiettecatte@gmail.com> wrote:
> Kamal
>
> You could also use the 'mm' parameter to require a minimum match, or you
> could prepend '+' to each required term.
>
> Cheers
>
> François
>
>
> On May 13, 2013, at 7:57 AM, Kamal Palei <pa...@gmail.com> wrote:
>
> > Hi Rafał Kuć
> > I added q.op=AND as per you suggested. I see though some initial record
> > document contains both keywords (*java* and *mysql*), towards end I see
> > still there are number of
> > documents, they have only one key word either *java* or *mysql*.
> >
> > Is it the SOLR behaviour or can I ask for a *strict search only if all my
> > keywords are present, then only* *fetch record* else not.
> >
> > BR,
> > Kamal
> >
> >
> >
> > On Mon, May 13, 2013 at 4:02 PM, Rafał Kuć <r....@solr.pl> wrote:
> >
> >> Hello!
> >>
> >> Change the default query operator. For example add the q.op=AND to
> >> your query.
> >>
> >> --
> >> Regards,
> >> Rafał Kuć
> >> Sematext :: http://sematext.com/ :: Solr - Lucene - Nutch -
> ElasticSearch
> >>
> >>> Hi SOLR Experts
> >>> When I search documents with keyword as *java, mysql* then I get the
> >>> documents containing either *java* or *mysql* or both.
> >>
> >>> Is it possible to get the documents those contains both *java* and
> >> *mysql*.
> >>
> >>> In that case, how the query would look like.
> >>
> >>> Thanks a lot
> >>> Kamal
> >>
> >>
>
>
Re: Mandatory words search in SOLR
Posted by François Schiettecatte <fs...@gmail.com>.
Kamal
You could also use the 'mm' parameter to require a minimum match, or you could prepend '+' to each required term.
Cheers
François
On May 13, 2013, at 7:57 AM, Kamal Palei <pa...@gmail.com> wrote:
> Hi Rafał Kuć
> I added q.op=AND as per you suggested. I see though some initial record
> document contains both keywords (*java* and *mysql*), towards end I see
> still there are number of
> documents, they have only one key word either *java* or *mysql*.
>
> Is it the SOLR behaviour or can I ask for a *strict search only if all my
> keywords are present, then only* *fetch record* else not.
>
> BR,
> Kamal
>
>
>
> On Mon, May 13, 2013 at 4:02 PM, Rafał Kuć <r....@solr.pl> wrote:
>
>> Hello!
>>
>> Change the default query operator. For example add the q.op=AND to
>> your query.
>>
>> --
>> Regards,
>> Rafał Kuć
>> Sematext :: http://sematext.com/ :: Solr - Lucene - Nutch - ElasticSearch
>>
>>> Hi SOLR Experts
>>> When I search documents with keyword as *java, mysql* then I get the
>>> documents containing either *java* or *mysql* or both.
>>
>>> Is it possible to get the documents those contains both *java* and
>> *mysql*.
>>
>>> In that case, how the query would look like.
>>
>>> Thanks a lot
>>> Kamal
>>
>>
Re: Mandatory words search in SOLR
Posted by Kamal Palei <pa...@gmail.com>.
Hi Rafał Kuć
I added q.op=AND as per you suggested. I see though some initial record
document contains both keywords (*java* and *mysql*), towards end I see
still there are number of
documents, they have only one key word either *java* or *mysql*.
Is it the SOLR behaviour or can I ask for a *strict search only if all my
keywords are present, then only* *fetch record* else not.
BR,
Kamal
On Mon, May 13, 2013 at 4:02 PM, Rafał Kuć <r....@solr.pl> wrote:
> Hello!
>
> Change the default query operator. For example add the q.op=AND to
> your query.
>
> --
> Regards,
> Rafał Kuć
> Sematext :: http://sematext.com/ :: Solr - Lucene - Nutch - ElasticSearch
>
> > Hi SOLR Experts
> > When I search documents with keyword as *java, mysql* then I get the
> > documents containing either *java* or *mysql* or both.
>
> > Is it possible to get the documents those contains both *java* and
> *mysql*.
>
> > In that case, how the query would look like.
>
> > Thanks a lot
> > Kamal
>
>
Re: Mandatory words search in SOLR
Posted by Rafał Kuć <r....@solr.pl>.
Hello!
Change the default query operator. For example add the q.op=AND to
your query.
--
Regards,
Rafał Kuć
Sematext :: http://sematext.com/ :: Solr - Lucene - Nutch - ElasticSearch
> Hi SOLR Experts
> When I search documents with keyword as *java, mysql* then I get the
> documents containing either *java* or *mysql* or both.
> Is it possible to get the documents those contains both *java* and *mysql*.
> In that case, how the query would look like.
> Thanks a lot
> Kamal