RE: Again : Query formulation help

2016-11-27 Thread Prasanna S. Dhakephalkar
Hi,

There was another thought in our internal group, I want your opinion will it
give me what I am looking for

In fq give following

{!frange l=2 u=4}sum(
exists(query({!v='code1:'})),
exists(query({!v='code2:'})),
exists(query({!v='code3:'})),
exists(query({!v='code4:'}))
)

Regards,

Prasanna

-Original Message-
From: Michael Kuhlmann [mailto:k...@solr.info] 
Sent: Thursday, November 24, 2016 4:29 PM
To: solr-user@lucene.apache.org
Subject: Re: Again : Query formulation help

Hi Prasanna,

there's no such filter out-of-the-box. It's similar to the mm parameter in
(e)dismax parser, but this only works for full text searches on the same
fields.

So you have to build the query on your own using all possible permutations:

fq=(code1: AND code2:) OR (code1: AND code3:) OR .

Of course, such a query can become huge when there are more than four
constraints.

Best,
Michael

Am 24.11.2016 um 11:40 schrieb Prasanna S. Dhakephalkar:
> Hi,
>
>  
>
> Need to formulate a distinctive field values query on 4 fields with 
> minimum match on 2 fields
>
>  
>
> I have 4 fields in my core
>
> Code 1 : Values between 1001 to 
>
> Code 2 : Values between 1001 to 
>
> Code 3 : Values between 1001 to 
>
> Code 4 : Values between 1001 to 
>
>  
>
> I want to formulate a query in following manner
>
>  
>
> Code 1 : 
>
> Code 2 : 
>
> Code 3 : 
>
> Code 4 : 
>
>  
>
> I want to formulate a query, given above parameters, the result should 
> contain documents where at least 2 of the above match.
>
>  
>
> Thanks and Regards,
>
>  
>
> Prasanna
>
>  
>
>




RE: Again : Query formulation help

