Proximity Search

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Proximity Search

Vijay Bhoomireddy
Hi,

I have created my index with the default configurations. Now I am trying to
use proximity search. However, I am bit not sure on the results and where
its going wrong.

For example, I want to find two phrases "this is phrase one" and another
phrase "this is the second phrase" with not more than a proximity distance
of 4 words in between them. The query syntax I am using is "(\"this is
phrase one\") (\"this is the second phrase\")"~4

However, the results I am getting are similar to OR operation. Can anyone
please let me know whether the syntax is correct?

Also, please let me know how to implement proximity search using SolrJ
Query API?

Thanks & Regards
Vijay

--
The contents of this e-mail are confidential and for the exclusive use of
the intended recipient. If you receive this e-mail in error please delete
it from your system immediately and notify us either by e-mail or
telephone. You should not copy, forward or otherwise disclose the content
of the e-mail. The views expressed in this communication may not
necessarily be the view held by WHISHWORKS.
Reply | Threaded
Open this post in threaded view
|

Re: Proximity Search

Vijay Bhoomireddy
I just tried with simple proximity search like "word1 word2" ~3 and it is
not working. Just wondering whether I have to make any configuration
changes to solrconfig.xml to make proximity search work?

Thanks
Vijay


On 30 April 2015 at 14:32, Vijaya Narayana Reddy Bhoomi Reddy <
[hidden email]> wrote:

> Hi,
>
> I have created my index with the default configurations. Now I am trying
> to use proximity search. However, I am bit not sure on the results and
> where its going wrong.
>
> For example, I want to find two phrases "this is phrase one" and another
> phrase "this is the second phrase" with not more than a proximity distance
> of 4 words in between them. The query syntax I am using is "(\"this is
> phrase one\") (\"this is the second phrase\")"~4
>
> However, the results I am getting are similar to OR operation. Can anyone
> please let me know whether the syntax is correct?
>
> Also, please let me know how to implement proximity search using SolrJ
> Query API?
>
> Thanks & Regards
> Vijay
>

--
The contents of this e-mail are confidential and for the exclusive use of
the intended recipient. If you receive this e-mail in error please delete
it from your system immediately and notify us either by e-mail or
telephone. You should not copy, forward or otherwise disclose the content
of the e-mail. The views expressed in this communication may not
necessarily be the view held by WHISHWORKS.
Reply | Threaded
Open this post in threaded view
|

Re: Proximity Search

Rajani Maski
Hi Vijaya,

I just quickly tried proximity search with the example set shipped with
solr 5 and it looked like working for me.
Perhaps, what you could is debug the query by enabling debugQuery=true.


Here are the steps that I tried.(Assuming you are on Solr 5. Though this
term proximity functionality should work for 4.x versions too)

1. Go to solr5.0 downloaded folder and navigate to bin.

Rajanis-MacBook-Pro:solr-5.0.0 rajanishivarajmaski$ bin/solr -e techproducts

2. Execute the below query. The field "name" has value "Test with some
GB18030 encoded characters" and you search for  name: "Test  GB18030"~10

http://localhost:8983/solr/techproducts/select?q=name: "Test
 GB18030"~10&wt=json&indent=true

Image : http://postimg.org/image/bjkbufsph/


On Thu, Apr 30, 2015 at 7:14 PM, Vijaya Narayana Reddy Bhoomi Reddy <
[hidden email]> wrote:

> I just tried with simple proximity search like "word1 word2" ~3 and it is
> not working. Just wondering whether I have to make any configuration
> changes to solrconfig.xml to make proximity search work?
>
> Thanks
> Vijay
>
>
> On 30 April 2015 at 14:32, Vijaya Narayana Reddy Bhoomi Reddy <
> [hidden email]> wrote:
>
> > Hi,
> >
> > I have created my index with the default configurations. Now I am trying
> > to use proximity search. However, I am bit not sure on the results and
> > where its going wrong.
> >
> > For example, I want to find two phrases "this is phrase one" and another
> > phrase "this is the second phrase" with not more than a proximity
> distance
> > of 4 words in between them. The query syntax I am using is "(\"this is
> > phrase one\") (\"this is the second phrase\")"~4
> >
> > However, the results I am getting are similar to OR operation. Can anyone
> > please let me know whether the syntax is correct?
> >
> > Also, please let me know how to implement proximity search using SolrJ
> > Query API?
> >
> > Thanks & Regards
> > Vijay
> >
>
> --
> The contents of this e-mail are confidential and for the exclusive use of
> the intended recipient. If you receive this e-mail in error please delete
> it from your system immediately and notify us either by e-mail or
> telephone. You should not copy, forward or otherwise disclose the content
> of the e-mail. The views expressed in this communication may not
> necessarily be the view held by WHISHWORKS.
>
Reply | Threaded
Open this post in threaded view
|

