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 Sebastian Saip <se...@gmail.com> on 2013/02/20 00:03:13 UTC
difference between q=field:"value1 value2" and q=field:value1 value2
Hi there,
I'm implementing a didYouMean in Java, which will returns collated terms.
Unfortunately, the only way (?) to retrieve those collated terms is by
"getCollationQueryString()", which will look something like this:
input for my query: atricle test
my final query: (field1:atricle test OR field2:atricle test OR ...)
getCollationQueryString: (field1:article test OR field2:article test OR ...
)
So far so good, I could just regex/match the "article test" out of it, but
my queries are not always the same (e.g. field1 or field2 are not searched
on everytime), so this requires a bit of work..
Therefore (and to come to my actual problem), I thought I'll just add
double-quotes around my searchterm, making it easier to extract the
corrected terms from the getCollationQueryString():
input for my query: atricle test
my final query: (field1:"atricle test" OR field2:"atricle test" OR ...)
getCollationQueryString: (field1:"article test" OR field2:"article test" OR
... )
---
Now the problem is, that I'm getting different results for:
>> (field1:article test OR field2:article test OR ... )
and
>> (field1:"article test" OR field2:"article test" OR ... )
All fields are of "text_en" and I want to have partial matches (so the
terms don't have to be consecutive)
Is there any way (parameter or whatever) to get this bevahiour although I'm
using double-quotes around it?
Or even easier/better .. Is there any way to get the collation term
("article test"), rather than the whole query?
Cheers!
Re: difference between q=field:"value1 value2" and q=field:value1 value2
Posted by Sebastian Saip <se...@gmail.com>.
I see.. this is exactly as lucene then.
Thanks Erick!
On 20 February 2013 03:04, Erick Erickson <er...@gmail.com> wrote:
> Of course you are <G>....
> (field1:article test OR field2:article test OR ...)
>
> parses as
>
> field1:article defaultfield:test OR field2:article defaultfield:test
> probably with an implied SHOULD
>
> whereas
> (field1:"article test" OR field2:"article test" OR ... )
> is parsing as phrase queries. That is, test must appear immediately after
> article in either field1 ro field2....
>
> Best
> Erick
>
>
> On Tue, Feb 19, 2013 at 6:03 PM, Sebastian Saip <sebastian.saip@gmail.com
> >wrote:
>
> > Hi there,
> >
> > I'm implementing a didYouMean in Java, which will returns collated terms.
> > Unfortunately, the only way (?) to retrieve those collated terms is by
> > "getCollationQueryString()", which will look something like this:
> > input for my query: atricle test
> > my final query: (field1:atricle test OR field2:atricle test OR ...)
> > getCollationQueryString: (field1:article test OR field2:article test OR
> ...
> > )
> >
> > So far so good, I could just regex/match the "article test" out of it,
> but
> > my queries are not always the same (e.g. field1 or field2 are not
> searched
> > on everytime), so this requires a bit of work..
> >
> >
> > Therefore (and to come to my actual problem), I thought I'll just add
> > double-quotes around my searchterm, making it easier to extract the
> > corrected terms from the getCollationQueryString():
> >
> > input for my query: atricle test
> > my final query: (field1:"atricle test" OR field2:"atricle test" OR ...)
> > getCollationQueryString: (field1:"article test" OR field2:"article test"
> OR
> > ... )
> >
> > ---
> >
> > Now the problem is, that I'm getting different results for:
> > >> (field1:article test OR field2:article test OR ... )
> > and
> > >> (field1:"article test" OR field2:"article test" OR ... )
> >
> > All fields are of "text_en" and I want to have partial matches (so the
> > terms don't have to be consecutive)
> >
> > Is there any way (parameter or whatever) to get this bevahiour although
> I'm
> > using double-quotes around it?
> > Or even easier/better .. Is there any way to get the collation term
> > ("article test"), rather than the whole query?
> >
> > Cheers!
> >
>
Re: difference between q=field:"value1 value2" and q=field:value1 value2
Posted by Erick Erickson <er...@gmail.com>.
Of course you are <G>....
(field1:article test OR field2:article test OR ...)
parses as
field1:article defaultfield:test OR field2:article defaultfield:test
probably with an implied SHOULD
whereas
(field1:"article test" OR field2:"article test" OR ... )
is parsing as phrase queries. That is, test must appear immediately after
article in either field1 ro field2....
Best
Erick
On Tue, Feb 19, 2013 at 6:03 PM, Sebastian Saip <se...@gmail.com>wrote:
> Hi there,
>
> I'm implementing a didYouMean in Java, which will returns collated terms.
> Unfortunately, the only way (?) to retrieve those collated terms is by
> "getCollationQueryString()", which will look something like this:
> input for my query: atricle test
> my final query: (field1:atricle test OR field2:atricle test OR ...)
> getCollationQueryString: (field1:article test OR field2:article test OR ...
> )
>
> So far so good, I could just regex/match the "article test" out of it, but
> my queries are not always the same (e.g. field1 or field2 are not searched
> on everytime), so this requires a bit of work..
>
>
> Therefore (and to come to my actual problem), I thought I'll just add
> double-quotes around my searchterm, making it easier to extract the
> corrected terms from the getCollationQueryString():
>
> input for my query: atricle test
> my final query: (field1:"atricle test" OR field2:"atricle test" OR ...)
> getCollationQueryString: (field1:"article test" OR field2:"article test" OR
> ... )
>
> ---
>
> Now the problem is, that I'm getting different results for:
> >> (field1:article test OR field2:article test OR ... )
> and
> >> (field1:"article test" OR field2:"article test" OR ... )
>
> All fields are of "text_en" and I want to have partial matches (so the
> terms don't have to be consecutive)
>
> Is there any way (parameter or whatever) to get this bevahiour although I'm
> using double-quotes around it?
> Or even easier/better .. Is there any way to get the collation term
> ("article test"), rather than the whole query?
>
> Cheers!
>