2016-11-24 Thread Prasanna S. Dhakephalkar
:(

Thanks Michael.

Regards,

Prasanna.

-Original Message-
From: Michael Kuhlmann [mailto:k...@solr.info] 
Sent: Thursday, November 24, 2016 4:29 PM
To: solr-user@lucene.apache.org
Subject: Re: Again : Query formulation help

Hi Prasanna,

there's no such filter out-of-the-box. It's similar to the mm parameter in
(e)dismax parser, but this only works for full text searches on the same
fields.

So you have to build the query on your own using all possible permutations:

fq=(code1: AND code2:) OR (code1: AND code3:) OR .

Of course, such a query can become huge when there are more than four
constraints.

Best,
Michael

Am 24.11.2016 um 11:40 schrieb Prasanna S. Dhakephalkar:
> Hi,
>
>  
>
> Need to formulate a distinctive field values query on 4 fields with 
> minimum match on 2 fields
>
>  
>
> I have 4 fields in my core
>
> Code 1 : Values between 1001 to 
>
> Code 2 : Values between 1001 to 
>
> Code 3 : Values between 1001 to 
>
> Code 4 : Values between 1001 to 
>
>  
>
> I want to formulate a query in following manner
>
>  
>
> Code 1 : 
>
> Code 2 : 
>
> Code 3 : 
>
> Code 4 : 
>
>  
>
> I want to formulate a query, given above parameters, the result should 
> contain documents where at least 2 of the above match.
>
>  
>
> Thanks and Regards,
>
>  
>
> Prasanna
>
>  
>
>




Re: Again : Query formulation help

2016-11-24 Thread Michael Kuhlmann
Hi Prasanna,

there's no such filter out-of-the-box. It's similar to the mm parameter
in (e)dismax parser, but this only works for full text searches on the
same fields.

So you have to build the query on your own using all possible permutations:

fq=(code1: AND code2:) OR (code1: AND code3:) OR .

Of course, such a query can become huge when there are more than four
constraints.

Best,
Michael

Am 24.11.2016 um 11:40 schrieb Prasanna S. Dhakephalkar:
> Hi,
>
>  
>
> Need to formulate a distinctive field values query on 4 fields with minimum
> match on 2 fields
>
>  
>
> I have 4 fields in my core
>
> Code 1 : Values between 1001 to 
>
> Code 2 : Values between 1001 to 
>
> Code 3 : Values between 1001 to 
>
> Code 4 : Values between 1001 to 
>
>  
>
> I want to formulate a query in following manner
>
>  
>
> Code 1 : 
>
> Code 2 : 
>
> Code 3 : 
>
> Code 4 : 
>
>  
>
> I want to formulate a query, given above parameters, the result should
> contain documents where at least 2 of the above match.
>
>  
>
> Thanks and Regards,
>
>  
>
> Prasanna
>
>  
>
>



Again : Query formulation help

2016-11-24 Thread Prasanna S. Dhakephalkar
Hi,

 

Need to formulate a distinctive field values query on 4 fields with minimum
match on 2 fields

 

I have 4 fields in my core

Code 1 : Values between 1001 to 

Code 2 : Values between 1001 to 

Code 3 : Values between 1001 to 

Code 4 : Values between 1001 to 

 

I want to formulate a query in following manner

 

Code 1 : 

Code 2 : 

Code 3 : 

Code 4 : 

 

I want to formulate a query, given above parameters, the result should
contain documents where at least 2 of the above match.

 

Thanks and Regards,

 

Prasanna

 



Re: Query formulation help

2016-11-05 Thread Erick Erickson
Assuming these are numerics, use function queries I should think, see:
https://cwiki.apache.org/confluence/display/solr/Function+Queries#FunctionQueries-AvailableFunctions.
You'll see lt, gt, etc.

Best,
Erick

On Fri, Nov 4, 2016 at 11:23 PM, Prasanna S. Dhakephalkar
<prasann...@merajob.in> wrote:
> Hi John,
>
> I need to formulate a query where the both query variable are from document.
> Like get me all documents where var_1 >  var_2 (var_1 and var_2 both are in 
> document.)
>
> Thanks and Regards,
>
> Prasanna.
>
>
> -Original Message-
> From: John Bickerstaff [mailto:j...@johnbickerstaff.com]
> Sent: Wednesday, October 26, 2016 9:26 PM
> To: solr-user@lucene.apache.org
> Subject: Re: Query formulation help
>
> For what it's worth- you can do some complex stuff - including using document 
> fields as "variables" -- I did it on an Solr query endpoint (like
> /search) because I had stuff that was constant for every query.  The syntax 
> is challenging, but it can be done.
>
> I won't confuse the issue more unless you need something like that - let me 
> know if you do.
>
> On Wed, Oct 26, 2016 at 9:52 AM, Tom Evans <tevans...@googlemail.com> wrote:
>
>> On Wed, Oct 26, 2016 at 4:00 PM, Prasanna S. Dhakephalkar
>> <prasann...@merajob.in> wrote:
>> > Hi,
>> >
>> > Thanks for reply, I did
>> >
>> > "q": "cost:[2 TO (2+5000)]"
>> >
>> > Got
>> >
>> >   "error": {
>> > "msg": "org.apache.solr.search.SyntaxError: Cannot parse
>> 'cost:[2 to (2+5000)]': Encountered \"  \"(2+5000)
>> \"\" at line 1, column 18.\nWas expecting one of:\n\"]\" ...\n\"}\"
>> ...\n",
>> >   }
>> >
>> > I want solr to do the addition.
>> > I tried
>> > "q": "cost:[2 TO (2+5000)]"
>> > "q": "cost:[2 TO sum(2,5000)]"
>> >
>> > I has not worked. I am missing something. I donot know what. May be
>> > how
>> to invoke functions.
>> >
>> > Regards,
>> >
>> > Prasanna.
>>
>> Sorry, I was unclear - do the maths before constructing the query!
>>
>> You might be able to do this with function queries, but why bother? If
>> the number is fixed, then fix it in the query, if it varies then there
>> must be some code executing on your client that can be used to do a
>> simple addition.
>>
>> Cheers
>>
>> Tom
>>
>


RE: Query formulation help

2016-11-05 Thread Prasanna S. Dhakephalkar
Hi John,

I need to formulate a query where the both query variable are from document.
Like get me all documents where var_1 >  var_2 (var_1 and var_2 both are in 
document.)

Thanks and Regards,

Prasanna.


-Original Message-
From: John Bickerstaff [mailto:j...@johnbickerstaff.com] 
Sent: Wednesday, October 26, 2016 9:26 PM
To: solr-user@lucene.apache.org
Subject: Re: Query formulation help

For what it's worth- you can do some complex stuff - including using document 
fields as "variables" -- I did it on an Solr query endpoint (like
/search) because I had stuff that was constant for every query.  The syntax is 
challenging, but it can be done.

I won't confuse the issue more unless you need something like that - let me 
know if you do.

On Wed, Oct 26, 2016 at 9:52 AM, Tom Evans <tevans...@googlemail.com> wrote:

> On Wed, Oct 26, 2016 at 4:00 PM, Prasanna S. Dhakephalkar 
> <prasann...@merajob.in> wrote:
> > Hi,
> >
> > Thanks for reply, I did
> >
> > "q": "cost:[2 TO (2+5000)]"
> >
> > Got
> >
> >   "error": {
> > "msg": "org.apache.solr.search.SyntaxError: Cannot parse
> 'cost:[2 to (2+5000)]': Encountered \"  \"(2+5000)
> \"\" at line 1, column 18.\nWas expecting one of:\n\"]\" ...\n\"}\"
> ...\n",
> >   }
> >
> > I want solr to do the addition.
> > I tried
> > "q": "cost:[2 TO (2+5000)]"
> > "q": "cost:[2 TO sum(2,5000)]"
> >
> > I has not worked. I am missing something. I donot know what. May be 
> > how
> to invoke functions.
> >
> > Regards,
> >
> > Prasanna.
>
> Sorry, I was unclear - do the maths before constructing the query!
>
> You might be able to do this with function queries, but why bother? If 
> the number is fixed, then fix it in the query, if it varies then there 
> must be some code executing on your client that can be used to do a 
> simple addition.
>
> Cheers
>
> Tom
>



RE: Query formulation help

2016-10-26 Thread Prasanna S. Dhakephalkar
John, 

You are right, I am also looking for document fields as variables.
That was going to be my next trials.

I have been using admin panel for trying out queries.

Regards,

Prasanna.

-Original Message-
From: John Bickerstaff [mailto:j...@johnbickerstaff.com] 
Sent: Wednesday, October 26, 2016 9:26 PM
To: solr-user@lucene.apache.org
Subject: Re: Query formulation help

For what it's worth- you can do some complex stuff - including using document 
fields as "variables" -- I did it on an Solr query endpoint (like
/search) because I had stuff that was constant for every query.  The syntax is 
challenging, but it can be done.

I won't confuse the issue more unless you need something like that - let me 
know if you do.

On Wed, Oct 26, 2016 at 9:52 AM, Tom Evans <tevans...@googlemail.com> wrote:

> On Wed, Oct 26, 2016 at 4:00 PM, Prasanna S. Dhakephalkar 
> <prasann...@merajob.in> wrote:
> > Hi,
> >
> > Thanks for reply, I did
> >
> > "q": "cost:[2 TO (2+5000)]"
> >
> > Got
> >
> >   "error": {
> > "msg": "org.apache.solr.search.SyntaxError: Cannot parse
> 'cost:[2 to (2+5000)]': Encountered \"  \"(2+5000)
> \"\" at line 1, column 18.\nWas expecting one of:\n\"]\" ...\n\"}\"
> ...\n",
> >   }
> >
> > I want solr to do the addition.
> > I tried
> > "q": "cost:[2 TO (2+5000)]"
> > "q": "cost:[2 TO sum(2,5000)]"
> >
> > I has not worked. I am missing something. I donot know what. May be 
> > how
> to invoke functions.
> >
> > Regards,
> >
> > Prasanna.
>
> Sorry, I was unclear - do the maths before constructing the query!
>
> You might be able to do this with function queries, but why bother? If 
> the number is fixed, then fix it in the query, if it varies then there 
> must be some code executing on your client that can be used to do a 
> simple addition.
>
> Cheers
>
> Tom
>



Re: Query formulation help

2016-10-26 Thread John Bickerstaff
For what it's worth- you can do some complex stuff - including using
document fields as "variables" -- I did it on an Solr query endpoint (like
/search) because I had stuff that was constant for every query.  The syntax
is challenging, but it can be done.

I won't confuse the issue more unless you need something like that - let me
know if you do.

On Wed, Oct 26, 2016 at 9:52 AM, Tom Evans  wrote:

> On Wed, Oct 26, 2016 at 4:00 PM, Prasanna S. Dhakephalkar
>  wrote:
> > Hi,
> >
> > Thanks for reply, I did
> >
> > "q": "cost:[2 TO (2+5000)]"
> >
> > Got
> >
> >   "error": {
> > "msg": "org.apache.solr.search.SyntaxError: Cannot parse
> 'cost:[2 to (2+5000)]': Encountered \"  \"(2+5000)
> \"\" at line 1, column 18.\nWas expecting one of:\n\"]\" ...\n\"}\"
> ...\n",
> >   }
> >
> > I want solr to do the addition.
> > I tried
> > "q": "cost:[2 TO (2+5000)]"
> > "q": "cost:[2 TO sum(2,5000)]"
> >
> > I has not worked. I am missing something. I donot know what. May be how
> to invoke functions.
> >
> > Regards,
> >
> > Prasanna.
>
> Sorry, I was unclear - do the maths before constructing the query!
>
> You might be able to do this with function queries, but why bother? If
> the number is fixed, then fix it in the query, if it varies then there
> must be some code executing on your client that can be used to do a
> simple addition.
>
> Cheers
>
> Tom
>


Re: Query formulation help

2016-10-26 Thread Tom Evans
On Wed, Oct 26, 2016 at 4:00 PM, Prasanna S. Dhakephalkar
 wrote:
> Hi,
>
> Thanks for reply, I did
>
> "q": "cost:[2 TO (2+5000)]"
>
> Got
>
>   "error": {
> "msg": "org.apache.solr.search.SyntaxError: Cannot parse 'cost:[2 to 
> (2+5000)]': Encountered \"  \"(2+5000) \"\" at line 1, 
> column 18.\nWas expecting one of:\n\"]\" ...\n\"}\" ...\n",
>   }
>
> I want solr to do the addition.
> I tried
> "q": "cost:[2 TO (2+5000)]"
> "q": "cost:[2 TO sum(2,5000)]"
>
> I has not worked. I am missing something. I donot know what. May be how to 
> invoke functions.
>
> Regards,
>
> Prasanna.