Re: Proximity Search

Vijay Bhoomireddy
Thanks Rajani.

I could get proximity search work for individual words. However, still
could not make it work for two phrases, each containing more than a word.
Also, results seem to be unexpected for proximity queries with wildcards.



Thanks & Regards
Vijay


On 30 April 2015 at 15:19, Rajani Maski <[hidden email]> wrote:

> Hi Vijaya,
>
> I just quickly tried proximity search with the example set shipped with
> solr 5 and it looked like working for me.
> Perhaps, what you could is debug the query by enabling debugQuery=true.
>
>
> Here are the steps that I tried.(Assuming you are on Solr 5. Though this
> term proximity functionality should work for 4.x versions too)
>
> 1. Go to solr5.0 downloaded folder and navigate to bin.
>
> Rajanis-MacBook-Pro:solr-5.0.0 rajanishivarajmaski$ bin/solr -e
> techproducts
>
> 2. Execute the below query. The field "name" has value "Test with some
> GB18030 encoded characters" and you search for  name: "Test  GB18030"~10
>
> http://localhost:8983/solr/techproducts/select?q=name: "Test
>  GB18030"~10&wt=json&indent=true
>
> Image : http://postimg.org/image/bjkbufsph/
>
>
> On Thu, Apr 30, 2015 at 7:14 PM, Vijaya Narayana Reddy Bhoomi Reddy <
> [hidden email]> wrote:
>
> > I just tried with simple proximity search like "word1 word2" ~3 and it is
> > not working. Just wondering whether I have to make any configuration
> > changes to solrconfig.xml to make proximity search work?
> >
> > Thanks
> > Vijay
> >
> >
> > On 30 April 2015 at 14:32, Vijaya Narayana Reddy Bhoomi Reddy <
> > [hidden email]> wrote:
> >
> > > Hi,
> > >
> > > I have created my index with the default configurations. Now I am
> trying
> > > to use proximity search. However, I am bit not sure on the results and
> > > where its going wrong.
> > >
> > > For example, I want to find two phrases "this is phrase one" and
> another
> > > phrase "this is the second phrase" with not more than a proximity
> > distance
> > > of 4 words in between them. The query syntax I am using is "(\"this is
> > > phrase one\") (\"this is the second phrase\")"~4
> > >
> > > However, the results I am getting are similar to OR operation. Can
> anyone
> > > please let me know whether the syntax is correct?
> > >
> > > Also, please let me know how to implement proximity search using SolrJ
> > > Query API?
> > >
> > > Thanks & Regards
> > > Vijay
> > >
> >
> > --
> > The contents of this e-mail are confidential and for the exclusive use of
> > the intended recipient. If you receive this e-mail in error please delete
> > it from your system immediately and notify us either by e-mail or
> > telephone. You should not copy, forward or otherwise disclose the content
> > of the e-mail. The views expressed in this communication may not
> > necessarily be the view held by WHISHWORKS.
> >
>

--
The contents of this e-mail are confidential and for the exclusive use of
the intended recipient. If you receive this e-mail in error please delete
it from your system immediately and notify us either by e-mail or
telephone. You should not copy, forward or otherwise disclose the content
of the e-mail. The views expressed in this communication may not
necessarily be the view held by WHISHWORKS.
Reply | Threaded
Open this post in threaded view
|

RE: Proximity Search

