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 Omnia Zayed <om...@gmail.com> on 2012/09/16 11:23:05 UTC
Solr - Proximity search using exact number of words apart
Hi;
I am working with apache-solr-3.6.0 on windows machine. I would like to
search for two words with certain number of words apart (No more than this
number). For example: Consider the following phrases, I would like to
search for Daisy & exam with no more than 2 words apart.
Daisy has exam
Daisy has an exam
Daisy has a math exam
Daisy has a difficult math exam
I searched for such thing and I tried Term Proximity.
http://localhost:8983/solr/select/?q="Daisy
exam"~2&version=2.2&start=0&rows=10&indent=on&debugQuery=true
The result that I need should be the phrase: Daisy has an exam. But using
the above criteria, the result was the last 3 phrase.
So any ideas to use an exact number of words apart?
*---
**Omnia H. Zayed*
Re: Solr - Proximity search using exact number of words apart
Posted by Savvas Andreas Moysidis <sa...@gmail.com>.
Hi,
If you are using the dismax/edismax query parser you can maybe give
query slops a try?
http://wiki.apache.org/solr/SolrRelevancyFAQ#How_can_I_search_for_one_term_near_another_term_.28say.2C_.22batman.22_and_.22movie.22.29
On 16 September 2012 10:23, Omnia Zayed <om...@gmail.com> wrote:
> Hi;
>
> I am working with apache-solr-3.6.0 on windows machine. I would like to
> search for two words with certain number of words apart (No more than this
> number). For example: Consider the following phrases, I would like to
> search for Daisy & exam with no more than 2 words apart.
>
> Daisy has exam
> Daisy has an exam
> Daisy has a math exam
> Daisy has a difficult math exam
>
> I searched for such thing and I tried Term Proximity.
>
> http://localhost:8983/solr/select/?q="Daisy
> exam"~2&version=2.2&start=0&rows=10&indent=on&debugQuery=true
>
> The result that I need should be the phrase: Daisy has an exam. But using
> the above criteria, the result was the last 3 phrase.
>
> So any ideas to use an exact number of words apart?
>
>
> *---
> **Omnia H. Zayed*
Re: Solr - Proximity search using exact number of words apart
Posted by Jack Krupansky <ja...@basetechnology.com>.
A simple question first: Are "has" and "a" in your stop words file and are
you filtering out stop words on both query and index time? If so,
Solr/Lucene will treat "Daisy has a difficult math exam" as "Daisy difficult
math exam" which would match the "Daisy exam"~2 query.
-- Jack Krupansky
-----Original Message-----
From: Omnia Zayed
Sent: Sunday, September 16, 2012 5:23 AM
To: solr-user@lucene.apache.org
Subject: Solr - Proximity search using exact number of words apart
Hi;
I am working with apache-solr-3.6.0 on windows machine. I would like to
search for two words with certain number of words apart (No more than this
number). For example: Consider the following phrases, I would like to
search for Daisy & exam with no more than 2 words apart.
Daisy has exam
Daisy has an exam
Daisy has a math exam
Daisy has a difficult math exam
I searched for such thing and I tried Term Proximity.
http://localhost:8983/solr/select/?q="Daisy
exam"~2&version=2.2&start=0&rows=10&indent=on&debugQuery=true
The result that I need should be the phrase: Daisy has an exam. But using
the above criteria, the result was the last 3 phrase.
So any ideas to use an exact number of words apart?
*---
**Omnia H. Zayed*
Re: Solr - Proximity search using exact number of words apart
Posted by Walter Underwood <wu...@wunderwood.org>.
Should be able to search for the two words within X tokens AND NOT the two words within X-1 tokens. It might not even be slow.
wunder
On Sep 16, 2012, at 6:41 AM, Erick Erickson wrote:
> There's really nothing that I know of in Solr that does this, all the phrase
> slop stuff is there to express the idea "within X tokens" and will
> include all the shorter-interval type of documents.
>
> What's the use case here? Perhaps there's another way to approach it?
>
> Best
> Erick
>
> On Sun, Sep 16, 2012 at 5:23 AM, Omnia Zayed <om...@gmail.com> wrote:
>> Hi;
>>
>> I am working with apache-solr-3.6.0 on windows machine. I would like to
>> search for two words with certain number of words apart (No more than this
>> number). For example: Consider the following phrases, I would like to
>> search for Daisy & exam with no more than 2 words apart.
>>
>> Daisy has exam
>> Daisy has an exam
>> Daisy has a math exam
>> Daisy has a difficult math exam
>>
>> I searched for such thing and I tried Term Proximity.
>>
>> http://localhost:8983/solr/select/?q="Daisy
>> exam"~2&version=2.2&start=0&rows=10&indent=on&debugQuery=true
>>
>> The result that I need should be the phrase: Daisy has an exam. But using
>> the above criteria, the result was the last 3 phrase.
>>
>> So any ideas to use an exact number of words apart?
>>
>>
>> *---
>> **Omnia H. Zayed*
--
Walter Underwood
wunder@wunderwood.org
Re: Solr - Proximity search using exact number of words apart
Posted by Erick Erickson <er...@gmail.com>.
There's really nothing that I know of in Solr that does this, all the phrase
slop stuff is there to express the idea "within X tokens" and will
include all the shorter-interval type of documents.
What's the use case here? Perhaps there's another way to approach it?
Best
Erick
On Sun, Sep 16, 2012 at 5:23 AM, Omnia Zayed <om...@gmail.com> wrote:
> Hi;
>
> I am working with apache-solr-3.6.0 on windows machine. I would like to
> search for two words with certain number of words apart (No more than this
> number). For example: Consider the following phrases, I would like to
> search for Daisy & exam with no more than 2 words apart.
>
> Daisy has exam
> Daisy has an exam
> Daisy has a math exam
> Daisy has a difficult math exam
>
> I searched for such thing and I tried Term Proximity.
>
> http://localhost:8983/solr/select/?q="Daisy
> exam"~2&version=2.2&start=0&rows=10&indent=on&debugQuery=true
>
> The result that I need should be the phrase: Daisy has an exam. But using
> the above criteria, the result was the last 3 phrase.
>
> So any ideas to use an exact number of words apart?
>
>
> *---
> **Omnia H. Zayed*