Sorry, I was unclear - do the maths before constructing the query!

You might be able to do this with function queries, but why bother? If
the number is fixed, then fix it in the query, if it varies then there
must be some code executing on your client that can be used to do a
simple addition.

Cheers

Tom


Re: Query formulation help

2016-10-26 Thread John Bickerstaff
Ahh - I see what you're after (I think)

This page should be helpful for you:

https://cwiki.apache.org/confluence/display/solr/Function+Queries

again, I'd try using the Admin UI as a test phase to get things right (and
see the syntax in the URL that comes back on the response)

Open the edismax section of the Admin UI to find fields that you can use to
enter function queries and things like this...

In the case of X + Y, you're probably interested in the "sum" function

HTH...

On Wed, Oct 26, 2016 at 9:28 AM, Shawn Heisey  wrote:

> On 10/26/2016 9:00 AM, Prasanna S. Dhakephalkar wrote:
> > Hi, Thanks for reply, I did "q": "cost:[2 TO (2+5000)]"
>
> Solr doesn't support doing math in that way in a query, except with
> dates.  It's invalid syntax for a range query.  Tom's reply was correct,
> but was phrased in a way that makes a potential promise that Solr won't
> deliver.
>
> https://cwiki.apache.org/confluence/display/solr/Working+with+Dates#
> WorkingwithDates-DateMath
>
> There might be a way to somehow use function query to do it, but if it's
> possible, I do not know how to write it.  If it's even possible, the
> syntax probably would not be straightforward.
>
> The way I would do your query is to have my code do the calculation and
> use 25000 directly instead of 2+5000.
>
> Thanks,
> Shawn
>
>