Allison, Timothy B.
You'll need the ComplexPhraseQueryParser [1] to handle multiterm (wildcard/fuzzy/regex) terms in proximity.  Beware, though, that that does not perform analysis on fuzzy/wildcard IIRC).

The SurroundQueryParser can probably do both phrase near phrase and multiterm within proximity.  Same warning applies with analysis.

See also the SpanQueryParser (LUCENE-5205/SOLR-5410), which has standalones jars for Lucene 4.10.x [2]



Best,

           Tim

[1] https://cwiki.apache.org/confluence/display/solr/Other+Parsers#OtherParsers-ComplexPhraseQueryParser

[2] https://github.com/tballison/lucene-addons
-----Original Message-----
From: Vijaya Narayana Reddy Bhoomi Reddy [mailto:[hidden email]]
Sent: Thursday, April 30, 2015 1:05 PM
To: [hidden email]
Subject: Re: Proximity Search

Thanks Rajani.

I could get proximity search work for individual words. However, still
could not make it work for two phrases, each containing more than a word.
Also, results seem to be unexpected for proximity queries with wildcards.



Thanks & Regards
Vijay


On 30 April 2015 at 15:19, Rajani Maski <[hidden email]> wrote:

> Hi Vijaya,
>
> I just quickly tried proximity search with the example set shipped with
> solr 5 and it looked like working for me.
> Perhaps, what you could is debug the query by enabling debugQuery=true.
>
>
> Here are the steps that I tried.(Assuming you are on Solr 5. Though this
> term proximity functionality should work for 4.x versions too)
>
> 1. Go to solr5.0 downloaded folder and navigate to bin.
>
> Rajanis-MacBook-Pro:solr-5.0.0 rajanishivarajmaski$ bin/solr -e
> techproducts
>
> 2. Execute the below query. The field "name" has value "Test with some
> GB18030 encoded characters" and you search for  name: "Test  GB18030"~10
>
> http://localhost:8983/solr/techproducts/select?q=name: "Test
>  GB18030"~10&wt=json&indent=true
>
> Image : http://postimg.org/image/bjkbufsph/
>
>
> On Thu, Apr 30, 2015 at 7:14 PM, Vijaya Narayana Reddy Bhoomi Reddy <
> [hidden email]> wrote:
>
> > I just tried with simple proximity search like "word1 word2" ~3 and it is
> > not working. Just wondering whether I have to make any configuration
> > changes to solrconfig.xml to make proximity search work?
> >
> > Thanks
> > Vijay
> >
> >
> > On 30 April 2015 at 14:32, Vijaya Narayana Reddy Bhoomi Reddy <
> > [hidden email]> wrote:
> >
> > > Hi,
> > >
> > > I have created my index with the default configurations. Now I am
> trying
> > > to use proximity search. However, I am bit not sure on the results and
> > > where its going wrong.
> > >
> > > For example, I want to find two phrases "this is phrase one" and
> another
> > > phrase "this is the second phrase" with not more than a proximity
> > distance
> > > of 4 words in between them. The query syntax I am using is "(\"this is
> > > phrase one\") (\"this is the second phrase\")"~4
> > >
> > > However, the results I am getting are similar to OR operation. Can
> anyone
> > > please let me know whether the syntax is correct?
> > >
> > > Also, please let me know how to implement proximity search using SolrJ
> > > Query API?
> > >
> > > Thanks & Regards
> > > Vijay
> > >
> >
> > --
> > The contents of this e-mail are confidential and for the exclusive use of
> > the intended recipient. If you receive this e-mail in error please delete
> > it from your system immediately and notify us either by e-mail or
> > telephone. You should not copy, forward or otherwise disclose the content
> > of the e-mail. The views expressed in this communication may not
> > necessarily be the view held by WHISHWORKS.
> >
>

--
The contents of this e-mail are confidential and for the exclusive use of
the intended recipient. If you receive this e-mail in error please delete
it from your system immediately and notify us either by e-mail or
telephone. You should not copy, forward or otherwise disclose the content
of the e-mail. The views expressed in this communication may not
necessarily be the view held by WHISHWORKS.
Reply | Threaded
Open this post in threaded view
|

Re: Proximity Search

Vijay Bhoomireddy
Thanks Tim for the information. I shall have a look at them.


Thanks & Regards
Vijay


On 30 April 2015 at 18:13, Allison, Timothy B. <[hidden email]> wrote:

> You'll need the ComplexPhraseQueryParser [1] to handle multiterm
> (wildcard/fuzzy/regex) terms in proximity.  Beware, though, that that does
> not perform analysis on fuzzy/wildcard IIRC).
>
> The SurroundQueryParser can probably do both phrase near phrase and
> multiterm within proximity.  Same warning applies with analysis.
>
> See also the SpanQueryParser (LUCENE-5205/SOLR-5410), which has
> standalones jars for Lucene 4.10.x [2]
>
>
>
> Best,
>
>            Tim
>
> [1]
> https://cwiki.apache.org/confluence/display/solr/Other+Parsers#OtherParsers-ComplexPhraseQueryParser
>
> [2] https://github.com/tballison/lucene-addons
> -----Original Message-----
> From: Vijaya Narayana Reddy Bhoomi Reddy [mailto:
> [hidden email]]
> Sent: Thursday, April 30, 2015 1:05 PM
> To: [hidden email]
> Subject: Re: Proximity Search
>
> Thanks Rajani.
>
> I could get proximity search work for individual words. However, still
> could not make it work for two phrases, each containing more than a word.
> Also, results seem to be unexpected for proximity queries with wildcards.
>
>
>
> Thanks & Regards
> Vijay
>
>
> On 30 April 2015 at 15:19, Rajani Maski <[hidden email]>
> wrote:
>
> > Hi Vijaya,
> >
> > I just quickly tried proximity search with the example set shipped with
> > solr 5 and it looked like working for me.
> > Perhaps, what you could is debug the query by enabling debugQuery=true.
> >
> >
> > Here are the steps that I tried.(Assuming you are on Solr 5. Though this
> > term proximity functionality should work for 4.x versions too)
> >
> > 1. Go to solr5.0 downloaded folder and navigate to bin.
> >
> > Rajanis-MacBook-Pro:solr-5.0.0 rajanishivarajmaski$ bin/solr -e
> > techproducts
> >
> > 2. Execute the below query. The field "name" has value "Test with some
> > GB18030 encoded characters" and you search for  name: "Test  GB18030"~10
> >
> > http://localhost:8983/solr/techproducts/select?q=name: "Test
> >  GB18030"~10&wt=json&indent=true
> >
> > Image : http://postimg.org/image/bjkbufsph/
> >
> >
> > On Thu, Apr 30, 2015 at 7:14 PM, Vijaya Narayana Reddy Bhoomi Reddy <
> > [hidden email]> wrote:
> >
> > > I just tried with simple proximity search like "word1 word2" ~3 and it
> is
> > > not working. Just wondering whether I have to make any configuration
> > > changes to solrconfig.xml to make proximity search work?
> > >
> > > Thanks
> > > Vijay
> > >
> > >
> > > On 30 April 2015 at 14:32, Vijaya Narayana Reddy Bhoomi Reddy <
> > > [hidden email]> wrote:
> > >
> > > > Hi,
> > > >
> > > > I have created my index with the default configurations. Now I am
> > trying
> > > > to use proximity search. However, I am bit not sure on the results
> and
> > > > where its going wrong.
> > > >
> > > > For example, I want to find two phrases "this is phrase one" and
> > another
> > > > phrase "this is the second phrase" with not more than a proximity
> > > distance
> > > > of 4 words in between them. The query syntax I am using is "(\"this
> is
> > > > phrase one\") (\"this is the second phrase\")"~4
> > > >
> > > > However, the results I am getting are similar to OR operation. Can
> > anyone
> > > > please let me know whether the syntax is correct?
> > > >
> > > > Also, please let me know how to implement proximity search using
> SolrJ
> > > > Query API?
> > > >
> > > > Thanks & Regards
> > > > Vijay
> > > >
> > >
> > > --
> > > The contents of this e-mail are confidential and for the exclusive use
> of
> > > the intended recipient. If you receive this e-mail in error please
> delete
> > > it from your system immediately and notify us either by e-mail or
> > > telephone. You should not copy, forward or otherwise disclose the
> content
> > > of the e-mail. The views expressed in this communication may not
> > > necessarily be the view held by WHISHWORKS.
> > >
> >
>
> --
> The contents of this e-mail are confidential and for the exclusive use of
> the intended recipient. If you receive this e-mail in error please delete
> it from your system immediately and notify us either by e-mail or
> telephone. You should not copy, forward or otherwise disclose the content
> of the e-mail. The views expressed in this communication may not
> necessarily be the view held by WHISHWORKS.
>