Re: Query formulation help

2016-10-26 Thread Shawn Heisey
On 10/26/2016 9:00 AM, Prasanna S. Dhakephalkar wrote:
> Hi, Thanks for reply, I did "q": "cost:[2 TO (2+5000)]"

Solr doesn't support doing math in that way in a query, except with
dates.  It's invalid syntax for a range query.  Tom's reply was correct,
but was phrased in a way that makes a potential promise that Solr won't
deliver.

https://cwiki.apache.org/confluence/display/solr/Working+with+Dates#WorkingwithDates-DateMath

There might be a way to somehow use function query to do it, but if it's
possible, I do not know how to write it.  If it's even possible, the
syntax probably would not be straightforward.

The way I would do your query is to have my code do the calculation and
use 25000 directly instead of 2+5000.

Thanks,
Shawn



Re: Query formulation help

2016-10-26 Thread John Bickerstaff
It looks to me as if it's blowing up on syntax.

I don't have access to the Admin UI right now, but I would suggest
attempting to submit this query via the UI and examining the URL that comes
back.  That frequently solves my more frustrating syntax problems.

I.E. try putting the cost:[...] in the query box on the UI (no quotes
as a first try) and see what happens

Alternatively, try putting cost as the query field (qf) and just the 2
TO (2000) in the query box...