--
The contents of this e-mail are confidential and for the exclusive use of
the intended recipient. If you receive this e-mail in error please delete
it from your system immediately and notify us either by e-mail or
telephone. You should not copy, forward or otherwise disclose the content
of the e-mail. The views expressed in this communication may not
necessarily be the view held by WHISHWORKS.
Reply | Threaded
Open this post in threaded view
|

Re: Proximity Search

Sujit Pal
In reply to this post by Vijay Bhoomireddy
Hi Vijay,

I haven't tried this myself, but perhaps you could build the two phrases as
PhraseQueries and connect them up with a SpanQuery? Something like this
(using your original example).

PhraseQuery p1 = new PhraseQuery();
for (String word : "this is phrase 1".split()) {
....p1.add(new Term("my_field", word));
}
PhraseQuery p2 = new PhraseQuery();
for (String word : "this is the second phrase".split()) {
....p2.add(new Term("my_field", word));
}
SpanQuery q = new SpanNearQuery(new SpanQuery[] {p1, p2}, 4, true);

-sujit


On Thu, Apr 30, 2015 at 10:04 AM, Vijaya Narayana Reddy Bhoomi Reddy <
[hidden email]> wrote:

> Thanks Rajani.
>
> I could get proximity search work for individual words. However, still
> could not make it work for two phrases, each containing more than a word.
> Also, results seem to be unexpected for proximity queries with wildcards.
>
>
>
> Thanks & Regards
> Vijay
>
>
> On 30 April 2015 at 15:19, Rajani Maski <[hidden email]>
> wrote:
>
> > Hi Vijaya,
> >
> > I just quickly tried proximity search with the example set shipped with
> > solr 5 and it looked like working for me.
> > Perhaps, what you could is debug the query by enabling debugQuery=true.
> >
> >
> > Here are the steps that I tried.(Assuming you are on Solr 5. Though this
> > term proximity functionality should work for 4.x versions too)
> >
> > 1. Go to solr5.0 downloaded folder and navigate to bin.
> >
> > Rajanis-MacBook-Pro:solr-5.0.0 rajanishivarajmaski$ bin/solr -e
> > techproducts
> >
> > 2. Execute the below query. The field "name" has value "Test with some
> > GB18030 encoded characters" and you search for  name: "Test  GB18030"~10
> >
> > http://localhost:8983/solr/techproducts/select?q=name: "Test
> >  GB18030"~10&wt=json&indent=true
> >
> > Image : http://postimg.org/image/bjkbufsph/
> >
> >
> > On Thu, Apr 30, 2015 at 7:14 PM, Vijaya Narayana Reddy Bhoomi Reddy <
> > [hidden email]> wrote:
> >
> > > I just tried with simple proximity search like "word1 word2" ~3 and it
> is
> > > not working. Just wondering whether I have to make any configuration
> > > changes to solrconfig.xml to make proximity search work?
> > >
> > > Thanks
> > > Vijay
> > >
> > >
> > > On 30 April 2015 at 14:32, Vijaya Narayana Reddy Bhoomi Reddy <
> > > [hidden email]> wrote:
> > >
> > > > Hi,
> > > >
> > > > I have created my index with the default configurations. Now I am
> > trying
> > > > to use proximity search. However, I am bit not sure on the results
> and
> > > > where its going wrong.
> > > >
> > > > For example, I want to find two phrases "this is phrase one" and
> > another
> > > > phrase "this is the second phrase" with not more than a proximity
> > > distance
> > > > of 4 words in between them. The query syntax I am using is "(\"this
> is
> > > > phrase one\") (\"this is the second phrase\")"~4
> > > >
> > > > However, the results I am getting are similar to OR operation. Can
> > anyone
> > > > please let me know whether the syntax is correct?
> > > >
> > > > Also, please let me know how to implement proximity search using
> SolrJ
> > > > Query API?
> > > >
> > > > Thanks & Regards
> > > > Vijay
> > > >
> > >
> > > --
> > > The contents of this e-mail are confidential and for the exclusive use
> of
> > > the intended recipient. If you receive this e-mail in error please
> delete
> > > it from your system immediately and notify us either by e-mail or
> > > telephone. You should not copy, forward or otherwise disclose the
> content
> > > of the e-mail. The views expressed in this communication may not
> > > necessarily be the view held by WHISHWORKS.
> > >
> >
>
> --
> The contents of this e-mail are confidential and for the exclusive use of
> the intended recipient. If you receive this e-mail in error please delete
> it from your system immediately and notify us either by e-mail or
> telephone. You should not copy, forward or otherwise disclose the content
> of the e-mail. The views expressed in this communication may not
> necessarily be the view held by WHISHWORKS.
>
Reply | Threaded
Open this post in threaded view
|

Re: Proximity Search

Dmitry Kan-2
Hi,

If adding PhraseQuery objects does not work, then using SpanNearQuery with
slop 0 and order true for p1 and p2 should work (tried).

Dmitry

On Thu, Apr 30, 2015 at 8:43 PM, Sujit Pal <[hidden email]> wrote:

> Hi Vijay,
>
> I haven't tried this myself, but perhaps you could build the two phrases as
> PhraseQueries and connect them up with a SpanQuery? Something like this
> (using your original example).
>
> PhraseQuery p1 = new PhraseQuery();
> for (String word : "this is phrase 1".split()) {
> ....p1.add(new Term("my_field", word));
> }
> PhraseQuery p2 = new PhraseQuery();
> for (String word : "this is the second phrase".split()) {
> ....p2.add(new Term("my_field", word));
> }
> SpanQuery q = new SpanNearQuery(new SpanQuery[] {p1, p2}, 4, true);
>
> -sujit
>
>
> On Thu, Apr 30, 2015 at 10:04 AM, Vijaya Narayana Reddy Bhoomi Reddy <
> [hidden email]> wrote:
>
> > Thanks Rajani.
> >
> > I could get proximity search work for individual words. However, still
> > could not make it work for two phrases, each containing more than a word.
> > Also, results seem to be unexpected for proximity queries with wildcards.
> >
> >
> >
> > Thanks & Regards
> > Vijay
> >
> >
> > On 30 April 2015 at 15:19, Rajani Maski <[hidden email]>
> > wrote:
> >
> > > Hi Vijaya,
> > >
> > > I just quickly tried proximity search with the example set shipped with
> > > solr 5 and it looked like working for me.
> > > Perhaps, what you could is debug the query by enabling debugQuery=true.
> > >
> > >
> > > Here are the steps that I tried.(Assuming you are on Solr 5. Though
> this
> > > term proximity functionality should work for 4.x versions too)
> > >
> > > 1. Go to solr5.0 downloaded folder and navigate to bin.
> > >
> > > Rajanis-MacBook-Pro:solr-5.0.0 rajanishivarajmaski$ bin/solr -e
> > > techproducts
> > >
> > > 2. Execute the below query. The field "name" has value "Test with some
> > > GB18030 encoded characters" and you search for  name: "Test
> GB18030"~10
> > >
> > > http://localhost:8983/solr/techproducts/select?q=name: "Test
> > >  GB18030"~10&wt=json&indent=true
> > >
> > > Image : http://postimg.org/image/bjkbufsph/
> > >
> > >
> > > On Thu, Apr 30, 2015 at 7:14 PM, Vijaya Narayana Reddy Bhoomi Reddy <
> > > [hidden email]> wrote:
> > >
> > > > I just tried with simple proximity search like "word1 word2" ~3 and
> it
> > is
> > > > not working. Just wondering whether I have to make any configuration
> > > > changes to solrconfig.xml to make proximity search work?
> > > >
> > > > Thanks
> > > > Vijay
> > > >
> > > >
> > > > On 30 April 2015 at 14:32, Vijaya Narayana Reddy Bhoomi Reddy <
> > > > [hidden email]> wrote:
> > > >
> > > > > Hi,
> > > > >
> > > > > I have created my index with the default configurations. Now I am
> > > trying
> > > > > to use proximity search. However, I am bit not sure on the results
> > and
> > > > > where its going wrong.
> > > > >
> > > > > For example, I want to find two phrases "this is phrase one" and
> > > another
> > > > > phrase "this is the second phrase" with not more than a proximity
> > > > distance
> > > > > of 4 words in between them. The query syntax I am using is "(\"this
> > is
> > > > > phrase one\") (\"this is the second phrase\")"~4
> > > > >
> > > > > However, the results I am getting are similar to OR operation. Can
> > > anyone
> > > > > please let me know whether the syntax is correct?
> > > > >
> > > > > Also, please let me know how to implement proximity search using
> > SolrJ
> > > > > Query API?
> > > > >
> > > > > Thanks & Regards
> > > > > Vijay
> > > > >
> > > >
> > > > --
> > > > The contents of this e-mail are confidential and for the exclusive
> use
> > of
> > > > the intended recipient. If you receive this e-mail in error please
> > delete
> > > > it from your system immediately and notify us either by e-mail or
> > > > telephone. You should not copy, forward or otherwise disclose the
> > content
> > > > of the e-mail. The views expressed in this communication may not
> > > > necessarily be the view held by WHISHWORKS.
> > > >
> > >
> >
> > --
> > The contents of this e-mail are confidential and for the exclusive use of
> > the intended recipient. If you receive this e-mail in error please delete
> > it from your system immediately and notify us either by e-mail or
> > telephone. You should not copy, forward or otherwise disclose the content
> > of the e-mail. The views expressed in this communication may not
> > necessarily be the view held by WHISHWORKS.
> >
>