Apologies - I don't have the UI in front of me or I'd try it myself, but
this is the general idea - try to issue the query in the Admin UI and
observe the syntax in the URL that is returned at the top of the page along
with the results.

On Wed, Oct 26, 2016 at 9:00 AM, Prasanna S. Dhakephalkar <
prasann...@merajob.in> wrote:

> Hi,
>
> Thanks for reply, I did
>
> "q": "cost:[2 TO (2+5000)]"
>
> Got
>
>   "error": {
> "msg": "org.apache.solr.search.SyntaxError: Cannot parse 'cost:[2
> to (2+5000)]': Encountered \"  \"(2+5000) \"\" at line
> 1, column 18.\nWas expecting one of:\n\"]\" ...\n\"}\" ...\n",
>   }
>
> I want solr to do the addition.
> I tried
> "q": "cost:[2 TO (2+5000)]"
> "q": "cost:[2 TO sum(2,5000)]"
>
> I has not worked. I am missing something. I donot know what. May be how to
> invoke functions.
>
> Regards,
>
> Prasanna.
>
>
> -Original Message-
> From: Tom Evans [mailto:tevans...@googlemail.com]
> Sent: Wednesday, October 26, 2016 3:07 PM
> To: solr-user@lucene.apache.org
> Subject: Re: Query formulation help
>
> On Wed, Oct 26, 2016 at 8:03 AM, Prasanna S. Dhakephalkar <
> prasann...@merajob.in> wrote:
> > Hi,
> >
> >
> >
> > May be very rudimentary question
> >
> >
> >
> > There is a integer field in a core : "cost"
> >
> > Need to build a query that will return documents where 0  <
> > "cost"-given_number  <  500
> >
>
> cost:[given_number TO (500+given_number)]
>
>


RE: Query formulation help

2016-10-26 Thread Prasanna S. Dhakephalkar
Hi,

Thanks for reply, I did

"q": "cost:[2 TO (2+5000)]"

Got

  "error": {
"msg": "org.apache.solr.search.SyntaxError: Cannot parse 'cost:[2 to 
(2+5000)]': Encountered \"  \"(2+5000) \"\" at line 1, 
column 18.\nWas expecting one of:\n\"]\" ...\n\"}\" ...\n",
  }

I want solr to do the addition.
I tried 
"q": "cost:[2 TO (2+5000)]"
"q": "cost:[2 TO sum(2,5000)]"

I has not worked. I am missing something. I donot know what. May be how to 
invoke functions.

Regards,

Prasanna.


-Original Message-
From: Tom Evans [mailto:tevans...@googlemail.com] 
Sent: Wednesday, October 26, 2016 3:07 PM
To: solr-user@lucene.apache.org
Subject: Re: Query formulation help

On Wed, Oct 26, 2016 at 8:03 AM, Prasanna S. Dhakephalkar 
<prasann...@merajob.in> wrote:
> Hi,
>
>
>
> May be very rudimentary question
>
>
>
> There is a integer field in a core : "cost"
>
> Need to build a query that will return documents where 0  < 
> "cost"-given_number  <  500
>

cost:[given_number TO (500+given_number)]



Re: Query formulation help

2016-10-26 Thread Tom Evans
On Wed, Oct 26, 2016 at 8:03 AM, Prasanna S. Dhakephalkar
 wrote:
> Hi,
>
>
>
> May be very rudimentary question
>
>
>
> There is a integer field in a core : "cost"
>
> Need to build a query that will return documents where 0  <
> "cost"-given_number  <  500
>

cost:[given_number TO (500+given_number)]


Query formulation help

2016-10-26 Thread Prasanna S. Dhakephalkar
Hi,

 

May be very rudimentary question

 

There is a integer field in a core : "cost"

Need to build a query that will return documents where 0  <
"cost"-given_number  <  500

 

How can this be achieved ?

 

Thanks.

 

Prasanna.



Re: query formulation

2016-09-11 Thread John Bickerstaff
Awesome!

If I can get 2 or 3 more-experienced SOLR people to agree to assist, I can
put together something really good.  I like this stuff and am willing to
put in the time just to see the result.

I'll contact you off the list.

All - anyone else willing to volunteer to answer questions to support an
effort to build a comprehensive SOLR Query tutorial?

Alexandre, I'll contact you offline.

On Sun, Sep 11, 2016 at 10:37 AM, Alexandre Rafalovitch 
wrote:

> 1. There are tutorials. Actually a number of them. But none of them -
> as far as I remember - go very far into the query language. They kind
> of stop of basic queries. I remember the first time I realized I can
> get multiple subqueries working together (for
> https://gist.github.com/arafalov/5e04884e5aefaf46678c I think). There
> is also _a lot_ of resources on the web, but they are not easily
> discoverable. I am looking into doing something about that, but it is
> not public (or even alpha) yet.
>
> 2. Solr Reference Guide (not wiki) is the starting point now. It is
> quite comprehensive, but it is a reference guide, not a tutorial. So,
> some information is still in unexpected sections (e.g. parent/child
> queries, child expansion, etc).
>
> 3. Yes and yes. I am not promising knowing all answers, but I've been
> already digging into some of this for various solr-start projects and
> for my upcoming presentation. Contact me off the list and let's talk.
>
> Regards,
> Alex.
> 
> Newsletter and resources for Solr beginners and intermediates:
> http://www.solr-start.com/
>
>
> On 11 September 2016 at 23:24, John Bickerstaff
>  wrote:
> > All,
> >
> > I've found that figuring out the subtle nuances of the query language is
> a
> > *daunting* task for someone unfamiliar with SOLR.
> >
> > I'm not aware of any comprehensive documentation (in the form of a
> tutorial
> > or similar really useful tool)
> >
> > It seems the information is scattered all over the place an has to be dug
> > out piecemeal...  Typical for open-source projects.  Yes, I've seen the
> > wiki - and it's not too far from a man page.  Everything that is possible
> > (in theory) is contained in the api, but that is not the same thing as a
> > large set of examples that *show* how to use it.
> >
> > So, three questions:
> >
> > 1. Is there somewhere that really dives into the use of the query
> language
> > (like a tutorial)?
> > 2. Assuming not, is there a web page that at least contains a majority of
> > the links to various sources to assist someone in studying?
> > 3. Is there any interest in having someone do this documentation /
> tutorial
> > creation?
> >  3a. If the answer to 3 is  yes - are the committers/solr experts
> > willing to volunteer to answer questions via email if I build the
> tutorial?
> >
> > If the answer to 3 is yes and yes - I cut my teeth in the industry 20
> years
> > ago as a Tech Writer and Instructional Designer.  I will build and
> publish
> > the tutorial - but I don't have the time to dig out all the info the hard
> > way - which is why I asked 3a...
> >
> > On Sat, Sep 10, 2016 at 11:20 AM, Erick Erickson <
> erickerick...@gmail.com>
> > wrote:
> >
> >> Background for Shawn's comments can be found here:
> >>
> >> https://lucidworks.com/blog/2011/12/28/why-not-and-or-and-not/
> >>
> >> Solr's query language is NOT strict boolean logic as explained
> >> above. Although with proper grouping (parenthesizing) and tricks
> >> like Shawn mentioned it can be pretty close.
> >>
> >> Best,
> >> Erick
> >>
> >> On Fri, Sep 9, 2016 at 9:17 PM, Shawn Heisey 
> wrote:
> >> > On 9/9/2016 9:17 PM, Prasanna S. Dhakephalkar wrote:
> >> >> Further search on net got me answer
> >> >>
> >> >> The query to be
> >> >>
> >> >> a_id:20 OR (*:* NOT a_id:*)
> >> >>
> >> >> I don't understand this syntax
> >> >
> >> > The basic problem here is that negative queries don't work.  If you're
> >> > going to subtract X, you have to start with something (like all docs),
> >> > or the result is nothing.
> >> >
> >> > For simple queries (just a single "-field:X" clause), Solr is able to
> >> > detect the unworkable situation and implicitly add a "*:*" starting
> >> > point, so the query works.
> >> >
> >> > When the query has ANY complexity, Solr's negative query detection
> isn't
> >> > possible, and the query can't be fixed automatically, so it doesn't
> work.
> >> >
> >> > Thanks,
> >> > Shawn
> >> >
> >>
>


Re: query formulation