--
Dmitry Kan
Luke Toolbox: http://github.com/DmitryKey/luke
Blog: http://dmitrykan.blogspot.com
Twitter: http://twitter.com/dmitrykan
SemanticAnalyzer: www.semanticanalyzer.info
Reply | Threaded
Open this post in threaded view
|

RE: Proximity Search

Vijay Bhoomireddy
Thanks All, I shall try out the options and see how the results are.

Thanks & Regards
Vijay

-----Original Message-----
From: Dmitry Kan [mailto:[hidden email]]
Sent: 30 April 2015 18:58
To: [hidden email]
Subject: Re: Proximity Search

Hi,

If adding PhraseQuery objects does not work, then using SpanNearQuery with slop 0 and order true for p1 and p2 should work (tried).

Dmitry

On Thu, Apr 30, 2015 at 8:43 PM, Sujit Pal <[hidden email]> wrote:

> Hi Vijay,
>
> I haven't tried this myself, but perhaps you could build the two
> phrases as PhraseQueries and connect them up with a SpanQuery?
> Something like this (using your original example).
>
> PhraseQuery p1 = new PhraseQuery();
> for (String word : "this is phrase 1".split()) { ....p1.add(new
> Term("my_field", word)); } PhraseQuery p2 = new PhraseQuery(); for
> (String word : "this is the second phrase".split()) { ....p2.add(new
> Term("my_field", word)); } SpanQuery q = new SpanNearQuery(new
> SpanQuery[] {p1, p2}, 4, true);
>
> -sujit
>
>
> On Thu, Apr 30, 2015 at 10:04 AM, Vijaya Narayana Reddy Bhoomi Reddy <
> [hidden email]> wrote:
>
> > Thanks Rajani.
> >
> > I could get proximity search work for individual words. However,
> > still could not make it work for two phrases, each containing more than a word.
> > Also, results seem to be unexpected for proximity queries with wildcards.
> >
> >
> >
> > Thanks & Regards
> > Vijay
> >
> >
> > On 30 April 2015 at 15:19, Rajani Maski
> > <[hidden email]>
> > wrote:
> >
> > > Hi Vijaya,
> > >
> > > I just quickly tried proximity search with the example set shipped
> > > with solr 5 and it looked like working for me.
> > > Perhaps, what you could is debug the query by enabling debugQuery=true.
> > >
> > >
> > > Here are the steps that I tried.(Assuming you are on Solr 5.
> > > Though
> this
> > > term proximity functionality should work for 4.x versions too)
> > >
> > > 1. Go to solr5.0 downloaded folder and navigate to bin.
> > >
> > > Rajanis-MacBook-Pro:solr-5.0.0 rajanishivarajmaski$ bin/solr -e
> > > techproducts
> > >
> > > 2. Execute the below query. The field "name" has value "Test with
> > > some
> > > GB18030 encoded characters" and you search for  name: "Test
> GB18030"~10
> > >
> > > http://localhost:8983/solr/techproducts/select?q=name: "Test  
> > > GB18030"~10&wt=json&indent=true
> > >
> > > Image : http://postimg.org/image/bjkbufsph/
> > >
> > >
> > > On Thu, Apr 30, 2015 at 7:14 PM, Vijaya Narayana Reddy Bhoomi
> > > Reddy < [hidden email]> wrote:
> > >
> > > > I just tried with simple proximity search like "word1 word2" ~3
> > > > and
> it
> > is
> > > > not working. Just wondering whether I have to make any
> > > > configuration changes to solrconfig.xml to make proximity search work?
> > > >
> > > > Thanks
> > > > Vijay
> > > >
> > > >
> > > > On 30 April 2015 at 14:32, Vijaya Narayana Reddy Bhoomi Reddy <
> > > > [hidden email]> wrote:
> > > >
> > > > > Hi,
> > > > >
> > > > > I have created my index with the default configurations. Now I
> > > > > am
> > > trying
> > > > > to use proximity search. However, I am bit not sure on the
> > > > > results
> > and
> > > > > where its going wrong.
> > > > >
> > > > > For example, I want to find two phrases "this is phrase one"
> > > > > and
> > > another
> > > > > phrase "this is the second phrase" with not more than a
> > > > > proximity
> > > > distance
> > > > > of 4 words in between them. The query syntax I am using is
> > > > > "(\"this
> > is
> > > > > phrase one\") (\"this is the second phrase\")"~4
> > > > >
> > > > > However, the results I am getting are similar to OR operation.
> > > > > Can
> > > anyone
> > > > > please let me know whether the syntax is correct?
> > > > >
> > > > > Also, please let me know how to implement proximity search
> > > > > using
> > SolrJ
> > > > > Query API?
> > > > >
> > > > > Thanks & Regards
> > > > > Vijay
> > > > >
> > > >
> > > > --
> > > > The contents of this e-mail are confidential and for the
> > > > exclusive
> use
> > of
> > > > the intended recipient. If you receive this e-mail in error
> > > > please
> > delete
> > > > it from your system immediately and notify us either by e-mail
> > > > or telephone. You should not copy, forward or otherwise disclose
> > > > the
> > content
> > > > of the e-mail. The views expressed in this communication may not
> > > > necessarily be the view held by WHISHWORKS.
> > > >
> > >
> >
> > --
> > The contents of this e-mail are confidential and for the exclusive
> > use of the intended recipient. If you receive this e-mail in error
> > please delete it from your system immediately and notify us either
> > by e-mail or telephone. You should not copy, forward or otherwise
> > disclose the content of the e-mail. The views expressed in this
> > communication may not necessarily be the view held by WHISHWORKS.
> >
>



--
Dmitry Kan
Luke Toolbox: http://github.com/DmitryKey/luke
Blog: http://dmitrykan.blogspot.com
Twitter: http://twitter.com/dmitrykan
SemanticAnalyzer: www.semanticanalyzer.info


--
The contents of this e-mail are confidential and for the exclusive use of
the intended recipient. If you receive this e-mail in error please delete
it from your system immediately and notify us either by e-mail or
telephone. You should not copy, forward or otherwise disclose the content
of the e-mail. The views expressed in this communication may not
necessarily be the view held by WHISHWORKS.