2016-09-11 Thread Alexandre Rafalovitch
1. There are tutorials. Actually a number of them. But none of them -
as far as I remember - go very far into the query language. They kind
of stop of basic queries. I remember the first time I realized I can
get multiple subqueries working together (for
https://gist.github.com/arafalov/5e04884e5aefaf46678c I think). There
is also _a lot_ of resources on the web, but they are not easily
discoverable. I am looking into doing something about that, but it is
not public (or even alpha) yet.

2. Solr Reference Guide (not wiki) is the starting point now. It is
quite comprehensive, but it is a reference guide, not a tutorial. So,
some information is still in unexpected sections (e.g. parent/child
queries, child expansion, etc).

3. Yes and yes. I am not promising knowing all answers, but I've been
already digging into some of this for various solr-start projects and
for my upcoming presentation. Contact me off the list and let's talk.

Regards,
Alex.

Newsletter and resources for Solr beginners and intermediates:
http://www.solr-start.com/


On 11 September 2016 at 23:24, John Bickerstaff
 wrote:
> All,
>
> I've found that figuring out the subtle nuances of the query language is a
> *daunting* task for someone unfamiliar with SOLR.
>
> I'm not aware of any comprehensive documentation (in the form of a tutorial
> or similar really useful tool)
>
> It seems the information is scattered all over the place an has to be dug
> out piecemeal...  Typical for open-source projects.  Yes, I've seen the
> wiki - and it's not too far from a man page.  Everything that is possible
> (in theory) is contained in the api, but that is not the same thing as a
> large set of examples that *show* how to use it.
>
> So, three questions:
>
> 1. Is there somewhere that really dives into the use of the query language
> (like a tutorial)?
> 2. Assuming not, is there a web page that at least contains a majority of
> the links to various sources to assist someone in studying?
> 3. Is there any interest in having someone do this documentation / tutorial
> creation?
>  3a. If the answer to 3 is  yes - are the committers/solr experts
> willing to volunteer to answer questions via email if I build the tutorial?
>
> If the answer to 3 is yes and yes - I cut my teeth in the industry 20 years
> ago as a Tech Writer and Instructional Designer.  I will build and publish
> the tutorial - but I don't have the time to dig out all the info the hard
> way - which is why I asked 3a...
>
> On Sat, Sep 10, 2016 at 11:20 AM, Erick Erickson 
> wrote:
>
>> Background for Shawn's comments can be found here:
>>
>> https://lucidworks.com/blog/2011/12/28/why-not-and-or-and-not/
>>
>> Solr's query language is NOT strict boolean logic as explained
>> above. Although with proper grouping (parenthesizing) and tricks
>> like Shawn mentioned it can be pretty close.
>>
>> Best,
>> Erick
>>
>> On Fri, Sep 9, 2016 at 9:17 PM, Shawn Heisey  wrote:
>> > On 9/9/2016 9:17 PM, Prasanna S. Dhakephalkar wrote:
>> >> Further search on net got me answer
>> >>
>> >> The query to be
>> >>
>> >> a_id:20 OR (*:* NOT a_id:*)
>> >>
>> >> I don't understand this syntax
>> >
>> > The basic problem here is that negative queries don't work.  If you're
>> > going to subtract X, you have to start with something (like all docs),
>> > or the result is nothing.
>> >
>> > For simple queries (just a single "-field:X" clause), Solr is able to
>> > detect the unworkable situation and implicitly add a "*:*" starting
>> > point, so the query works.
>> >
>> > When the query has ANY complexity, Solr's negative query detection isn't
>> > possible, and the query can't be fixed automatically, so it doesn't work.
>> >
>> > Thanks,
>> > Shawn
>> >
>>


Re: query formulation

2016-09-11 Thread John Bickerstaff
All,

I've found that figuring out the subtle nuances of the query language is a
*daunting* task for someone unfamiliar with SOLR.

I'm not aware of any comprehensive documentation (in the form of a tutorial
or similar really useful tool)

It seems the information is scattered all over the place an has to be dug
out piecemeal...  Typical for open-source projects.  Yes, I've seen the
wiki - and it's not too far from a man page.  Everything that is possible
(in theory) is contained in the api, but that is not the same thing as a
large set of examples that *show* how to use it.

So, three questions:

1. Is there somewhere that really dives into the use of the query language
(like a tutorial)?
2. Assuming not, is there a web page that at least contains a majority of
the links to various sources to assist someone in studying?
3. Is there any interest in having someone do this documentation / tutorial
creation?
 3a. If the answer to 3 is  yes - are the committers/solr experts
willing to volunteer to answer questions via email if I build the tutorial?

If the answer to 3 is yes and yes - I cut my teeth in the industry 20 years
ago as a Tech Writer and Instructional Designer.  I will build and publish
the tutorial - but I don't have the time to dig out all the info the hard
way - which is why I asked 3a...

On Sat, Sep 10, 2016 at 11:20 AM, Erick Erickson 
wrote:

> Background for Shawn's comments can be found here:
>
> https://lucidworks.com/blog/2011/12/28/why-not-and-or-and-not/
>
> Solr's query language is NOT strict boolean logic as explained
> above. Although with proper grouping (parenthesizing) and tricks
> like Shawn mentioned it can be pretty close.
>
> Best,
> Erick
>
> On Fri, Sep 9, 2016 at 9:17 PM, Shawn Heisey  wrote:
> > On 9/9/2016 9:17 PM, Prasanna S. Dhakephalkar wrote:
> >> Further search on net got me answer
> >>
> >> The query to be
> >>
> >> a_id:20 OR (*:* NOT a_id:*)
> >>
> >> I don't understand this syntax
> >
> > The basic problem here is that negative queries don't work.  If you're
> > going to subtract X, you have to start with something (like all docs),
> > or the result is nothing.
> >
> > For simple queries (just a single "-field:X" clause), Solr is able to
> > detect the unworkable situation and implicitly add a "*:*" starting
> > point, so the query works.
> >
> > When the query has ANY complexity, Solr's negative query detection isn't
> > possible, and the query can't be fixed automatically, so it doesn't work.
> >
> > Thanks,
> > Shawn
> >
>


Re: query formulation

2016-09-10 Thread Erick Erickson
Background for Shawn's comments can be found here:

https://lucidworks.com/blog/2011/12/28/why-not-and-or-and-not/

Solr's query language is NOT strict boolean logic as explained
above. Although with proper grouping (parenthesizing) and tricks
like Shawn mentioned it can be pretty close.

Best,
Erick

On Fri, Sep 9, 2016 at 9:17 PM, Shawn Heisey  wrote:
> On 9/9/2016 9:17 PM, Prasanna S. Dhakephalkar wrote:
>> Further search on net got me answer
>>
>> The query to be
>>
>> a_id:20 OR (*:* NOT a_id:*)
>>
>> I don't understand this syntax
>
> The basic problem here is that negative queries don't work.  If you're
> going to subtract X, you have to start with something (like all docs),
> or the result is nothing.
>
> For simple queries (just a single "-field:X" clause), Solr is able to
> detect the unworkable situation and implicitly add a "*:*" starting
> point, so the query works.
>
> When the query has ANY complexity, Solr's negative query detection isn't
> possible, and the query can't be fixed automatically, so it doesn't work.
>
> Thanks,
> Shawn
>


Re: query formulation

2016-09-09 Thread Shawn Heisey
On 9/9/2016 9:17 PM, Prasanna S. Dhakephalkar wrote:
> Further search on net got me answer
>
> The query to be
>
> a_id:20 OR (*:* NOT a_id:*)
>
> I don't understand this syntax

The basic problem here is that negative queries don't work.  If you're
going to subtract X, you have to start with something (like all docs),
or the result is nothing.

For simple queries (just a single "-field:X" clause), Solr is able to
detect the unworkable situation and implicitly add a "*:*" starting
point, so the query works.

When the query has ANY complexity, Solr's negative query detection isn't
possible, and the query can't be fixed automatically, so it doesn't work.

Thanks,
Shawn



RE: query formulation

2016-09-09 Thread Prasanna S. Dhakephalkar
Hi,

 

Further search on net got me answer

The query to be

a_id:20 OR (*:* NOT a_id:*)

 

I don't understand this syntax

I am bit raw at solr query formations :)

 

Regards,

 

Prasanna.

 

From: Prasanna S. Dhakephalkar [mailto:prasann...@merajob.in] 
Sent: Saturday, September 10, 2016 8:24 AM
To: 'solr-user@lucene.apache.org'
Subject: query formulation

 

Greetings Group,

 

I am attempting to formulate a query that gives me all the records such that

1.   The record does not have field a_id

2.   If a_id field exists then it should have a value 20

 

So,  for 1. I used -a_id:* (got 25 results)

For 2. I used a_id:20 (got 3 results)

 

For combination I used

-a_id:* OR a_id:20 (was expecting 28 results)

Got nothing.

 

What Am I missing ?

 

Regards,

 

Prasanna.



query formulation

2016-09-09 Thread Prasanna S. Dhakephalkar
Greetings Group,

 

I am attempting to formulate a query that gives me all the records such that

1.   The record does not have field a_id

2.   If a_id field exists then it should have a value 20

 

So,  for 1. I used -a_id:* (got 25 results)

For 2. I used a_id:20 (got 3 results)

 

For combination I used

-a_id:* OR a_id:20 (was expecting 28 results)

Got nothing.

 

What Am I missing ?

 

Regards,

 

Prasanna.