Query regarding integrating solr query functions into blockfacetjoin Query

2021-02-22 Thread Ravi Kumar
Hi Team,

I was implementing block join faceting query in my project and was stuck in
integrating the existing functional queries in the block join faceting
query.

*The current query using 'select' handler is as follows* :-
https://localhost:8983/solr/master_Product_default/*select*?*yq*
=_query_:%22\{\!multiMaxScore\+tie%3D0.0\}\(\(bomCode_bc_string\:samsung\)\+OR\+\(description_text_en\:samsung\)\+OR\+\(belleaprice_cad_bc846_string\:samsung\^20.0\)\+OR\+\(name_text_en\:samsung\^50.0\)\+OR\+\(category_string_mv\:samsung\^20.0\)\)\+OR\+\(\(belleaprice_cad_bc846_string\:samsung\~\^10.0\)\)\+OR\+\(\(bomCode_bc_string\:\%22samsung\%22\^50.0\)\+OR\+\(code_string\:\%22samsung\%22\~1.0\^90.0\)\+OR\+\(vendorId_string\:\%22samsung\%22\^95.0\)\+OR\+\(description_text_en\:\%22samsung\%22\^50.0\)\+OR\+\(belleaprice_cad_bc846_string\:\%22samsung\%22\^40.0\)\+OR\+\(name_text_en\:\%22samsung\%22\^100.0\)\+OR\+\(category_string_mv\:\%22samsung\%22\^40.0\)\+OR\+\(upcCode_bc846_string\:\%22samsung\%22\^99.0\)\)%22&
*yab*
=sum(product(and(not(exists(omniOnlineStockStatus_boolean)),exists(inStoreStockStatus_bc846_bellea_boolean)),70.0),product(and(exists(omniOnlineStockStatus_boolean),exists(inStoreStockStatus_bc846_bellea_boolean)),80.0),product(and(exists(omniOnlineStockStatus_boolean),not(exists(inStoreStockStatus_bc846_bellea_boolean))),40.0),product(exists(omniInStoreStockStatus_bc_boolean),20.0))&*q={!boost}(+{!lucene
v=$yq} {!func v=$yab})*
=(omniAssortment_bc846_boolean:true+OR+omniAssortment_a002_boolean:true)=(srpPriceValue_bc846_string:[0.0+TO+*])=(omniVisible_20_bellea_bc_boolean:true)=(catalogId:%22belleaProductCatalog%22+AND+catalogVersion:%22Online%22)=score+desc,omniInStoreStockStatus_bc_boolean+asc,creationtime_sortable_date+desc,inStoreStockStatus_bc846_bellea_boolean+asc,omniOnlineStockStatus_boolean+asc=0=2=characteristics_string=inStoreStockStatus_bc846_bellea_boolean=memorySize_string_mv=color_en_string=belleaprice_cad_bc846_string=supplier_string=model_string_mv=omniOnlineStockStatus_boolean=category_string_mv=omniInStoreStockStatus_bc_boolean=stockAvailability_string=true=count=1=11=score,*=[child+parentFilter%3D%22itemtype_string:Product%22+childFilter%3D%22brands_stringignorecase_mv:BC+AND+regions_stringignorecase_mv:ON+AND+activationTypes_stringignorecase_mv:N+AND+channels_stringignorecase_mv:NR+AND+banners_stringignorecase_mv:\%22Walmart\%22+AND+(accountTypes_stringignorecase_mv:IR+OR+accountTypes_stringignorecase_mv:empty)%22+limit%3D1000]=true=samsung=en=true

In the above query, the *'yq'* and* 'yab'* functions are integrated in the
main query using expression below :-
  *q={!boost}(+{!lucene v=$yq} {!func v=$yab})  *

I want to integrate the *'yq' and 'yab'* function queries in the *future
block join faceting query* mentioned below :-

https://localhost:8983/solr/master_Product_default/*blockJoinFacetRH*?
*q={!parent%20which=%22itemtype_string:Product%22}itemtype_string:TierPrice=json=true=true=contract_string=500*
=(omniAssortment_bc846_boolean:true+OR+omniAssortment_a002_boolean:true)=(srpPriceValue_bc846_string:[0.0+TO+*])=(omniVisible_20_bellea_bc_boolean:true)=(catalogId:%22belleaProductCatalog%22+AND+catalogVersion:%22Online%22)=score+desc,omniInStoreStockStatus_bc_boolean+asc,creationtime_sortable_date+desc,inStoreStockStatus_bc846_bellea_boolean+asc,omniOnlineStockStatus_boolean+asc=0=2000=characteristics_string=inStoreStockStatus_bc846_bellea_boolean=memorySize_string_mv=color_en_string=belleaprice_cad_bc846_string=supplier_string=model_string_mv=omniOnlineStockStatus_boolean=category_string_mv=omniInStoreStockStatus_bc_boolean=stockAvailability_string=true=count=1=11=score,*=[child+parentFilter%3D%22itemtype_string:Product%22+childFilter%3D%22brands_stringignorecase_mv:BC+AND+regions_stringignorecase_mv:ON+AND+activationTypes_stringignorecase_mv:N+AND+channels_stringignorecase_mv:NR+AND+banners_stringignorecase_mv:\%22Walmart\%22+AND+(accountTypes_stringignorecase_mv:IR+OR+accountTypes_stringignorecase_mv:empty)%22+limit%3D1000]=true=samsung=en=true

Can someone please suggest how can I add the expression '* {!boost}(+{!lucene
v=$yq} {!func v=$yab})*' functions in the block join facting query
-"*q={!parent%20which=%22itemtype_string:Product%22}
itemtype_string:TierPrice=json=true=true=contract_string=500*"
?

I shall be highly grateful if someone can suggest to me some insight.

Thanks & Regards,

Ravi Kumar
SAP Hybris Consultant


Re: Solr query with space (only) gives error

2021-01-09 Thread vstuart
Cross-posted / addressed (both me), here.

https://stackoverflow.com/questions/65620642/solr-query-with-space-only-q-20-stalls/65638561#65638561



--
Sent from: https://lucene.472066.n3.nabble.com/Solr-User-f472068.html


Re: Solr query with space (only) gives error

2021-01-09 Thread vstuart
Cross-posted / addressed (both me), here.

https://stackoverflow.com/questions/65620642/solr-query-with-space-only-q-20-stalls/65638561#65638561



--
Sent from: https://lucene.472066.n3.nabble.com/Solr-User-f472068.html


Solr query with space (only) gives error

2021-01-07 Thread vstuart
I have a frontend that uses Ajax to query Solr.

It's working well, but if I enter a single space (nothing else) in the
input/search box (the URL in the browser will show

... index.html#q=%20

In that circumstance I get a 400 error (as there are no parameters in the
request), which is fine, but my web page stalls, waiting for a response.

If, however, I enter a semicolon ( ; ) rather than a space, then the page
immediately refreshes, albeit with no results ("displaying 0 to 0 of 0").
Also fine / expected.

My question is what is triggering the " " (%20) query fault in Solr, and how
do I address (ideally, ignore) it?



--
Sent from: https://lucene.472066.n3.nabble.com/Solr-User-f472068.html


Solr query with space (only) gives error

2021-01-07 Thread vstuart
I have a frontend that uses Ajax to query Solr.

It's working well, but if I enter a single space (nothing else) in the
input/search box (the URL in the browser will show

... index.html#q=%20

In that circumstance I get a 400 error (as there are no parameters in the
request), which is fine, but my web page stalls, waiting for a response.

If, however, I enter a semicolon ( ; ) rather than a space, then the page
immediately refreshes, albeit with no results ("displaying 0 to 0 of 0").
Also fine / expected.

My question is what is triggering the " " (%20) query fault in Solr, and how
do I address (ideally, ignore) it?



--
Sent from: https://lucene.472066.n3.nabble.com/Solr-User-f472068.html


Re: solr query returns items with spaces removed

2020-07-29 Thread Erick Erickson
In high throughput situations that can be a problem. The entire
packet has to be assembled and transmitted over the network. This
can cause grief in many situations.

 Not to mention that for “regular” queries, say using the /select or /query
handlers and assuming you’re getting
one or more stored-but-not-docValues fields, that means 2+m seeks
of the disk, decompressing 2+m 16K blocks, creating the entier 2M+
packet in memory and transmitting it to the client.

This doesn’t apply to, say, the /export handler upon which streaming
is built.

For a low-query-volume situations where there are just a few simultaneous
queries you can get away with it. But it’s still an anti-pattern.

Again, though, none of that is relevant if you’re using anything built on
the /export handler, which includes almost all of the streaming capabilities.

Best,
Erick

> On Jul 29, 2020, at 4:59 PM, David Hastings  
> wrote:
> 
> "Oh, and returning 100K docs is an anti-pattern, if you really need that
> many docs consider cursorMark and/or Streaming."
> 
> er, i routinely ask for 2+ million records into a single file based on a
> query.  I mean not into a web application or anything, its meant to be
> processed after the fact, but solr has no issue doing this
> 
> 
> 
> On Wed, Jul 29, 2020 at 4:53 PM Erick Erickson 
> wrote:
> 
>> I don’t think there’s really a canned way to do what you’re asking. A
>> custom DocTransformer would probably do the trick though.
>> 
>> You could also create a custom QueryComponent that examined the docs being
>> returned and inserted a blank field for a selected number of fields
>> (possibly configurable in solrconfig.xml).
>> 
>> Oh, and returning 100K docs is an anti-pattern, if you really need that
>> many docs consider cursorMark and/or Streaming.
>> 
>> Best,
>> Erick
>> 
>>> On Jul 29, 2020, at 2:55 PM, Teresa McMains 
>> wrote:
>>> 
>>> Thanks so much.  Is there any other way to return the data value if it
>> exists, otherwise an empty string?  I'm integrating this with a 3rd party
>> app which I can't change. When the field is null it isn't showing up in the
>> output.
>>> 
>>> -Original Message-
>>> From: Erick Erickson 
>>> Sent: Wednesday, July 29, 2020 12:49 PM
>>> To: solr-user@lucene.apache.org
>>> Subject: Re: solr query returns items with spaces removed
>>> 
>>> The “def” function goes after the _indexed_ value, so that’s what you’re
>> getting back. Try just specifying “fl=INSTRUCTIONS”, and if the value is
>> stored that should return the original field value before any analysis is
>> done.
>>> 
>>> Why are you using the def function? If the field is absent from the doc,
>> nothing will be returned for that field, not even the name. Are you trying
>> to insure that a blank field is returned if the field isn’t in the
>> document? You can handle that on the client side if so…
>>> 
>>> Best,
>>> Erick
>>> 
>>>> On Jul 29, 2020, at 10:34 AM, Teresa McMains 
>> wrote:
>>>> 
>>>> _20_Instructions_And_Notes:def(INSTRUCTIONS,%22%22)
>>> 
>> 
>> 



Re: solr query returns items with spaces removed

2020-07-29 Thread David Hastings
"Oh, and returning 100K docs is an anti-pattern, if you really need that
many docs consider cursorMark and/or Streaming."

er, i routinely ask for 2+ million records into a single file based on a
query.  I mean not into a web application or anything, its meant to be
processed after the fact, but solr has no issue doing this



On Wed, Jul 29, 2020 at 4:53 PM Erick Erickson 
wrote:

> I don’t think there’s really a canned way to do what you’re asking. A
> custom DocTransformer would probably do the trick though.
>
> You could also create a custom QueryComponent that examined the docs being
> returned and inserted a blank field for a selected number of fields
> (possibly configurable in solrconfig.xml).
>
> Oh, and returning 100K docs is an anti-pattern, if you really need that
> many docs consider cursorMark and/or Streaming.
>
> Best,
> Erick
>
> > On Jul 29, 2020, at 2:55 PM, Teresa McMains 
> wrote:
> >
> > Thanks so much.  Is there any other way to return the data value if it
> exists, otherwise an empty string?  I'm integrating this with a 3rd party
> app which I can't change. When the field is null it isn't showing up in the
> output.
> >
> > -Original Message-
> > From: Erick Erickson 
> > Sent: Wednesday, July 29, 2020 12:49 PM
> > To: solr-user@lucene.apache.org
> > Subject: Re: solr query returns items with spaces removed
> >
> > The “def” function goes after the _indexed_ value, so that’s what you’re
> getting back. Try just specifying “fl=INSTRUCTIONS”, and if the value is
> stored that should return the original field value before any analysis is
> done.
> >
> > Why are you using the def function? If the field is absent from the doc,
> nothing will be returned for that field, not even the name. Are you trying
> to insure that a blank field is returned if the field isn’t in the
> document? You can handle that on the client side if so…
> >
> > Best,
> > Erick
> >
> >> On Jul 29, 2020, at 10:34 AM, Teresa McMains 
> wrote:
> >>
> >> _20_Instructions_And_Notes:def(INSTRUCTIONS,%22%22)
> >
>
>


Re: solr query returns items with spaces removed

2020-07-29 Thread Erick Erickson
I don’t think there’s really a canned way to do what you’re asking. A custom 
DocTransformer would probably do the trick though.

You could also create a custom QueryComponent that examined the docs being 
returned and inserted a blank field for a selected number of fields (possibly 
configurable in solrconfig.xml).

Oh, and returning 100K docs is an anti-pattern, if you really need that many 
docs consider cursorMark and/or Streaming.

Best,
Erick

> On Jul 29, 2020, at 2:55 PM, Teresa McMains  wrote:
> 
> Thanks so much.  Is there any other way to return the data value if it 
> exists, otherwise an empty string?  I'm integrating this with a 3rd party app 
> which I can't change. When the field is null it isn't showing up in the 
> output.
> 
> -Original Message-
> From: Erick Erickson  
> Sent: Wednesday, July 29, 2020 12:49 PM
> To: solr-user@lucene.apache.org
> Subject: Re: solr query returns items with spaces removed
> 
> The “def” function goes after the _indexed_ value, so that’s what you’re 
> getting back. Try just specifying “fl=INSTRUCTIONS”, and if the value is 
> stored that should return the original field value before any analysis is 
> done.
> 
> Why are you using the def function? If the field is absent from the doc, 
> nothing will be returned for that field, not even the name. Are you trying to 
> insure that a blank field is returned if the field isn’t in the document? You 
> can handle that on the client side if so…
> 
> Best,
> Erick
> 
>> On Jul 29, 2020, at 10:34 AM, Teresa McMains  
>> wrote:
>> 
>> _20_Instructions_And_Notes:def(INSTRUCTIONS,%22%22)
> 



RE: solr query returns items with spaces removed

2020-07-29 Thread Teresa McMains
Thanks so much.  Is there any other way to return the data value if it exists, 
otherwise an empty string?  I'm integrating this with a 3rd party app which I 
can't change. When the field is null it isn't showing up in the output.

-Original Message-
From: Erick Erickson  
Sent: Wednesday, July 29, 2020 12:49 PM
To: solr-user@lucene.apache.org
Subject: Re: solr query returns items with spaces removed

The “def” function goes after the _indexed_ value, so that’s what you’re 
getting back. Try just specifying “fl=INSTRUCTIONS”, and if the value is stored 
that should return the original field value before any analysis is done.

Why are you using the def function? If the field is absent from the doc, 
nothing will be returned for that field, not even the name. Are you trying to 
insure that a blank field is returned if the field isn’t in the document? You 
can handle that on the client side if so…

Best,
Erick

> On Jul 29, 2020, at 10:34 AM, Teresa McMains  
> wrote:
> 
> _20_Instructions_And_Notes:def(INSTRUCTIONS,%22%22)



Re: solr query returns items with spaces removed

2020-07-29 Thread Erick Erickson
The “def” function goes after the _indexed_ value, so that’s what you’re 
getting back. Try just specifying “fl=INSTRUCTIONS”, and if the value is stored 
that should return the original field value before any analysis is done.

Why are you using the def function? If the field is absent from the doc, 
nothing will be returned for that field, not even the name. Are you trying to 
insure that a blank field is returned if the field isn’t in the document? You 
can handle that on the client side if so…

Best,
Erick

> On Jul 29, 2020, at 10:34 AM, Teresa McMains  
> wrote:
> 
> _20_Instructions_And_Notes:def(INSTRUCTIONS,%22%22)



solr query returns items with spaces removed

2020-07-29 Thread Teresa McMains
I am sure I'm doing something silly. Basically it looks like my data is being 
altered upon search.

This is my fieldType:



























I have a string field called "INSTRUCTIONS" using this field type that looks 
like this:

ABC_D= PAYMENT FOR CONTRACT AX3764-MP-000-37

With a URL like the one below, I return a bunch of columns of data:

/solr/aml/select?q=TRANSACTION_REFERENCE_NUMBER%3A%22${transactionReferenceNumber}%22=doc_type%3Atrxn=json=_1_Trigger:def(TRIGGER_IND,%22N%22),_2_Transaction_No:TRANSACTION_REFERENCE_NUMBER,_3_Date:TRANSACTION_DATE,_4_Amount:CURRENCY_AMOUNT,_20_Instructions_And_Notes:def(INSTRUCTIONS,%22%22),_21_Transaction_Type:def(TRANSACTION_CDI_DESC,%22%22)=10

But the data being returned for "INSTRUCTIONS" looks like this:
ABCDPAYMENTFORCONTRACTAX3764MP00037

All spaces and special characters removed.  I thought the field Type filters 
would impact the index and the query lookup but not the data.
What's even weirder is that other fields that also use this field type (like 
transaction reference number) do not show the same behavior.

For example a transaction_reference_number like 123-456-7890 is returned 
correctly.


Can anyone please help me understand or troubleshoot?

Thank you so much,
Teresa




solr query to return matched text to regex with default schema

2020-07-07 Thread Phillip Wu
Hi,
I want to search Solr for server names in a set of Microsoft Word documents, 
PDF, and image files like jpg,gif.
Server names are given by the regular expression(regex)
INFP[a-zA-z0-9]{3,9}
TRKP[a-zA-z0-9]{3,9}
PLCP[a-zA-z0-9]{3,9}
SQRP[a-zA-z0-9]{3,9}


Problem
===
I want to get the text in the documents matching the regex. eg. INFPWSV01, 
PLCPLDB01

I've index the files using Solr/Tikka/Tesseract using the default schema.

I've used the highlight search tool
hl ticked
hl.usePhraseHighlighter ticked

Solr only returns the metadata (presumably) like filename for the file 
containing the pattern(s).

Questions
=
1. Would I have to modify the managed schema?
2. If so would I have to save the file content in the schema
3. If so is this the way to do it:
a. solrconfig.xml <- inside my "core"


true
ignored_
_text_

...
b. Remove line
ignored_
as I want meta data
c. Change this to the managed schema

stored to "true"
curl -X POST -H 'Content-type:application/json' --data-binary '{
  "replace-field":{
 "name":"_text_",
 "type":"text_general",
 "multiValued":true,
 "indexed":true
 "stored":true }
}' http://localhost:8983/api/cores/gettingstarted/schema









Re: Solr Query

2020-07-07 Thread Furkan KAMACI
Hi Swetha,

Given URL is encoded. So, you can decode it before analyzing. Plus
character is used for whitespaces when you encode a URL and minus sign
represents a negative query in Solr.

Kind Regards,
Furkan KAMACI

On Tue, Jul 7, 2020 at 9:16 PM swetha vemula 
wrote:

> Hi,
>
> I have an URL and I want to break this down and run it in the admin console
> but I am not what is ++ and - represents in the query.
>
> select?q=(StartPublish%3a%5b*+TO+-12-31T23%3a59%3a59.999Z%5d++-Content%3a(Birthdays%5c%2fAnniversaries))++-FriendlyUrl%3a(*%2farchive%2f*))++((Title_NGram%3a(swetha))%5e500+OR+(MetaTitle_NGram%3a(swetha))%5e400+OR+(MetaKeywords_NGram%3a(swetha))%5e300+OR+(MetaDescription_NGram%3a(swetha))%5e200+OR+(Content_NGram%3a(swetha))%5e1))++(ACL%3a((Everyone)+OR+(MIDCO410%5c%5cMidco%5c-AllEmployees)+OR+(MIDCO410%5c%5cMidco%5c-DotNetDevelopers)+OR+(MIDCO410%5c%5cMidco%5c-WebAdmins)+OR+(MIDCO410%5c%5cMidco%5c-Source%5c-Admin)=0=1=xml=2.2
>
> Thank You,
> Swetha.
>


Solr Query

2020-07-07 Thread swetha vemula
Hi,

I have an URL and I want to break this down and run it in the admin console
but I am not what is ++ and - represents in the query.
select?q=(StartPublish%3a%5b*+TO+-12-31T23%3a59%3a59.999Z%5d++-Content%3a(Birthdays%5c%2fAnniversaries))++-FriendlyUrl%3a(*%2farchive%2f*))++((Title_NGram%3a(swetha))%5e500+OR+(MetaTitle_NGram%3a(swetha))%5e400+OR+(MetaKeywords_NGram%3a(swetha))%5e300+OR+(MetaDescription_NGram%3a(swetha))%5e200+OR+(Content_NGram%3a(swetha))%5e1))++(ACL%3a((Everyone)+OR+(MIDCO410%5c%5cMidco%5c-AllEmployees)+OR+(MIDCO410%5c%5cMidco%5c-DotNetDevelopers)+OR+(MIDCO410%5c%5cMidco%5c-WebAdmins)+OR+(MIDCO410%5c%5cMidco%5c-Source%5c-Admin)=0=1=xml=2.2

Thank You,
Swetha.


Re: How to use two search string in a single solr query

2020-07-03 Thread Tushar Arora
Hi
Thanks Erick and Walter for your response.

Solr Version Used : 6.5.0
I tried to elaborate the issue:

Case 1 : Search String : Industrial Electric Oven
  Results=945
Case 2 : Search String : Dell laptop bags
  Results=992

In above both cases, mm play its role.(match any 2 words out of 3)

Now, I want to search with both string and mm still playing its role.

q=(Industrial Electric Oven) OR (Dell laptop bags)
I want mm still play its role in matching two out of three words in both
the cases.
Ex: Documents containing electric oven, industrial oven, dell bags, laptop
bags should be returned.
 I don't want the documents containing only dell, bags,etc. Also no
document containing electric bags.

Regards,
Tushar Arora


On Thu, 2 Jul 2020 at 22:37, Walter Underwood  wrote:

> First, remove the “mm” parameter from the request handler definition. That
> can
> be added back in and tweaked later, or just left out.
>
> Second, you don’t need any query syntax to search for two words. This
> query
> should work fine:
>
>   books bags
>
> wunder
> Walter Underwood
> wun...@wunderwood.org
> http://observer.wunderwood.org/  (my blog)
>
> > On Jul 1, 2020, at 10:22 PM, Tushar Arora  wrote:
> >
> > Hi,
> > I have a scenario with following entry in the request handler(handler1)
> of
> > solrconfig.xml.(defType=edismax is used)
> > description category  > "qf">title^4 demand^0.3
> > 2-1 4-30%
> >
> > When I searched 'bags' as a search string, solr returned 15000 results.
> > Query Used :
> >
> http://localhost:8984/solr/core_name/select?fl=title=on=bags=handler1=10=json
> >
> > And when searched 'books' as a search string, solr returns say 3348
> results.
> > Query Used :
> >
> http://localhost:8984/solr/core_name/select?fl=title=on=books=handler1=10=json
> >
> > I want to use both 'bags' and 'books' as a search string in a single
> query.
> > I used the following query:
> >
> http://localhost:8984/solr/core_name/select?fl=title=on=%22bags%22+OR+%22books%22=handler1=10=json
> > But OR operator not working. It will only give 7 results.
> >
> >
> > I even tried this :
> >
> http://localhost:8984/solr/core_name/select?fl=title=on=(bags)+OR+(books)=handler1=10=json
> > But it also gives 7 results.
> >
> > But my concern is to include the result of both 'bags' OR 'books' in a
> > single query.
> > Is there any way to use two search strings in a single query?
>
>


Re: How to use two search string in a single solr query

2020-07-02 Thread Walter Underwood
First, remove the “mm” parameter from the request handler definition. That can 
be added back in and tweaked later, or just left out.

Second, you don’t need any query syntax to search for two words. This query 
should work fine:

  books bags

wunder
Walter Underwood
wun...@wunderwood.org
http://observer.wunderwood.org/  (my blog)

> On Jul 1, 2020, at 10:22 PM, Tushar Arora  wrote:
> 
> Hi,
> I have a scenario with following entry in the request handler(handler1) of
> solrconfig.xml.(defType=edismax is used)
> description category  "qf">title^4 demand^0.3
> 2-1 4-30%
> 
> When I searched 'bags' as a search string, solr returned 15000 results.
> Query Used :
> http://localhost:8984/solr/core_name/select?fl=title=on=bags=handler1=10=json
> 
> And when searched 'books' as a search string, solr returns say 3348 results.
> Query Used :
> http://localhost:8984/solr/core_name/select?fl=title=on=books=handler1=10=json
> 
> I want to use both 'bags' and 'books' as a search string in a single query.
> I used the following query:
> http://localhost:8984/solr/core_name/select?fl=title=on=%22bags%22+OR+%22books%22=handler1=10=json
> But OR operator not working. It will only give 7 results.
> 
> 
> I even tried this :
> http://localhost:8984/solr/core_name/select?fl=title=on=(bags)+OR+(books)=handler1=10=json
> But it also gives 7 results.
> 
> But my concern is to include the result of both 'bags' OR 'books' in a
> single query.
> Is there any way to use two search strings in a single query?



Re: How to use two search string in a single solr query

2020-07-02 Thread Erick Erickson
Please let s know what version of Solr you use, otherwise it’s very hard to know
whether you’re running into https://issues.apache.org/jira/browse/SOLR-8812
or similar.

But two things to try:
1> specify q.op
lr
2> specify mm=0%

Best,
Erick

> On Jul 2, 2020, at 1:22 AM, Tushar Arora  wrote:
> 
> Hi,
> I have a scenario with following entry in the request handler(handler1) of
> solrconfig.xml.(defType=edismax is used)
> description category  "qf">title^4 demand^0.3
> 2-1 4-30%
> 
> When I searched 'bags' as a search string, solr returned 15000 results.
> Query Used :
> http://localhost:8984/solr/core_name/select?fl=title=on=bags=handler1=10=json
> 
> And when searched 'books' as a search string, solr returns say 3348 results.
> Query Used :
> http://localhost:8984/solr/core_name/select?fl=title=on=books=handler1=10=json
> 
> I want to use both 'bags' and 'books' as a search string in a single query.
> I used the following query:
> http://localhost:8984/solr/core_name/select?fl=title=on=%22bags%22+OR+%22books%22=handler1=10=json
> But OR operator not working. It will only give 7 results.
> 
> 
> I even tried this :
> http://localhost:8984/solr/core_name/select?fl=title=on=(bags)+OR+(books)=handler1=10=json
> But it also gives 7 results.
> 
> But my concern is to include the result of both 'bags' OR 'books' in a
> single query.
> Is there any way to use two search strings in a single query?



How to use two search string in a single solr query

2020-07-01 Thread Tushar Arora
Hi,
I have a scenario with following entry in the request handler(handler1) of
solrconfig.xml.(defType=edismax is used)
description category title^4 demand^0.3
2-1 4-30%

When I searched 'bags' as a search string, solr returned 15000 results.
Query Used :
http://localhost:8984/solr/core_name/select?fl=title=on=bags=handler1=10=json

And when searched 'books' as a search string, solr returns say 3348 results.
Query Used :
http://localhost:8984/solr/core_name/select?fl=title=on=books=handler1=10=json

I want to use both 'bags' and 'books' as a search string in a single query.
I used the following query:
http://localhost:8984/solr/core_name/select?fl=title=on=%22bags%22+OR+%22books%22=handler1=10=json
But OR operator not working. It will only give 7 results.


I even tried this :
http://localhost:8984/solr/core_name/select?fl=title=on=(bags)+OR+(books)=handler1=10=json
But it also gives 7 results.

But my concern is to include the result of both 'bags' OR 'books' in a
single query.
Is there any way to use two search strings in a single query?


Re: Lucene query to Solr query

2020-06-01 Thread gnandre
Is this odd use-case where one needs to convert Lucene query to Solr query?
Isn't this normal use-case when somebody is trying to port their Lucene
code to Solr?
I mean, is it like a XY problem where I should not even run into this
problem in the first place?


On Sun, May 31, 2020 at 9:40 AM Mikhail Khludnev  wrote:

> There's nothing like this now. Presumably one might visit queries and
> generate Query DSL json, but it might be a challenging problem.
>
> On Sun, May 31, 2020 at 3:42 AM gnandre  wrote:
>
> > I think this question here in this thread is similar to my question.
> >
> >
> https://lucene.472066.n3.nabble.com/Lucene-Query-to-Solr-query-td493751.html
> >
> >
> > As suggested in that thread, I do not want to use toString method for
> > Lucene query to pass it to the q param in SolrQuery.
> >
> > I am looking for a function that accepts org.apache.lucene.search.Query
> and
> > returns org.apache.solr.client.solrj.SolrQuery. Is that possible?
> >
> > On Sat, May 30, 2020 at 8:08 AM Erick Erickson 
> > wrote:
> >
> > > edismas is quite different from straight Lucene.
> > >
> > > Try attaching =query to the input and
> > > you’ll see the difference.
> > >
> > > Best,
> > > Erick
> > >
> > > > On May 30, 2020, at 12:32 AM, gnandre 
> wrote:
> > > >
> > > > Hi,
> > > >
> > > > I have following query which works fine as a lucene query:
> > > > +(topics:132)^0.02607211 (topics:146)^0.008187325
> > > > -asset_id:doc:en:index.html
> > > >
> > > > But, it does not work if I use it as a solr query with lucene as
> > defType.
> > > >
> > > > For it to work, I need to convert it like following:
> > > > q=+((topics:132)^0.02607211 (topics:146)^0.008187325
> > > > +(-(asset_id:doc\:en\:index.html))=edismax=OR
> > > >
> > > > Why does it not work as is? AFAIK syntax given in the first query is
> > > > supported by edismax.
> > >
> > >
> >
>
>
> --
> Sincerely yours
> Mikhail Khludnev
>


Re: Lucene query to Solr query

2020-05-31 Thread Mikhail Khludnev
There's nothing like this now. Presumably one might visit queries and
generate Query DSL json, but it might be a challenging problem.

On Sun, May 31, 2020 at 3:42 AM gnandre  wrote:

> I think this question here in this thread is similar to my question.
>
> https://lucene.472066.n3.nabble.com/Lucene-Query-to-Solr-query-td493751.html
>
>
> As suggested in that thread, I do not want to use toString method for
> Lucene query to pass it to the q param in SolrQuery.
>
> I am looking for a function that accepts org.apache.lucene.search.Query and
> returns org.apache.solr.client.solrj.SolrQuery. Is that possible?
>
> On Sat, May 30, 2020 at 8:08 AM Erick Erickson 
> wrote:
>
> > edismas is quite different from straight Lucene.
> >
> > Try attaching =query to the input and
> > you’ll see the difference.
> >
> > Best,
> > Erick
> >
> > > On May 30, 2020, at 12:32 AM, gnandre  wrote:
> > >
> > > Hi,
> > >
> > > I have following query which works fine as a lucene query:
> > > +(topics:132)^0.02607211 (topics:146)^0.008187325
> > > -asset_id:doc:en:index.html
> > >
> > > But, it does not work if I use it as a solr query with lucene as
> defType.
> > >
> > > For it to work, I need to convert it like following:
> > > q=+((topics:132)^0.02607211 (topics:146)^0.008187325
> > > +(-(asset_id:doc\:en\:index.html))=edismax=OR
> > >
> > > Why does it not work as is? AFAIK syntax given in the first query is
> > > supported by edismax.
> >
> >
>


-- 
Sincerely yours
Mikhail Khludnev


Re: Lucene query to Solr query

2020-05-30 Thread gnandre
I think this question here in this thread is similar to my question.
https://lucene.472066.n3.nabble.com/Lucene-Query-to-Solr-query-td493751.html


As suggested in that thread, I do not want to use toString method for
Lucene query to pass it to the q param in SolrQuery.

I am looking for a function that accepts org.apache.lucene.search.Query and
returns org.apache.solr.client.solrj.SolrQuery. Is that possible?

On Sat, May 30, 2020 at 8:08 AM Erick Erickson 
wrote:

> edismas is quite different from straight Lucene.
>
> Try attaching =query to the input and
> you’ll see the difference.
>
> Best,
> Erick
>
> > On May 30, 2020, at 12:32 AM, gnandre  wrote:
> >
> > Hi,
> >
> > I have following query which works fine as a lucene query:
> > +(topics:132)^0.02607211 (topics:146)^0.008187325
> > -asset_id:doc:en:index.html
> >
> > But, it does not work if I use it as a solr query with lucene as defType.
> >
> > For it to work, I need to convert it like following:
> > q=+((topics:132)^0.02607211 (topics:146)^0.008187325
> > +(-(asset_id:doc\:en\:index.html))=edismax=OR
> >
> > Why does it not work as is? AFAIK syntax given in the first query is
> > supported by edismax.
>
>


Re: Lucene query to Solr query

2020-05-30 Thread Erick Erickson
edismas is quite different from straight Lucene.

Try attaching =query to the input and
you’ll see the difference.

Best,
Erick

> On May 30, 2020, at 12:32 AM, gnandre  wrote:
> 
> Hi,
> 
> I have following query which works fine as a lucene query:
> +(topics:132)^0.02607211 (topics:146)^0.008187325
> -asset_id:doc:en:index.html
> 
> But, it does not work if I use it as a solr query with lucene as defType.
> 
> For it to work, I need to convert it like following:
> q=+((topics:132)^0.02607211 (topics:146)^0.008187325
> +(-(asset_id:doc\:en\:index.html))=edismax=OR
> 
> Why does it not work as is? AFAIK syntax given in the first query is
> supported by edismax.



Lucene query to Solr query

2020-05-29 Thread gnandre
Hi,

I have following query which works fine as a lucene query:
+(topics:132)^0.02607211 (topics:146)^0.008187325
-asset_id:doc:en:index.html

But, it does not work if I use it as a solr query with lucene as defType.

For it to work, I need to convert it like following:
q=+((topics:132)^0.02607211 (topics:146)^0.008187325
+(-(asset_id:doc\:en\:index.html))=edismax=OR

Why does it not work as is? AFAIK syntax given in the first query is
supported by edismax.


Re: Why Solr query time is more in case the searched value frequency is more even if no sorting is applied, for the same number of rows?

2020-05-15 Thread Paras Lehana
Well, in a way, QTime can depend on the total number of terms existing in
the core.

It would have been better if you had posted sample query and analysis
chain.

On Mon, 11 May 2020 at 11:45, Anshuman Singh 
wrote:

> Suppose I have two phone numbers P1 and P2 and the number of records with
> P1 are X and with P2 are 2X (2 times X) respectively. If I query for R rows
> for P1 and P2, the QTime in case of P2 is more. I am not specifying any
> sort parameter and the number of rows I'm asking for is same in both the
> cases so why such difference?
>
> I understand that if I use sorting on some basis then it has to go through
> all the documents and then apply sorting on them before providing the
> requested rows. But without sorting can't it just read the first R
> documents from the index? In this case, I believe the QTime will not depend
> on the total number of documents with respect to the query but on the
> requested number of rows.
>


-- 
-- 
Regards,

*Paras Lehana* [65871]
Development Engineer, *Auto-Suggest*,
IndiaMART InterMESH Ltd,

11th Floor, Tower 2, Assotech Business Cresterra,
Plot No. 22, Sector 135, Noida, Uttar Pradesh, India 201305

Mob.: +91-9560911996
Work: 0120-4056700 | Extn:
*1196*

-- 
*
*

 


Why Solr query time is more in case the searched value frequency is more even if no sorting is applied, for the same number of rows?

2020-05-11 Thread Anshuman Singh
Suppose I have two phone numbers P1 and P2 and the number of records with
P1 are X and with P2 are 2X (2 times X) respectively. If I query for R rows
for P1 and P2, the QTime in case of P2 is more. I am not specifying any
sort parameter and the number of rows I'm asking for is same in both the
cases so why such difference?

I understand that if I use sorting on some basis then it has to go through
all the documents and then apply sorting on them before providing the
requested rows. But without sorting can't it just read the first R
documents from the index? In this case, I believe the QTime will not depend
on the total number of documents with respect to the query but on the
requested number of rows.


Re: Solr query Slow in Solr 6.1.0

2020-03-19 Thread Erick Erickson
First of all, if you’re really using pre-and-postfix wildcards and those 
asterisks are not just bold formatting, those are very expensive operations. 
I’d suggest you investigate alternatives (like ngramming) or other alternate 
ways of analyzing your input (both at indexing and query time) before trying to 
understand the internals of query processing. If for no other reason than 
there’s no guarantee that the internal processing will remain the same between 
versions of Solr.

Second, I suspect that you’re seeing spurious speedups. There’s a lot of work 
that has to be done to gather terms like *cdrl*, so you may be getting caching. 
Unless you run a rigorous test (i.e. use many different queries with similar 
form), your timing is unreliable.

Third, try adding =query to some of these and looking at the output, 
that’ll give you some clue how the queries are parsed.

Best,
Erick

> On Mar 19, 2020, at 9:08 AM, vishal patel  
> wrote:
> 
> I am using solr 6.1.0. We have 2 shards and each has one replica. Our index 
> size is very large.
> I find out that position of field in query will impact of performance.
> 
> If I made below query I got slow response
> 
> (doc_ref:((*KON\-N2*) )) AND (title:((*cdrl*) )) AND project_id:(2104616) AND 
> is_active:true AND ((isLatest:(true) AND isFolderActive:true AND isXref:false 
> AND -document_type_id:(3 7) AND ((is_public:true OR distribution_list:1 
> OR folderadmin_list:1 OR author_user_id:1) AND 
> (((allowedUsers:(1) OR allowedRoles:( 6440215 6368478) OR 
> combinationUsers:(1)) AND -blockedUsers:(1)) OR (defaultAccess:(true) 
> AND -blockedUsers:(1) AND -blockedRoles:( 6440215 6368478) OR 
> (isLatestRevPrivate:(true) AND allowedUsersForPvtRev:(1) AND 
> -folderadmin_list:(1)))
> 
> If I changed (doc_ref:((*KON\-N2*) )) AND (title:((*cdrl*) )) part in last 
> then got fast response compare to above.
> 
> project_id:(2104616) AND is_active:true AND ((isLatest:(true) AND 
> isFolderActive:true AND isXref:false AND -document_type_id:(3 7) AND 
> ((is_public:true OR distribution_list:1 OR folderadmin_list:1 OR 
> author_user_id:1) AND (((allowedUsers:(1) OR allowedRoles:( 
> 6440215 6368478) OR combinationUsers:(1)) AND -blockedUsers:(1)) OR 
> (defaultAccess:(true) AND -blockedUsers:(1) AND -blockedRoles:( 
> 6440215 6368478) OR (isLatestRevPrivate:(true) AND 
> allowedUsersForPvtRev:(1) AND -folderadmin_list:(1))) AND 
> (doc_ref:((*KON\-N2*) )) AND (title:((*cdrl*) ))
> 
> Is it possible? How does Solr execute this query? field sequence is matter 
> for performance?
> I want to know the step by step Solr query execution same like database query 
> because I will arrange field for better performance.
> 
> Regards,
> Vishal
> 
> Sent from Outlook<http://aka.ms/weboutlook>



Solr query Slow in Solr 6.1.0

2020-03-19 Thread vishal patel
I am using solr 6.1.0. We have 2 shards and each has one replica. Our index 
size is very large.
I find out that position of field in query will impact of performance.

If I made below query I got slow response

(doc_ref:((*KON\-N2*) )) AND (title:((*cdrl*) )) AND project_id:(2104616) AND 
is_active:true AND ((isLatest:(true) AND isFolderActive:true AND isXref:false 
AND -document_type_id:(3 7) AND ((is_public:true OR distribution_list:1 OR 
folderadmin_list:1 OR author_user_id:1) AND (((allowedUsers:(1) OR 
allowedRoles:( 6440215 6368478) OR combinationUsers:(1)) AND 
-blockedUsers:(1)) OR (defaultAccess:(true) AND -blockedUsers:(1) AND 
-blockedRoles:( 6440215 6368478) OR (isLatestRevPrivate:(true) AND 
allowedUsersForPvtRev:(1) AND -folderadmin_list:(1)))

If I changed (doc_ref:((*KON\-N2*) )) AND (title:((*cdrl*) )) part in last then 
got fast response compare to above.

project_id:(2104616) AND is_active:true AND ((isLatest:(true) AND 
isFolderActive:true AND isXref:false AND -document_type_id:(3 7) AND 
((is_public:true OR distribution_list:1 OR folderadmin_list:1 OR 
author_user_id:1) AND (((allowedUsers:(1) OR allowedRoles:( 6440215 
6368478) OR combinationUsers:(1)) AND -blockedUsers:(1)) OR 
(defaultAccess:(true) AND -blockedUsers:(1) AND -blockedRoles:( 6440215 
6368478) OR (isLatestRevPrivate:(true) AND allowedUsersForPvtRev:(1) 
AND -folderadmin_list:(1))) AND (doc_ref:((*KON\-N2*) )) AND 
(title:((*cdrl*) ))

Is it possible? How does Solr execute this query? field sequence is matter for 
performance?
I want to know the step by step Solr query execution same like database query 
because I will arrange field for better performance.

Regards,
Vishal

Sent from Outlook<http://aka.ms/weboutlook>


Re: strange behavior of solr query parser

2020-03-02 Thread Hongtai Xue
Hi Phil.Staley

Thanks for your reply.
but I'm afraid that's a different problem.

Our problem can be confirmed since at least SOLR 7.3.0. (the oldest version we 
have)
And we guess it might already exists since SOLR-9786.
https://github.com/apache/lucene-solr/commit/bf9db95f218f49bac8e7971eb953a9fd9d13a2f0#diff-269ae02e56283ced3ce781cce21b3147R563

sincerely 
hongtai

送信元: "Staley, Phil R - DCF" 
Reply-To: "d...@lucene.apache.org" 
日付: 2020年3月2日 月曜日 22:38
宛先: solr_user lucene_apache , 
"d...@lucene.apache.org" 
件名: Re: strange behavior of solr query parser

I believe we are experiencing the same thing.

We recently upgraded to our Drupal 8 sites to SOLR 8.3.1.  We are now getting 
reports of certain patterns of search terms resulting in an error that reads, 
“The website encountered an unexpected error. Please try again later.”
 
Below is a list of example terms that always result in this error and a similar 
list that works fine.  The problem pattern seems to be a search term that 
contains 2 or 3 characters followed by a space, followed by additional text.
 
To confirm that the problem is version 8 of SOLR, I have updated our local and 
UAT sites with the latest Drupal updates that did include an update to the 
Search API Solr module and tested the terms below under SOLR 7.7.2, 8.3.1, and 
8.4.1.  Under version 7.7.2  everything works fine. Under either of the version 
8, the problem returns.
 
Thoughts?
 
Search terms that result in error
• w-2 agency directory
• agency w-2 directory
• w-2 agency
• w-2 directory
• w2 agency directory
• w2 agency
• w2 directory
 
Search terms that do not result in error
• w-22 agency directory
• agency directory w-2
• agency w-2directory
• agencyw-2 directory
• w-2
• w2
• agency directory
• agency
• directory
• -2 agency directory
• 2 agency directory
• w-2agency directory
• w2agency directory
 



From: Hongtai Xue 
Sent: Monday, March 2, 2020 3:45 AM
To: solr_user lucene_apache 
Cc: d...@lucene.apache.org 
Subject: strange behavior of solr query parser 
 
Hi,
 
Our team found a strange behavior of solr query parser.
In some specific cases, some conditional clauses on unindexed field will be 
ignored.
 
for query like, q=A:1 OR B:1 OR A:2 OR B:2
if field B is not indexed(but docValues="true"), "B:1" will be lost.
 
but if you write query like, q=A:1 OR A:2 OR B:1 OR B:2, 
it will work perfect.
 
the only difference of two queries is that they are wrote in different orders.
one is ABAB, another is AABB,
 
■reproduce steps and example explanation
you can easily reproduce this problem on a solr collection with _default 
configset and exampledocs/books.csv data.
 
1. create a _default collection
bin/solr create -c books -s 2 -rf 2
 
2. post books.csv.
bin/post -c books example/exampledocs/books.csv
 
3. run following query.
http://localhost:8983/solr/books/select?q=%2B%28name_str%3AFoundation+OR+cat%3Abook+OR+name_str%3AJhereg+OR+cat%3Acd%29=query
 
 
I printed query parsing debug information. 
you can tell "name_str:Foundation" is lost.
 
query: "name_str:Foundation OR cat:book OR name_str:Jhereg OR cat:cd"
(please note "Jhereg" is "4a 68 65 72 65 67" and "Foundation" is "46 6f 75 6e 
64 61 74 69 6f 6e")

  "debug":{
    "rawquerystring":"+(name_str:Foundation OR cat:book OR name_str:Jhereg OR 
cat:cd)",
    "querystring":"+(name_str:Foundation OR cat:book OR name_str:Jhereg OR 
cat:cd)",
    "parsedquery":"+(cat:book cat:cd (name_str:[[4a 68 65 72 65 67] TO [4a 68 
65 72 65 67]]))",
    "parsedquery_toString":"+(cat:book cat:cd name_str:[[4a 68 65 72 65 67] TO 
[4a 68 65 72 65 67]])",
    "QParser":"LuceneQParser"}}

 
but for query: "name_str:Foundation OR name_str:Jhereg OR cat:book OR cat:cd",
everything is OK. "name_str:Foundation" is not lost.

  "debug":{
    "rawquerystring":"+(name_str:Foundation OR name_str:Jhereg OR cat:book OR 
cat:cd)",
    "querystring":"+(name_str:Foundation OR name_str:Jhereg OR cat:book OR 
cat:cd)",
    "parsedquery":"+(cat:book cat:cd ((name_str:[[46 6f 75 6e 64 61 74 69 6f 
6e] TO [46 6f 75 6e 64 61 74 69 6f 6e]]) (name_str:[[4a 68 65 72 65 67] TO [4a 
68 65 72 65 67]])))",
    "parsedquery_toString":"+(cat:book cat:cd (name_str:[[46 6f 75 6e 64 61 74 
69 6f 6e] TO [46 6f 75 6e 64 61 74 69 6f 6e]] name_str:[[4a 68 65 72 65 67] TO 
[4a 68 65 72 65 67]]))",
    "QParser":"LuceneQParser"}}

http://localhost:8983/solr/books/select?q=%2B%28name_str%3AFoundation+OR+name_str%3AJhereg+OR+cat%3Abook+OR+cat%3Acd%29=query
 
we did a little bit research, and we wander if it is a bug of SolrQueryParser.
more specifically, we think if statement here might be wrong.
https://github.com/apache/lucene-solr/blob/branch_8_4/solr/core/src/java/org/apache/solr/parser/SolrQueryParserBase.java#L711
 
Could you please tell us if it is a bug, or it's just a wrong query statement.
 
Thanks,
Hongtai Xue



Question About Solr Query Parser

2020-03-02 Thread Kayak28
Hello, Community:

I have a question about interpreting a parsed query from Debug Query.
I used Solr 8.4.1 and LuceneQueryParser.
I was learning the behavior of ManagedSynonymFilter because I was curious
about how "ManagedSynonymGraphFilter" fails to generate a graph.
So, I try to interpret the parsed query, which gives me:
MultiPhraseQuery(managed_synonym_filter_query:\"AA (B SYNONYM_AA_1)
SYNOYM_AA_2 SYNONYM_AA
SYNONYM_AA_3 SYNONYM_AA_4 SYNONYM_AA_5\")
when I query q=managed_synonym_filter_query:"AAB" (SYNONYM_AA_n means
synonyms for AA that is defined in the managed-resource (1 <= n <= 5) )

I wonder why (B SYNONYM_AA_1) are appeared and what these parentheses mean.

If anyone knows any reasons or clues, I would be very appreciated of you
sharing the information.

Sincerely,
Kaya Ota


Re: strange behavior of solr query parser

2020-03-02 Thread Staley, Phil R - DCF
I believe we are experiencing the same thing.


We recently upgraded to our Drupal 8 sites to SOLR 8.3.1.  We are now getting 
reports of certain patterns of search terms resulting in an error that reads, 
“The website encountered an unexpected error. Please try again later.”



Below is a list of example terms that always result in this error and a similar 
list that works fine.  The problem pattern seems to be a search term that 
contains 2 or 3 characters followed by a space, followed by additional text.



To confirm that the problem is version 8 of SOLR, I have updated our local and 
UAT sites with the latest Drupal updates that did include an update to the 
Search API Solr module and tested the terms below under SOLR 7.7.2, 8.3.1, and 
8.4.1.  Under version 7.7.2  everything works fine. Under either of the version 
8, the problem returns.



Thoughts?



Search terms that result in error

  *   w-2 agency directory
  *   agency w-2 directory
  *   w-2 agency
  *   w-2 directory
  *   w2 agency directory
  *   w2 agency
  *   w2 directory



Search terms that do not result in error

  *   w-22 agency directory
  *   agency directory w-2
  *   agency w-2directory
  *   agencyw-2 directory
  *   w-2
  *   w2
  *   agency directory
  *   agency
  *   directory
  *   -2 agency directory
  *   2 agency directory
  *   w-2agency directory
  *   w2agency directory





From: Hongtai Xue 
Sent: Monday, March 2, 2020 3:45 AM
To: solr_user lucene_apache 
Cc: d...@lucene.apache.org 
Subject: strange behavior of solr query parser


Hi,



Our team found a strange behavior of solr query parser.

In some specific cases, some conditional clauses on unindexed field will be 
ignored.



for query like, q=A:1 OR B:1 OR A:2 OR B:2

if field B is not indexed(but docValues="true"), "B:1" will be lost.



but if you write query like, q=A:1 OR A:2 OR B:1 OR B:2,

it will work perfect.



the only difference of two queries is that they are wrote in different orders.

one is ABAB, another is AABB,



■reproduce steps and example explanation

you can easily reproduce this problem on a solr collection with _default 
configset and exampledocs/books.csv data.



1. create a _default collection

bin/solr create -c books -s 2 -rf 2



2. post books.csv.

bin/post -c books example/exampledocs/books.csv



3. run following query.

http://localhost:8983/solr/books/select?q=%2B%28name_str%3AFoundation+OR+cat%3Abook+OR+name_str%3AJhereg+OR+cat%3Acd%29=query





I printed query parsing debug information.

you can tell "name_str:Foundation" is lost.



query: "name_str:Foundation OR cat:book OR name_str:Jhereg OR cat:cd"

(please note "Jhereg" is "4a 68 65 72 65 67" and "Foundation" is "46 6f 75 6e 
64 61 74 69 6f 6e")



  "debug":{

"rawquerystring":"+(name_str:Foundation OR cat:book OR name_str:Jhereg OR 
cat:cd)",

"querystring":"+(name_str:Foundation OR cat:book OR name_str:Jhereg OR 
cat:cd)",

"parsedquery":"+(cat:book cat:cd (name_str:[[4a 68 65 72 65 67] TO [4a 68 
65 72 65 67]]))",

"parsedquery_toString":"+(cat:book cat:cd name_str:[[4a 68 65 72 65 67] TO 
[4a 68 65 72 65 67]])",

"QParser":"LuceneQParser"}}





but for query: "name_str:Foundation OR name_str:Jhereg OR cat:book OR cat:cd",

everything is OK. "name_str:Foundation" is not lost.



  "debug":{

"rawquerystring":"+(name_str:Foundation OR name_str:Jhereg OR cat:book OR 
cat:cd)",

"querystring":"+(name_str:Foundation OR name_str:Jhereg OR cat:book OR 
cat:cd)",

"parsedquery":"+(cat:book cat:cd ((name_str:[[46 6f 75 6e 64 61 74 69 6f 
6e] TO [46 6f 75 6e 64 61 74 69 6f 6e]]) (name_str:[[4a 68 65 72 65 67] TO [4a 
68 65 72 65 67]])))",

"parsedquery_toString":"+(cat:book cat:cd (name_str:[[46 6f 75 6e 64 61 74 
69 6f 6e] TO [46 6f 75 6e 64 61 74 69 6f 6e]] name_str:[[4a 68 65 72 65 67] TO 
[4a 68 65 72 65 67]]))",

"QParser":"LuceneQParser"}}



http://localhost:8983/solr/books/select?q=%2B%28name_str%3AFoundation+OR+name_str%3AJhereg+OR+cat%3Abook+OR+cat%3Acd%29=query



we did a little bit research, and we wander if it is a bug of SolrQueryParser.

more specifically, we think if statement here might be wrong.

https://github.com/apache/lucene-solr/blob/branch_8_4/solr/core/src/java/org/apache/solr/parser/SolrQueryParserBase.java#L711



Could you please tell us if it is a bug, or it's just a wrong query statement.



Thanks,

Hongtai Xue


strange behavior of solr query parser

2020-03-02 Thread Hongtai Xue
Hi,

Our team found a strange behavior of solr query parser.
In some specific cases, some conditional clauses on unindexed field will be 
ignored.

for query like, q=A:1 OR B:1 OR A:2 OR B:2
if field B is not indexed(but docValues="true"), "B:1" will be lost.

but if you write query like, q=A:1 OR A:2 OR B:1 OR B:2,
it will work perfect.

the only difference of two queries is that they are wrote in different orders.
one is ABAB, another is AABB,

■reproduce steps and example explanation
you can easily reproduce this problem on a solr collection with _default 
configset and exampledocs/books.csv data.

1. create a _default collection
bin/solr create -c books -s 2 -rf 2

2. post books.csv.
bin/post -c books example/exampledocs/books.csv

3. run following query.
http://localhost:8983/solr/books/select?q=%2B%28name_str%3AFoundation+OR+cat%3Abook+OR+name_str%3AJhereg+OR+cat%3Acd%29=query


I printed query parsing debug information.
you can tell "name_str:Foundation" is lost.

query: "name_str:Foundation OR cat:book OR name_str:Jhereg OR cat:cd"
(please note "Jhereg" is "4a 68 65 72 65 67" and "Foundation" is "46 6f 75 6e 
64 61 74 69 6f 6e")

  "debug":{
"rawquerystring":"+(name_str:Foundation OR cat:book OR name_str:Jhereg OR 
cat:cd)",
"querystring":"+(name_str:Foundation OR cat:book OR name_str:Jhereg OR 
cat:cd)",
"parsedquery":"+(cat:book cat:cd (name_str:[[4a 68 65 72 65 67] TO [4a 68 
65 72 65 67]]))",
"parsedquery_toString":"+(cat:book cat:cd name_str:[[4a 68 65 72 65 67] TO 
[4a 68 65 72 65 67]])",
"QParser":"LuceneQParser"}}


but for query: "name_str:Foundation OR name_str:Jhereg OR cat:book OR cat:cd",
everything is OK. "name_str:Foundation" is not lost.

  "debug":{
"rawquerystring":"+(name_str:Foundation OR name_str:Jhereg OR cat:book OR 
cat:cd)",
"querystring":"+(name_str:Foundation OR name_str:Jhereg OR cat:book OR 
cat:cd)",
"parsedquery":"+(cat:book cat:cd ((name_str:[[46 6f 75 6e 64 61 74 69 6f 
6e] TO [46 6f 75 6e 64 61 74 69 6f 6e]]) (name_str:[[4a 68 65 72 65 67] TO [4a 
68 65 72 65 67]])))",
"parsedquery_toString":"+(cat:book cat:cd (name_str:[[46 6f 75 6e 64 61 74 
69 6f 6e] TO [46 6f 75 6e 64 61 74 69 6f 6e]] name_str:[[4a 68 65 72 65 67] TO 
[4a 68 65 72 65 67]]))",
"QParser":"LuceneQParser"}}

http://localhost:8983/solr/books/select?q=%2B%28name_str%3AFoundation+OR+name_str%3AJhereg+OR+cat%3Abook+OR+cat%3Acd%29=query

we did a little bit research, and we wander if it is a bug of SolrQueryParser.
more specifically, we think if statement here might be wrong.
https://github.com/apache/lucene-solr/blob/branch_8_4/solr/core/src/java/org/apache/solr/parser/SolrQueryParserBase.java#L711

Could you please tell us if it is a bug, or it's just a wrong query statement.

Thanks,
Hongtai Xue


Position And Offset in Solr Query

2020-02-27 Thread ????
Hi all,


I am working in Chinese App. I am suffering a question of whether a PhraseQuery 
involved StartOffset and EndOffset of a term on SOLR.


For instance:
Text: ??
Indexing: ??|??||||??||??
position: 1 | 2| 3 | 4| 
4 | 5  | 5  | 5
querying: ??|??|||??


We have seen PhraseQuery base on Position. It works well expected for recalling 
nothing when the query is "|??".


Will PhraseQuery match documents according to 'StartOffset/EndOffset' of the 
terms? If so, it will filter the above document(|??||??).


The question is HOW can I do set something on PhraseQuery for working within 
term's offset.
Or, maybe we have the other approaches to do that.


Thanks very much in advance.



---
Daming
Apache SkyWalking

Re: Lucene query to Solr query

2020-01-22 Thread Edward Ribeiro
equivalent to "+(topics:29)^2 (topics:38)^3 +(-id:41135)", I mean. :)

Edward

On Wed, Jan 22, 2020 at 1:51 PM Edward Ribeiro 
wrote:

> Hi,
>
> A more or less equivalent query (using Solr's LuceneQParser) to
> "topics:29^2 AND (-id:41135) topics:38^3" would be:
>
> topics:29^2 AND (-id:41135) topics:38^3
>
> Edward
>
> On Mon, Jan 20, 2020 at 1:10 AM Arnold Bronley 
> wrote:
>
>> Hi,
>>
>> I have a Lucene query as following (toString represenation of Lucene's
>> Query object):
>>
>> +(topics:29)^2 (topics:38)^3 +(-id:41135)
>>
>> It works fine when I am using it as a lucene query in
>> SolrIndexSearcher.getDocList function.
>>
>> However, now I want to use it as a Solr query and query against a
>> collection. I tried to use the as-is representation from Lucene query
>> object's toString method but it does not work. How should I proceed?
>>
>


Re: Lucene query to Solr query

2020-01-22 Thread Edward Ribeiro
Hi,

A more or less equivalent query (using Solr's LuceneQParser) to
"topics:29^2 AND (-id:41135) topics:38^3" would be:

topics:29^2 AND (-id:41135) topics:38^3

Edward

On Mon, Jan 20, 2020 at 1:10 AM Arnold Bronley 
wrote:

> Hi,
>
> I have a Lucene query as following (toString represenation of Lucene's
> Query object):
>
> +(topics:29)^2 (topics:38)^3 +(-id:41135)
>
> It works fine when I am using it as a lucene query in
> SolrIndexSearcher.getDocList function.
>
> However, now I want to use it as a Solr query and query against a
> collection. I tried to use the as-is representation from Lucene query
> object's toString method but it does not work. How should I proceed?
>


Lucene query to Solr query

2020-01-19 Thread Arnold Bronley
Hi,

I have a Lucene query as following (toString represenation of Lucene's
Query object):

+(topics:29)^2 (topics:38)^3 +(-id:41135)

It works fine when I am using it as a lucene query in
SolrIndexSearcher.getDocList function.

However, now I want to use it as a Solr query and query against a
collection. I tried to use the as-is representation from Lucene query
object's toString method but it does not work. How should I proceed?


Odata filter query to Solr query

2020-01-15 Thread sambasivarao giddaluri
Hi All,

Do we have any library which can convert Odata filter to Solr Query
EX : $filter=Address eq 'Redmond' to   ?q=Address:Redmond

Any suggestions will help.

Thanks
Sambasiva


Re: Solr query fetching different results

2019-09-19 Thread Erick Erickson
Multiple replicas of the same shard will execute their autocommits at
different wall clock times.
Thus there may be a _temporary_ time when newly-indexed document is
found by a query that
happens to get served by replica1 but not by replica2. If you have a
timestamp in the doc, and
a soft commit interval of, say, 1 minute, you can test whether this is
the case by adding
=timestamp:[* TO NOW-2MINUTE]. In that case you should see identical returns.

Best,
Erick

On Thu, Sep 19, 2019 at 1:20 AM Jayadevan Maymala
 wrote:
>
> Hi all,
>
> There is something "strange' happening in our Solr cluster. If I execute a
> query from the server, via solarium client, I get one result. If I execute
> the same or similar query from admin Panel, I get another result. If I go
> to Admin Panel  - Collections - Select Collection and click "Reload", and
> then repeat the query, the result I get is consistent with  the one I get
> from the server via solarium client. So I picked the query that is getting
> executed, from Solr logs. Evidently, the query was going to different nodes.
>
> Query that went from Admin Panel, went to node 4 and fetched 0 documents
> 2019-09-19 05:02:04.549 INFO  (qtp434091818-205178)
> [c:paymetryproducts s:shard1 r:*core_node4*
> x:paymetryproducts_shard1_replica_n2] o.a.s.c.S.Request
> [paymetryproducts_shard1_replica_n2]  webapp=/solr path=/select
> params={q=category_id:5a0aeaeea6bc7239cc21ee39&_=1568868718031} *hits=0*
> status=0 QTime=0
>
>
> Query that went from solarium client running on a server, went to node 3
> and fetched 4 documents
>
> 2019-09-19 05:06:41.511 INFO  (qtp434091818-17)
> [c:paymetryproducts s:shard1 r:*core_node3*
> x:paymetryproducts_shard1_replica_n1] o.a.s.c.S.Request
> [paymetryproducts_shard1_replica_n1]  webapp=/solr path=/select
> params={q=category_id:5a0aeaeea6bc7239cc21ee39=flat=true=ID=0=90=json}
> *hits=4* status=0 QTime=104
>
> What could be causing this strange behaviour? How can I fix this?
> SOlr Version - 7.3
> Shard count: 1
> replicationFactor: 2
> maxShardsPerNode: 1
>
> Regards,
> Jayadevan


Solr query fetching different results

2019-09-18 Thread Jayadevan Maymala
Hi all,

There is something "strange' happening in our Solr cluster. If I execute a
query from the server, via solarium client, I get one result. If I execute
the same or similar query from admin Panel, I get another result. If I go
to Admin Panel  - Collections - Select Collection and click "Reload", and
then repeat the query, the result I get is consistent with  the one I get
from the server via solarium client. So I picked the query that is getting
executed, from Solr logs. Evidently, the query was going to different nodes.

Query that went from Admin Panel, went to node 4 and fetched 0 documents
2019-09-19 05:02:04.549 INFO  (qtp434091818-205178)
[c:paymetryproducts s:shard1 r:*core_node4*
x:paymetryproducts_shard1_replica_n2] o.a.s.c.S.Request
[paymetryproducts_shard1_replica_n2]  webapp=/solr path=/select
params={q=category_id:5a0aeaeea6bc7239cc21ee39&_=1568868718031} *hits=0*
status=0 QTime=0


Query that went from solarium client running on a server, went to node 3
and fetched 4 documents

2019-09-19 05:06:41.511 INFO  (qtp434091818-17)
[c:paymetryproducts s:shard1 r:*core_node3*
x:paymetryproducts_shard1_replica_n1] o.a.s.c.S.Request
[paymetryproducts_shard1_replica_n1]  webapp=/solr path=/select
params={q=category_id:5a0aeaeea6bc7239cc21ee39=flat=true=ID=0=90=json}
*hits=4* status=0 QTime=104

What could be causing this strange behaviour? How can I fix this?
SOlr Version - 7.3
Shard count: 1
replicationFactor: 2
maxShardsPerNode: 1

Regards,
Jayadevan


Re: Solr query exclude parent when no _childDocuments exists

2019-08-29 Thread Mikhail Khludnev
Hello.

_text_=kids  is not a query syntax Solr supports. Last time I've looked
into, mixing doc blocks and childfree docs is not supported. Anyway,
debugQuery=true usually helps to understand puzzling results.

On Thu, Aug 29, 2019 at 2:19 AM craftlogan  wrote:

> So in Solr I have a data structure that is made of of Restaurant Documents
> that have Deals attached as _childDocuments to a Restaurant. However with
> my
> current query
>
> {!parent which='content_type:restaurant'}_text_=kids
> =*,[child parentFilter=content_type:restaurant
> childFilter="content_type:deal AND day:Monday" limit=3]
>
> I will receive the response below but I want to exclude the bottom
> restaurant Bob Evans because I want to exclude any restaurant that has no
> child documents(deals) attached. Any help on this query will be greatly
> appreciated.
>
>
>
>
> {
>   id: "restaurant_7",
>   content_type: "restaurant",
>   deal_image: [
> "/storage/restaurants/images/BoneFire Smokehouse/BoneFire
> Smokehousedeal_image.png"
>   ],
>   name: [
> "BoneFire Smokehouse"
>   ],
>   cuisine: [
> " BBQ"
>   ],
>   description: [
> "In 2009, The Bone Fire Smokehouse was originally located in Kingsport,
> Tennessee. In 2012, sensing a real renaissance of economic and musical
> growth, this popular eatery and entertainment venue was moved to historic
> downtown Abingdon. The new Smokehouse opened in the former Withers Hardware
> Store building, and a new better Bone Fire Smokehouse came to life in
> another vintage location. They have become a popular choice for both
> residents and tourists, serving as an integral part of the growing Abingdon
> Dining and Musical Renaissance for the last five years."
>   ],
>   phone: [
> 42389589166
>   ],
>   city: "Abingdon",
>   state: "Virginia",
>   zip: 24210,
>   country: "United States",
>   full_address: [
> "260 W Main St, Abingdon, VA 24210, USA"
>   ],
>   latlon: "36.7089569,-81.9791766",
>   _version_: 1642803109735432200,
>   _childDocuments_: [
> {
>   id: "restaurant_7_deal_149",
>   deal: "Free Kid's Meal with Purchase of Adult Meal",
>   deal_type: "Kids",
>   content_type: "deal",
>   day: "Monday",
>   _version_: 1642803109735432200
> }
>   ]
> },
> {
>   id: "restaurant_5",
>   content_type: "restaurant",
>   deal_image: [
>
>
> "/Applications/MAMP/htdocs/dailyeatz/storage/app/public/restaurants/images/Bob
> Evans/Bob Evansdeal_image.png"
>   ],
>   name: [
> "Bob Evans"
>   ],
>   cuisine: [
> " American"
>   ],
>   description: [
> "Our success is built on the basics: high-quality food and heartfelt
> hospitality. In the words of our founder, Everybody is somebody at Bob
> Evans. We invite you to join us for a meal as we bring the values of the
> farm to the table by providing, flavorful meals at our place or yours."
>   ],
>   phone: [
> 42389589166
>   ],
>   city: "Johnson City",
>   state: "Tennessee",
>   zip: 37615,
>   country: "United States",
>   full_address: [
> "2801 Boones Creek Rd, Johnson City, TN 37615, USA"
>   ],
>   latlon: "36.3802985,-82.4254633",
>   _version_: 1642803106647376000
> }
>
>
>
> --
> Sent from: https://lucene.472066.n3.nabble.com/Solr-User-f472068.html
>


-- 
Sincerely yours
Mikhail Khludnev


Solr query exclude parent when no _childDocuments exists

2019-08-28 Thread craftlogan
So in Solr I have a data structure that is made of of Restaurant Documents
that have Deals attached as _childDocuments to a Restaurant. However with my
current query

{!parent which='content_type:restaurant'}_text_=kids
=*,[child parentFilter=content_type:restaurant
childFilter="content_type:deal AND day:Monday" limit=3]

I will receive the response below but I want to exclude the bottom
restaurant Bob Evans because I want to exclude any restaurant that has no
child documents(deals) attached. Any help on this query will be greatly
appreciated.




{
  id: "restaurant_7",
  content_type: "restaurant",
  deal_image: [
"/storage/restaurants/images/BoneFire Smokehouse/BoneFire
Smokehousedeal_image.png"
  ],
  name: [
"BoneFire Smokehouse"
  ],
  cuisine: [
" BBQ"
  ],
  description: [
"In 2009, The Bone Fire Smokehouse was originally located in Kingsport,
Tennessee. In 2012, sensing a real renaissance of economic and musical
growth, this popular eatery and entertainment venue was moved to historic
downtown Abingdon. The new Smokehouse opened in the former Withers Hardware
Store building, and a new better Bone Fire Smokehouse came to life in
another vintage location. They have become a popular choice for both
residents and tourists, serving as an integral part of the growing Abingdon
Dining and Musical Renaissance for the last five years."
  ],
  phone: [
42389589166
  ],
  city: "Abingdon",
  state: "Virginia",
  zip: 24210,
  country: "United States",
  full_address: [
"260 W Main St, Abingdon, VA 24210, USA"
  ],
  latlon: "36.7089569,-81.9791766",
  _version_: 1642803109735432200,
  _childDocuments_: [
{
  id: "restaurant_7_deal_149",
  deal: "Free Kid's Meal with Purchase of Adult Meal",
  deal_type: "Kids",
  content_type: "deal",
  day: "Monday",
  _version_: 1642803109735432200
}
  ]
},
{
  id: "restaurant_5",
  content_type: "restaurant",
  deal_image: [
   
"/Applications/MAMP/htdocs/dailyeatz/storage/app/public/restaurants/images/Bob
Evans/Bob Evansdeal_image.png"
  ],
  name: [
"Bob Evans"
  ],
  cuisine: [
" American"
  ],
  description: [
"Our success is built on the basics: high-quality food and heartfelt
hospitality. In the words of our founder, Everybody is somebody at Bob
Evans. We invite you to join us for a meal as we bring the values of the
farm to the table by providing, flavorful meals at our place or yours."
  ],
  phone: [
42389589166
  ],
  city: "Johnson City",
  state: "Tennessee",
  zip: 37615,
  country: "United States",
  full_address: [
"2801 Boones Creek Rd, Johnson City, TN 37615, USA"
  ],
  latlon: "36.3802985,-82.4254633",
  _version_: 1642803106647376000
}



--
Sent from: https://lucene.472066.n3.nabble.com/Solr-User-f472068.html


Re: Solr query is very slow -- guidance would be much appreciated

2019-08-22 Thread Erick Erickson
If you’re literally including the quotes, i.e. q=“one two”, then you’re doing 
phrase searches which are more complex and will take longer. q=field:one AND 
field:two is a straight boolean query. Also, what query parser are you using? 
If it’s edismax, then you’re searching across multiple fields. Try adding 
=query and take a look at the parsed query...

That said, these times are way longer than I would expect once the searcher is 
warmed. You can tell nothing from a single query executed after a new searcher 
is opened since the relevant parts of the index have to be read from disk. What 
happens with queries 2-N? (NOTE: don’t run the exact same query or you’ll hit 
the queryResultCache and get wonderful response times that are meaningless).

How much physical memory is on the machine and how much are you allocating to 
the JVM? Also, how much disk space does your index occupy and what kind (SSD or 
spinning disk)?

Bottom line: These kinds of queries should be way faster than that, even if 
they’re phrase queries.

Best,
Erick

> On Aug 22, 2019, at 3:30 AM, Muthu Thenappan 
>  wrote:
> 
> Hi,
> 
> when I run "q=one" the Qtime is around 200ms however when I run 2 or 3 words 
> the run time exponentially increases eg: "q=two words" or "q=apple orange 
> berry" resulting in 3s to 10s.
> 
> I have indexed around 10 milion document with each document containing around 
> 100 words. I am using that usual filter factories like lowercase/synonym/stop 
> filter. Found that search result retrieving part taking long time and not the 
> faceting/highlighting/sort... see below result.
> 
> "timing":{
>   "time":3435.0,
>   "prepare":{
> "time":0.0,
> "query":{
>   "time":0.0},
> "facet":{
>   "time":0.0},
> "facet_module":{
>   "time":0.0},
> "mlt":{
>   "time":0.0},
> "highlight":{
>   "time":0.0},
> "stats":{
>   "time":0.0},
> "expand":{
>   "time":0.0},
> "terms":{
>   "time":0.0},
> "spellcheck":{
>   "time":0.0},
> "debug":{
>   "time":0.0}},
>   "process":{
> "time":3434.0,
> "query":{
>   "time":3316.0},
> "facet":{
>   "time":0.0},
> "facet_module":{
>   "time":0.0},
> "mlt":{
>   "time":0.0},
> "highlight":{
>   "time":116.0},
> "stats":{
>   "time":0.0},
> "expand":{
>   "time":0.0},
> "terms":{
>   "time":0.0},
> "spellcheck":{
>   "time":1.0},
> "debug":{
>   "time":0.0}
> Caching is working good. However I did not change any factory default 
> settings for caching.
> 
> Used jconsole to check GC time which is around 0.23 sec.
> 
> I would like query time to fall below 1 sec. 
> 
> However not sure where else to look? Any guidance will be much appreciated. 
> Thank you.
> 
> 
> 
> Kind Regards,
> Muthu Thenappan
>  
>  
> 
>  
> 
> 
> 
> This email, including any attachments sent with it, is confidential and for 
> the sole use of the intended recipient(s). This confidentiality is not waived 
> or lost, if you receive it and you are not the intended recipient(s), or if 
> it is transmitted/received in error.
> 
> Any unauthorised use, alteration, disclosure, distribution or review of this 
> email is strictly prohibited. The information contained in this email, 
> including any attachment sent with it, may be subject to a statutory duty of 
> confidentiality if it relates to health service matters.
> 
> If you are not the intended recipient(s), or if you have received this email 
> in error, you are asked to immediately notify the sender by telephone collect 
> on Australia +61 1800 198 175 or by return email. You should also delete this 
> email, and any copies, from your computer system network and destroy any hard 
> copies produced.
> 
> If not an intended recipient of this email, you must not copy, distribute or 
> take any action(s) that relies on it; any form of disclosure, modification, 
> distribution and/or publication of this email is also prohibited.
> 
> Although Queensland Health takes all reasonable steps to ensure this email 
> does not contain malicious software, Queensland Health does not accept 
> responsibility for the consequences if any person's computer inadvertently 
> suffers any disruption to services, loss of information, harm or is infected 
> with a virus, other malicious computer programme or code that may occur as a 
> consequence of receiving this email.
> 
> Unless stated otherwise, this email represents only the views of the sender 
> and not the views of the Queensland Government.
> 
> **
> 



Solr query is very slow -- guidance would be much appreciated

2019-08-22 Thread Muthu Thenappan
Hi,

when I run "q=one" the Qtime is around 200ms however when I run 2 or 3 words 
the run time exponentially increases eg: "q=two words" or "q=apple orange 
berry" resulting in 3s to 10s.

I have indexed around 10 milion document with each document containing around 
100 words. I am using that usual filter factories like lowercase/synonym/stop 
filter. Found that search result retrieving part taking long time and not the 
faceting/highlighting/sort... see below result.
"timing":{
  "time":3435.0,
  "prepare":{
"time":0.0,
"query":{
  "time":0.0},
"facet":{
  "time":0.0},
"facet_module":{
  "time":0.0},
"mlt":{
  "time":0.0},
"highlight":{
  "time":0.0},
"stats":{
  "time":0.0},
"expand":{
  "time":0.0},
"terms":{
  "time":0.0},
"spellcheck":{
  "time":0.0},
"debug":{
  "time":0.0}},
  "process":{
"time":3434.0,
"query":{
  "time":3316.0},
"facet":{
  "time":0.0},
"facet_module":{
  "time":0.0},
"mlt":{
  "time":0.0},
"highlight":{
  "time":116.0},
"stats":{
  "time":0.0},
"expand":{
  "time":0.0},
"terms":{
  "time":0.0},
"spellcheck":{
  "time":1.0},
"debug":{
  "time":0.0}

Caching is working good. However I did not change any factory default settings 
for caching.

Used jconsole to check GC time which is around 0.23 sec.

I would like query time to fall below 1 sec.

However not sure where else to look? Any guidance will be much appreciated. 
Thank you.

[cid:image001.png@01D5590F.5927A6D0]
Kind Regards,
Muthu Thenappan








This email, including any attachments sent with it, is confidential and for the 
sole use of the intended recipient(s). This confidentiality is not waived or 
lost, if you receive it and you are not the intended recipient(s), or if it is 
transmitted/received in error.

Any unauthorised use, alteration, disclosure, distribution or review of this 
email is strictly prohibited. The information contained in this email, 
including any attachment sent with it, may be subject to a statutory duty of 
confidentiality if it relates to health service matters.

If you are not the intended recipient(s), or if you have received this email in 
error, you are asked to immediately notify the sender by telephone collect on 
Australia +61 1800 198 175 or by return email. You should also delete this 
email, and any copies, from your computer system network and destroy any hard 
copies produced.

If not an intended recipient of this email, you must not copy, distribute or 
take any action(s) that relies on it; any form of disclosure, modification, 
distribution and/or publication of this email is also prohibited.

Although Queensland Health takes all reasonable steps to ensure this email does 
not contain malicious software, Queensland Health does not accept 
responsibility for the consequences if any person's computer inadvertently 
suffers any disruption to services, loss of information, harm or is infected 
with a virus, other malicious computer programme or code that may occur as a 
consequence of receiving this email.

Unless stated otherwise, this email represents only the views of the sender and 
not the views of the Queensland Government.

**


Solr query with best match returning high score

2019-07-03 Thread mganeshs
Hello Experts,

I have a following query

product:TV or os:Android or size:(55 60 65) or brand:samsung or issmart:yes
or ram:[4 TO *] or rate:[10 TO *] or bezel : no or sound:dolby

In Total there are 9 conditions. 

Now I need the document with best match should return top. Best match I mean
which satisfies all the 9 conditions ( like using AND instead of or ).
document where product is tv and os is android and size is 55 and brand is
samsung and issmart is yes and rame is 4 and rate is 115000 and bezel is no
and sound is dolby. 

Next could be documents which matches any of 8 conditions. I also have
scenerio with boosting certain fields ( brand:samsung) should have some
priority, so i can give boost for this.

Let me know how this could be achieved. Normal scoring is working bit
differently. Term which is rare among all the documents is having high
scoring. How can we disable that part. 




--
Sent from: http://lucene.472066.n3.nabble.com/Solr-User-f472068.html


Re: Solr query with long query

2019-05-31 Thread Erick Erickson
I’m talking about the filterCache. You said you were using this in a “filter 
query”, which I assume is an “fq” clause, which is automatically cached in the 
filterCache.

It would help a lot if you told us two things:
1> what the clause looks like. You say 1,500 strings. How are you assmebling 
them?
2> what the field definition is…

Best,
Erick

> On May 31, 2019, at 12:53 AM, Venkateswarlu Bommineni  
> wrote:
> 
> Tim/Eric,
> 
> @Tim : We do have category field in existing solr configuration. So the
> existing functionality is we will query based on category and get the
> results from solr and display them on PCAT.
> 
> But as per new requirement , we need to invoke third party service to fetch
> the personalized products and send them to Solr get the results. that is
> the reason i was tying to send those products in solr query.
> 
> @Eric : we are using Solr 7.2.1 version. I will check on solr cache.
> 
> Thanks,
> Venkat.
> 
> On Thu, May 30, 2019 at 7:53 PM Erick Erickson 
> wrote:
> 
>> What version of Solr? Recent versions automatically use terms query parser
>> for large, simple or clauses. Do look into using it anyway. And I'd set
>> cache=false because I doubt you'll ever get a cache hit...
>> 
>> On Thu, May 30, 2019, 16:21 Venkateswarlu Bommineni 
>> wrote:
>> 
>>> Hello Team,
>>> 
>>> I have got a requirement to send many strings (~1500) in the filter query
>>> param to the solr.
>>> 
>>> Can you please provide any suggestions/precautions we need to take care
>> in
>>> this particular scenario.
>>> 
>>> Thanks,
>>> Venkat.
>>> 
>> 



Re: Solr query with long query

2019-05-30 Thread Venkateswarlu Bommineni
Tim/Eric,

@Tim : We do have category field in existing solr configuration. So the
existing functionality is we will query based on category and get the
results from solr and display them on PCAT.

But as per new requirement , we need to invoke third party service to fetch
the personalized products and send them to Solr get the results. that is
the reason i was tying to send those products in solr query.

@Eric : we are using Solr 7.2.1 version. I will check on solr cache.

Thanks,
Venkat.

On Thu, May 30, 2019 at 7:53 PM Erick Erickson 
wrote:

> What version of Solr? Recent versions automatically use terms query parser
> for large, simple or clauses. Do look into using it anyway. And I'd set
> cache=false because I doubt you'll ever get a cache hit...
>
> On Thu, May 30, 2019, 16:21 Venkateswarlu Bommineni 
> wrote:
>
> > Hello Team,
> >
> > I have got a requirement to send many strings (~1500) in the filter query
> > param to the solr.
> >
> > Can you please provide any suggestions/precautions we need to take care
> in
> > this particular scenario.
> >
> > Thanks,
> > Venkat.
> >
>


Re: Solr query with long query

2019-05-30 Thread Erick Erickson
What version of Solr? Recent versions automatically use terms query parser
for large, simple or clauses. Do look into using it anyway. And I'd set
cache=false because I doubt you'll ever get a cache hit...

On Thu, May 30, 2019, 16:21 Venkateswarlu Bommineni 
wrote:

> Hello Team,
>
> I have got a requirement to send many strings (~1500) in the filter query
> param to the solr.
>
> Can you please provide any suggestions/precautions we need to take care in
> this particular scenario.
>
> Thanks,
> Venkat.
>


Re: Solr query with long query

2019-05-30 Thread Tim Casey
Venkat,

There is another way to do this.  If you have a category of "thing" you are
attempting to filter over, then you create a query and tag the documents
with this category.  So, create a 'categories' field and append 'thing' to
the field updating the field if need be.  (Be wary of over generation if
one of the categories turns out to be 'thin').

Then in the filter query you can query over a category, or simply require a
category:thing to be in the query.

tim


On Thu, May 30, 2019 at 3:33 PM Shawn Heisey  wrote:

> On 5/30/2019 4:13 PM, Venkateswarlu Bommineni wrote:
> > Thank you guys for quick response.
> >
> > I was able to query solr by sending 1500 products using solrJ with http
> > post method.
> >
> > But I had to change maxBooleanClauses to 4096 from default 1024.
> >
> > But I wanted to check with you guys that, will there be any performance
> > issues by changing maxBooleanClauses to 4096.
> >   Please help me here.
>
> Lucene sets the limit to 1024 basically to act as a short-circuit to
> protect the system against bugs in user code causing the query engine to
> explode by sending thousands of clauses when that wasn't what was intended.
>
> Using a large number of clauses *can* cause performance issues.  But if
> you need to use them, you need to use them, and in that case you'll need
> to increase the limit, and just take the performance hit.
>
> The terms query parser will generally run faster than a large number of
> boolean OR clauses, and return the same results.  But if your query is
> not just OR (also known as SHOULD) clauses, you probably won't be able
> to use the terms parser.
>
>
> https://lucene.apache.org/solr/guide/7_7/other-parsers.html#terms-query-parser
>
> Thanks,
> Shawn
>


Re: Solr query with long query

2019-05-30 Thread Shawn Heisey

On 5/30/2019 4:13 PM, Venkateswarlu Bommineni wrote:

Thank you guys for quick response.

I was able to query solr by sending 1500 products using solrJ with http
post method.

But I had to change maxBooleanClauses to 4096 from default 1024.

But I wanted to check with you guys that, will there be any performance
issues by changing maxBooleanClauses to 4096.
  Please help me here.


Lucene sets the limit to 1024 basically to act as a short-circuit to 
protect the system against bugs in user code causing the query engine to 
explode by sending thousands of clauses when that wasn't what was intended.


Using a large number of clauses *can* cause performance issues.  But if 
you need to use them, you need to use them, and in that case you'll need 
to increase the limit, and just take the performance hit.


The terms query parser will generally run faster than a large number of 
boolean OR clauses, and return the same results.  But if your query is 
not just OR (also known as SHOULD) clauses, you probably won't be able 
to use the terms parser.


https://lucene.apache.org/solr/guide/7_7/other-parsers.html#terms-query-parser

Thanks,
Shawn


Re: Solr query with long query

2019-05-30 Thread Venkateswarlu Bommineni
Thank you guys for quick response.

I was able to query solr by sending 1500 products using solrJ with http
post method.

But I had to change maxBooleanClauses to 4096 from default 1024.

But I wanted to check with you guys that, will there be any performance
issues by changing maxBooleanClauses to 4096.
 Please help me here.


Thanks,
Venkat.

On Thu, May 30, 2019 at 2:46 PM Shawn Heisey  wrote:

> On 5/30/2019 2:20 PM, Venkateswarlu Bommineni wrote:
> > I have got a requirement to send many strings (~1500) in the filter query
> > param to the solr.
> >
> > Can you please provide any suggestions/precautions we need to take care
> in
> > this particular scenario.
>
> You'll probably want to send that as a POST, where the URL parameters
> are in the HTTP body, not the URL.  With a standard GET request, there
> is no body.  Like most web servers, the Jetty included with Solr has an
> HTTP header size limit of 8192 bytes, which affects how large a URL you
> can use.  The default size limit on the request body for POST requests
> is two megabytes.
>
> Depending on which query parser it ends up using, you might also need to
> increase maxBooleanClauses in all your solrconfig.xml files.  If this is
> a situation where it's all "OR" clauses, it's recommended to use the
> terms query parser, which has a minimum Solr version requirement of
> 4.10.  That query parser doesn't care about maxBooleanClauses.  Some
> later versions of Solr will automatically convert lots of OR clauses
> into the type of query used by the terms parser, but I do not know which
> versions do that.
>
> Thanks,
> Shawn
>


Re: Solr query with long query

2019-05-30 Thread Shawn Heisey

On 5/30/2019 2:20 PM, Venkateswarlu Bommineni wrote:

I have got a requirement to send many strings (~1500) in the filter query
param to the solr.

Can you please provide any suggestions/precautions we need to take care in
this particular scenario.


You'll probably want to send that as a POST, where the URL parameters 
are in the HTTP body, not the URL.  With a standard GET request, there 
is no body.  Like most web servers, the Jetty included with Solr has an 
HTTP header size limit of 8192 bytes, which affects how large a URL you 
can use.  The default size limit on the request body for POST requests 
is two megabytes.


Depending on which query parser it ends up using, you might also need to 
increase maxBooleanClauses in all your solrconfig.xml files.  If this is 
a situation where it's all "OR" clauses, it's recommended to use the 
terms query parser, which has a minimum Solr version requirement of 
4.10.  That query parser doesn't care about maxBooleanClauses.  Some 
later versions of Solr will automatically convert lots of OR clauses 
into the type of query used by the terms parser, but I do not know which 
versions do that.


Thanks,
Shawn


Re: Solr query with long query

2019-05-30 Thread Alexandre Rafalovitch
You can use POST instead of GET.

But you may also want to see if you can refactor those 1500 strings somehow.

If you don't use it already, maybe Terms query parser could be useful:
https://lucene.apache.org/solr/guide/7_7/other-parsers.html#terms-query-parser

Also, if at least some of those numbers don't change, maybe you can
store them Solr side with default request parameters or even using
Request Param API with useParams:
https://lucene.apache.org/solr/guide/7_7/request-parameters-api.html

Regards,
   Alex.

On Thu, 30 May 2019 at 16:21, Venkateswarlu Bommineni  wrote:
>
> Hello Team,
>
> I have got a requirement to send many strings (~1500) in the filter query
> param to the solr.
>
> Can you please provide any suggestions/precautions we need to take care in
> this particular scenario.
>
> Thanks,
> Venkat.


Solr query with long query

2019-05-30 Thread Venkateswarlu Bommineni
Hello Team,

I have got a requirement to send many strings (~1500) in the filter query
param to the solr.

Can you please provide any suggestions/precautions we need to take care in
this particular scenario.

Thanks,
Venkat.


Re: Solr query takes a too much time in Solr 6.1.0

2019-05-13 Thread Shawn Heisey

On 5/13/2019 2:51 AM, vishal patel wrote:

Executing an identical query again will likely satisfy the query from Solr's 
caches.  Solr won't need to talk to the actual index, and it will be REALLY 
fast.  Even a massively complex query, if it is cached, will be fast.


All caches are disabled in our schema file because of our indexing and 
searching ratio is high in our live environment.


Solr's caches are defined in solrconfig.xml, not the schema.  I mention 
this so you can be sure you have the config you think you have.


If your caches are in fact disabled, I am betting that the index data 
relevant to that query is getting pushed out of your OS disk cache. 
When you execute the same query twice, all the data required by Lucene 
to execute that query is available in the OS disk cache, so the second 
time is quick because Lucene is pulling the information from RAM, which 
is MUCH faster than disk.


Fixing that usually requires adding more memory to the server.

Thanks,
Shawn


Re: Solr query takes a too much time in Solr 6.1.0

2019-05-13 Thread Erick Erickson
Oh, and you can freely set docValues=true _and_ have indexed=true on the same 
field, Solr will use the right structure for the operations it needs. HOWEVER: 
if you change that definition you _must_ re-index the entire collection.

> On May 13, 2019, at 1:22 AM, Bernd Fehling  
> wrote:
> 
> Your "sort" parameter has "sort=id+desc,id+desc".
> 1. It doesn't make sense to have a sort on "id" in descending order twice.
> 2. Be aware that the id field has the highest cadinality.
> 3. To speedup sorting have a separate field with docValues=true for sorting.
>   E.g.
>  multiValued="false" />
>  docValues="true" useDocValuesAsStored="false" />
> 
> 
> Regards
> Bernd
> 
> 
> Am 10.05.19 um 15:32 schrieb vishal patel:
>> We have 2 shards and 2 replicas in Live environment. we have multiple 
>> collections.
>> Some times some query takes much time(QTime=52552).  There are so many 
>> documents indexing and searching within milliseconds.
>> When we executed the same query again using admin panel, it does not take a 
>> much time and it completes within 20 milliseconds.
>> My Solr Logs :
>> 2019-05-10 09:48:56.744 INFO  (qtp1239731077-128223) [c:actionscomments 
>> s:shard1 r:core_node1 x:actionscomments] o.a.s.c.S.Request [actionscomments] 
>>  webapp=/solr path=/select 
>> params={q=%2Bproject_id:(2102117)%2Brecipient_id:(4642365)+%2Bentity_type:(1)+-action_id:(20+32)+%2Baction_status:(0)+%2Bis_active:(true)+%2B(is_formtype_active:true)+%2B(appType:1)=s1.example.com:8983/solr/actionscomments|s1r1.example.com:8983/solr/actionscomments,s2.example.com:8983/solr/actionscomments|s2r1.example.com:8983/solr/actionscomments=off=true=id=0=id+desc,id+desc==1}
>>  hits=198 status=0 QTime=52552
>> 2019-05-10 09:48:56.744 INFO  (qtp1239731077-127998) [c:actionscomments 
>> s:shard1 r:core_node1 x:actionscomments] o.a.s.c.S.Request [actionscomments] 
>>  webapp=/solr path=/select 
>> params={q=%2Bproject_id:(2102117)%2Brecipient_id:(4642365)+%2Bentity_type:(1)+-action_id:(20+32)+%2Baction_status:(0)+%2Bis_active:(true)+%2Bdue_date:[2019-05-09T19:30:00Z+TO+2019-05-09T19:30:00Z%2B1DAY]+%2B(is_formtype_active:true)+%2B(appType:1)=s1.example.com:8983/solr/actionscomments|s1r1.example.com:8983/solr/actionscomments,s2.example.com:8983/solr/actionscomments|s2r1.example.com:8983/solr/actionscomments=off=true=id=0=id+desc,id+desc==1}
>>  hits=0 status=0 QTime=51970
>> 2019-05-10 09:48:56.746 INFO  (qtp1239731077-128224) [c:actionscomments 
>> s:shard1 r:core_node1 x:actionscomments] o.a.s.c.S.Request [actionscomments] 
>>  webapp=/solr path=/select 
>> params={q=%2Bproject_id:(2121600+2115171+2104206)%2Brecipient_id:(2834330)+%2Bentity_type:(2)+-action_id:(20+32)+%2Baction_status:(0)+%2Bis_active:(true)+%2Bdue_date:[2019-05-10T00:00:00Z+TO+2019-05-10T00:00:00Z%2B1DAY]=s1.example.com:8983/solr/actionscomments|s1r1.example.com:8983/solr/actionscomments,s2.example.com:8983/solr/actionscomments|s2r1.example.com:8983/solr/actionscomments=off=true=id=0=id+desc,id+desc==1}
>>  hits=98 status=0 QTime=51402
>> My schema fields below :
>> > multiValued="false"/>
>> 
>> 
>> 
>> 
>> 
>> 
>> > />
>> 
>> 
>> What could be a problem here? why the query takes too much time at that time?
>> Sent from Outlook



Re: Solr query takes a too much time in Solr 6.1.0

2019-05-13 Thread Erick Erickson
That indicates you’re hitting the queryResultCache, which is also supported by 
your statement about how fast queries are returned after they’re run once. Look 
at admin UI>>select core>>stats/plugins>>cache>>queryResultCache and you’ll 
probably see a very hit ratio, approaching 1.

You also have (in another e-mail) 7 zookeepers for a small system. This is 
severe overkill and gains you nothing. The only times I’ve seen ZooKeepers need 
more than three is when there are 100s of nodes.

Best,
Erick

> On May 13, 2019, at 7:10 AM, vishal patel  
> wrote:
> 
> there are many searching and indexing within a millisecond



Re: Solr query takes a too much time in Solr 6.1.0

2019-05-13 Thread vishal patel
In our live environment, there are many searching and indexing within a 
millisecond. we used facet and sorting in Query.

> 3. To speedup sorting have a separate field with docValues=true for sorting.

Is it necessary or useful to make a separate field if I used this field in 
sorting or facet?
If I do not do a separate field then any performance issue when the same field 
will search in a query?

Sent from Outlook<http://aka.ms/weboutlook>

From: Bernd Fehling 
Sent: Monday, May 13, 2019 11:52 AM
To: solr-user@lucene.apache.org
Subject: Re: Solr query takes a too much time in Solr 6.1.0

Your "sort" parameter has "sort=id+desc,id+desc".
1. It doesn't make sense to have a sort on "id" in descending order twice.
2. Be aware that the id field has the highest cadinality.
3. To speedup sorting have a separate field with docValues=true for sorting.
E.g.




Regards
Bernd


Am 10.05.19 um 15:32 schrieb vishal patel:
> We have 2 shards and 2 replicas in Live environment. we have multiple 
> collections.
> Some times some query takes much time(QTime=52552).  There are so many 
> documents indexing and searching within milliseconds.
> When we executed the same query again using admin panel, it does not take a 
> much time and it completes within 20 milliseconds.
>
> My Solr Logs :
> 2019-05-10 09:48:56.744 INFO  (qtp1239731077-128223) [c:actionscomments 
> s:shard1 r:core_node1 x:actionscomments] o.a.s.c.S.Request [actionscomments]  
> webapp=/solr path=/select 
> params={q=%2Bproject_id:(2102117)%2Brecipient_id:(4642365)+%2Bentity_type:(1)+-action_id:(20+32)+%2Baction_status:(0)+%2Bis_active:(true)+%2B(is_formtype_active:true)+%2B(appType:1)=s1.example.com:8983/solr/actionscomments|s1r1.example.com:8983/solr/actionscomments,s2.example.com:8983/solr/actionscomments|s2r1.example.com:8983/solr/actionscomments=off=true=id=0=id+desc,id+desc==1}
>  hits=198 status=0 QTime=52552
> 2019-05-10 09:48:56.744 INFO  (qtp1239731077-127998) [c:actionscomments 
> s:shard1 r:core_node1 x:actionscomments] o.a.s.c.S.Request [actionscomments]  
> webapp=/solr path=/select 
> params={q=%2Bproject_id:(2102117)%2Brecipient_id:(4642365)+%2Bentity_type:(1)+-action_id:(20+32)+%2Baction_status:(0)+%2Bis_active:(true)+%2Bdue_date:[2019-05-09T19:30:00Z+TO+2019-05-09T19:30:00Z%2B1DAY]+%2B(is_formtype_active:true)+%2B(appType:1)=s1.example.com:8983/solr/actionscomments|s1r1.example.com:8983/solr/actionscomments,s2.example.com:8983/solr/actionscomments|s2r1.example.com:8983/solr/actionscomments=off=true=id=0=id+desc,id+desc==1}
>  hits=0 status=0 QTime=51970
> 2019-05-10 09:48:56.746 INFO  (qtp1239731077-128224) [c:actionscomments 
> s:shard1 r:core_node1 x:actionscomments] o.a.s.c.S.Request [actionscomments]  
> webapp=/solr path=/select 
> params={q=%2Bproject_id:(2121600+2115171+2104206)%2Brecipient_id:(2834330)+%2Bentity_type:(2)+-action_id:(20+32)+%2Baction_status:(0)+%2Bis_active:(true)+%2Bdue_date:[2019-05-10T00:00:00Z+TO+2019-05-10T00:00:00Z%2B1DAY]=s1.example.com:8983/solr/actionscomments|s1r1.example.com:8983/solr/actionscomments,s2.example.com:8983/solr/actionscomments|s2r1.example.com:8983/solr/actionscomments=off=true=id=0=id+desc,id+desc==1}
>  hits=98 status=0 QTime=51402
>
>
> My schema fields below :
>
>  multiValued="false"/>
> 
> 
> 
> 
> 
> 
>  />
> 
> 
>
> What could be a problem here? why the query takes too much time at that time?
>
> Sent from Outlook<http://aka.ms/weboutlook>
>


Re: Solr query takes a too much time in Solr 6.1.0

2019-05-13 Thread vishal patel
Thanks for the reply.

> Executing an identical query again will likely satisfy the query from Solr's 
> caches.  Solr won't need to talk to the actual index, and it will be REALLY 
> fast.  Even a massively complex query, if it is cached, will be fast.

All caches are disabled in our schema file because of our indexing and 
searching ratio is high in our live environment.


Sent from Outlook<http://aka.ms/weboutlook>

From: Shawn Heisey 
Sent: Friday, May 10, 2019 9:32 PM
To: solr-user@lucene.apache.org
Subject: Re: Solr query takes a too much time in Solr 6.1.0

On 5/10/2019 7:32 AM, vishal patel wrote:
> We have 2 shards and 2 replicas in Live environment. we have multiple 
> collections.
> Some times some query takes much time(QTime=52552).  There are so many 
> documents indexing and searching within milliseconds.

There could be any number of causes of slow performance.

A common reason is not having enough spare memory in the machine to
allow the operating system to cache the index data.  This is memory NOT
allocated by programs (including Solr).

Another common reason is that the heap size is too small, which causes
Java to frequently perform full garbage collections, which will REALLY
kill performance.

Since there's very little information here, it's difficult for us to
diagnose the cause.  Here's a wiki page about performance problems:

https://wiki.apache.org/solr/SolrPerformanceProblems

(Disclaimer:  I am the principal author of that page)

> When we executed the same query again using admin panel, it does not take a 
> much time and it completes within 20 milliseconds.

Executing an identical query again will likely satisfy the query from
Solr's caches.  Solr won't need to talk to the actual index, and it will
be REALLY fast.  Even a massively complex query, if it is cached, will
be fast.

Running the information from your logs through a URL decoder, this is
what I found:

q=+project_id:(2102117)+recipient_id:(4642365) +entity_type:(1)
-action_id:(20 32) +action_status:(0) +is_active:(true)
+(is_formtype_active:true) +(appType:1)

If all of those fields are indexed, then I would not expect a properly
sized server to be slow.  If any of those fields are indexed=false and
have docValues, then it could be a schema configuration issue.
Searching docValues does work, but it's really slow.

Your query does have an empty fq ... "fq=" ... I do not know whether
that's problematic.  Try it without that to verify.  I would not expect
it to cause problems, but I can't be sure.

Thanks,
Shawn


Re: Solr query takes a too much time in Solr 6.1.0

2019-05-13 Thread Bernd Fehling

Your "sort" parameter has "sort=id+desc,id+desc".
1. It doesn't make sense to have a sort on "id" in descending order twice.
2. Be aware that the id field has the highest cadinality.
3. To speedup sorting have a separate field with docValues=true for sorting.
   E.g.




Regards
Bernd


Am 10.05.19 um 15:32 schrieb vishal patel:

We have 2 shards and 2 replicas in Live environment. we have multiple 
collections.
Some times some query takes much time(QTime=52552).  There are so many 
documents indexing and searching within milliseconds.
When we executed the same query again using admin panel, it does not take a 
much time and it completes within 20 milliseconds.

My Solr Logs :
2019-05-10 09:48:56.744 INFO  (qtp1239731077-128223) [c:actionscomments s:shard1 r:core_node1 
x:actionscomments] o.a.s.c.S.Request [actionscomments]  webapp=/solr path=/select 
params={q=%2Bproject_id:(2102117)%2Brecipient_id:(4642365)+%2Bentity_type:(1)+-action_id:(20+32)+%2Baction_status:(0)+%2Bis_active:(true)+%2B(is_formtype_active:true)+%2B(appType:1)=s1.example.com:8983/solr/actionscomments|s1r1.example.com:8983/solr/actionscomments,s2.example.com:8983/solr/actionscomments|s2r1.example.com:8983/solr/actionscomments=off=true=id=0=id+desc,id+desc==1}
 hits=198 status=0 QTime=52552
2019-05-10 09:48:56.744 INFO  (qtp1239731077-127998) [c:actionscomments s:shard1 r:core_node1 
x:actionscomments] o.a.s.c.S.Request [actionscomments]  webapp=/solr path=/select 
params={q=%2Bproject_id:(2102117)%2Brecipient_id:(4642365)+%2Bentity_type:(1)+-action_id:(20+32)+%2Baction_status:(0)+%2Bis_active:(true)+%2Bdue_date:[2019-05-09T19:30:00Z+TO+2019-05-09T19:30:00Z%2B1DAY]+%2B(is_formtype_active:true)+%2B(appType:1)=s1.example.com:8983/solr/actionscomments|s1r1.example.com:8983/solr/actionscomments,s2.example.com:8983/solr/actionscomments|s2r1.example.com:8983/solr/actionscomments=off=true=id=0=id+desc,id+desc==1}
 hits=0 status=0 QTime=51970
2019-05-10 09:48:56.746 INFO  (qtp1239731077-128224) [c:actionscomments s:shard1 r:core_node1 
x:actionscomments] o.a.s.c.S.Request [actionscomments]  webapp=/solr path=/select 
params={q=%2Bproject_id:(2121600+2115171+2104206)%2Brecipient_id:(2834330)+%2Bentity_type:(2)+-action_id:(20+32)+%2Baction_status:(0)+%2Bis_active:(true)+%2Bdue_date:[2019-05-10T00:00:00Z+TO+2019-05-10T00:00:00Z%2B1DAY]=s1.example.com:8983/solr/actionscomments|s1r1.example.com:8983/solr/actionscomments,s2.example.com:8983/solr/actionscomments|s2r1.example.com:8983/solr/actionscomments=off=true=id=0=id+desc,id+desc==1}
 hits=98 status=0 QTime=51402


My schema fields below :












What could be a problem here? why the query takes too much time at that time?

Sent from Outlook



Re: Solr query takes a too much time in Solr 6.1.0

2019-05-10 Thread Shawn Heisey

On 5/10/2019 7:32 AM, vishal patel wrote:

We have 2 shards and 2 replicas in Live environment. we have multiple 
collections.
Some times some query takes much time(QTime=52552).  There are so many 
documents indexing and searching within milliseconds.


There could be any number of causes of slow performance.

A common reason is not having enough spare memory in the machine to 
allow the operating system to cache the index data.  This is memory NOT 
allocated by programs (including Solr).


Another common reason is that the heap size is too small, which causes 
Java to frequently perform full garbage collections, which will REALLY 
kill performance.


Since there's very little information here, it's difficult for us to 
diagnose the cause.  Here's a wiki page about performance problems:


https://wiki.apache.org/solr/SolrPerformanceProblems

(Disclaimer:  I am the principal author of that page)


When we executed the same query again using admin panel, it does not take a 
much time and it completes within 20 milliseconds.


Executing an identical query again will likely satisfy the query from 
Solr's caches.  Solr won't need to talk to the actual index, and it will 
be REALLY fast.  Even a massively complex query, if it is cached, will 
be fast.


Running the information from your logs through a URL decoder, this is 
what I found:


q=+project_id:(2102117)+recipient_id:(4642365) +entity_type:(1) 
-action_id:(20 32) +action_status:(0) +is_active:(true) 
+(is_formtype_active:true) +(appType:1)


If all of those fields are indexed, then I would not expect a properly 
sized server to be slow.  If any of those fields are indexed=false and 
have docValues, then it could be a schema configuration issue. 
Searching docValues does work, but it's really slow.


Your query does have an empty fq ... "fq=" ... I do not know whether 
that's problematic.  Try it without that to verify.  I would not expect 
it to cause problems, but I can't be sure.


Thanks,
Shawn


Re: Solr query takes a too much time in Solr 6.1.0

2019-05-10 Thread David Hastings
first inclination is your index is cold.

On Fri, May 10, 2019 at 9:32 AM vishal patel 
wrote:

> We have 2 shards and 2 replicas in Live environment. we have multiple
> collections.
> Some times some query takes much time(QTime=52552).  There are so many
> documents indexing and searching within milliseconds.
> When we executed the same query again using admin panel, it does not take
> a much time and it completes within 20 milliseconds.
>
> My Solr Logs :
> 2019-05-10 09:48:56.744 INFO  (qtp1239731077-128223) [c:actionscomments
> s:shard1 r:core_node1 x:actionscomments] o.a.s.c.S.Request
> [actionscomments]  webapp=/solr path=/select
> params={q=%2Bproject_id:(2102117)%2Brecipient_id:(4642365)+%2Bentity_type:(1)+-action_id:(20+32)+%2Baction_status:(0)+%2Bis_active:(true)+%2B(is_formtype_active:true)+%2B(appType:1)=
> s1.example.com:8983/solr/actionscomments|s1r1.example.com:8983/solr/actionscomments,s2.example.com:8983/solr/actionscomments|s2r1.example.com:8983/solr/actionscomments=off=true=id=0=id+desc,id+desc==1
> }
> hits=198 status=0 QTime=52552
> 2019-05-10 09:48:56.744 INFO  (qtp1239731077-127998) [c:actionscomments
> s:shard1 r:core_node1 x:actionscomments] o.a.s.c.S.Request
> [actionscomments]  webapp=/solr path=/select
> params={q=%2Bproject_id:(2102117)%2Brecipient_id:(4642365)+%2Bentity_type:(1)+-action_id:(20+32)+%2Baction_status:(0)+%2Bis_active:(true)+%2Bdue_date:[2019-05-09T19:30:00Z+TO+2019-05-09T19:30:00Z%2B1DAY]+%2B(is_formtype_active:true)+%2B(appType:1)=
> s1.example.com:8983/solr/actionscomments|s1r1.example.com:8983/solr/actionscomments,s2.example.com:8983/solr/actionscomments|s2r1.example.com:8983/solr/actionscomments=off=true=id=0=id+desc,id+desc==1
> }
> hits=0 status=0 QTime=51970
> 2019-05-10 09:48:56.746 INFO  (qtp1239731077-128224) [c:actionscomments
> s:shard1 r:core_node1 x:actionscomments] o.a.s.c.S.Request
> [actionscomments]  webapp=/solr path=/select
> params={q=%2Bproject_id:(2121600+2115171+2104206)%2Brecipient_id:(2834330)+%2Bentity_type:(2)+-action_id:(20+32)+%2Baction_status:(0)+%2Bis_active:(true)+%2Bdue_date:[2019-05-10T00:00:00Z+TO+2019-05-10T00:00:00Z%2B1DAY]=
> s1.example.com:8983/solr/actionscomments|s1r1.example.com:8983/solr/actionscomments,s2.example.com:8983/solr/actionscomments|s2r1.example.com:8983/solr/actionscomments=off=true=id=0=id+desc,id+desc==1
> }
> hits=98 status=0 QTime=51402
>
>
> My schema fields below :
>
>  required="true" multiValued="false"/>
> 
> 
> 
> 
> 
> 
>  stored="true" />
> 
> 
>
> What could be a problem here? why the query takes too much time at that
> time?
>
> Sent from Outlook
>


Solr query takes a too much time in Solr 6.1.0

2019-05-10 Thread vishal patel
We have 2 shards and 2 replicas in Live environment. we have multiple 
collections.
Some times some query takes much time(QTime=52552).  There are so many 
documents indexing and searching within milliseconds.
When we executed the same query again using admin panel, it does not take a 
much time and it completes within 20 milliseconds.

My Solr Logs :
2019-05-10 09:48:56.744 INFO  (qtp1239731077-128223) [c:actionscomments 
s:shard1 r:core_node1 x:actionscomments] o.a.s.c.S.Request [actionscomments]  
webapp=/solr path=/select 
params={q=%2Bproject_id:(2102117)%2Brecipient_id:(4642365)+%2Bentity_type:(1)+-action_id:(20+32)+%2Baction_status:(0)+%2Bis_active:(true)+%2B(is_formtype_active:true)+%2B(appType:1)=s1.example.com:8983/solr/actionscomments|s1r1.example.com:8983/solr/actionscomments,s2.example.com:8983/solr/actionscomments|s2r1.example.com:8983/solr/actionscomments=off=true=id=0=id+desc,id+desc==1}
 hits=198 status=0 QTime=52552
2019-05-10 09:48:56.744 INFO  (qtp1239731077-127998) [c:actionscomments 
s:shard1 r:core_node1 x:actionscomments] o.a.s.c.S.Request [actionscomments]  
webapp=/solr path=/select 
params={q=%2Bproject_id:(2102117)%2Brecipient_id:(4642365)+%2Bentity_type:(1)+-action_id:(20+32)+%2Baction_status:(0)+%2Bis_active:(true)+%2Bdue_date:[2019-05-09T19:30:00Z+TO+2019-05-09T19:30:00Z%2B1DAY]+%2B(is_formtype_active:true)+%2B(appType:1)=s1.example.com:8983/solr/actionscomments|s1r1.example.com:8983/solr/actionscomments,s2.example.com:8983/solr/actionscomments|s2r1.example.com:8983/solr/actionscomments=off=true=id=0=id+desc,id+desc==1}
 hits=0 status=0 QTime=51970
2019-05-10 09:48:56.746 INFO  (qtp1239731077-128224) [c:actionscomments 
s:shard1 r:core_node1 x:actionscomments] o.a.s.c.S.Request [actionscomments]  
webapp=/solr path=/select 
params={q=%2Bproject_id:(2121600+2115171+2104206)%2Brecipient_id:(2834330)+%2Bentity_type:(2)+-action_id:(20+32)+%2Baction_status:(0)+%2Bis_active:(true)+%2Bdue_date:[2019-05-10T00:00:00Z+TO+2019-05-10T00:00:00Z%2B1DAY]=s1.example.com:8983/solr/actionscomments|s1r1.example.com:8983/solr/actionscomments,s2.example.com:8983/solr/actionscomments|s2r1.example.com:8983/solr/actionscomments=off=true=id=0=id+desc,id+desc==1}
 hits=98 status=0 QTime=51402


My schema fields below :












What could be a problem here? why the query takes too much time at that time?

Sent from Outlook


Re: Solr query particular value of a field last

2019-04-14 Thread Anuj Bhargava
Thanks Saurabh And Prince, Works perfectly.

On Sun, 14 Apr 2019 at 17:21, Prince Manohar 
wrote:

> Basically, you need to boost some documents low.
>
> For this, you can either use solr’s Boost Query ( bq ) or Boost Function
> (bf)
> parameter.
>
> For example in your case:-
>
> If you want the documents with countries A and B to show last in the
> result, you can use:-
>
> bq=( country:A OR country:B )^-1
>
> Note that a negative boosting has been done here.
>
> I would say this approach is better than sorting because other documents
> maintain their actual order and only those documents are boosted up or
> down, which satisfy the condition.
>
>
>
>
> On Sun, Apr 14, 2019 at 4:03 PM Saurabh Sharma  >
> wrote:
>
> > fq=country :c1 OR c2 OR c3=if(termfreq (country,c2),0,1) desc
> >
> >
> > Correcting query.
> >
> > On Sun 14 Apr, 2019, 3:36 PM Saurabh Sharma,  >
> > wrote:
> >
> > > I would suggest to sort on the basis of condition. First find all the
> > > records and then sort on the basis of condition where you will be
> putting
> > > spcific countries below other.
> > >
> > > fq=country :c1 OR c2 OR c3=if(termfreq (country,c2),1,0) desc
> > >
> > >
> > > Here we are putting c2 below c1 and c3.
> > >
> > > You can also try term search and boost specific terms.
> > >
> > > Thanks and regards
> > > Saurabh
> > >
> > > On Sun 14 Apr, 2019, 1:49 PM Anuj Bhargava, 
> wrote:
> > >
> > >> I have a field *country*. I need to do a search in which I need to
> show
> > >> the
> > >> search result of a country or some countries, last in the search
> result
> > >> for
> > >> eg. country code *BD*. What query should I use to get the above
> result.
> > >>
> > >> fq=country:???=*%3A*
> > >>
> > >
> >
>
>
> --
> *Regards,
> <
> https://rawgit.com/princemanohar/cv/master/resume7797045315-princemanohar0909.pdf
> >*
> *Prince Manohar
> <
> https://rawgit.com/princemanohar/cv/master/resume7797045315-princemanohar0909.pdf
> >*
> *B.Tech (InformationTechnology)
> *
> *Bengaluru
> <
> https://rawgit.com/princemanohar/cv/master/resume7797045315-princemanohar0909.pdf
> >*
> *+91 7797045315
> <
> https://rawgit.com/princemanohar/cv/master/resume7797045315-princemanohar0909.pdf
> >*
>


Re: Solr query particular value of a field last

2019-04-14 Thread Prince Manohar
Basically, you need to boost some documents low.

For this, you can either use solr’s Boost Query ( bq ) or Boost Function (bf)
parameter.

For example in your case:-

If you want the documents with countries A and B to show last in the
result, you can use:-

bq=( country:A OR country:B )^-1

Note that a negative boosting has been done here.

I would say this approach is better than sorting because other documents
maintain their actual order and only those documents are boosted up or
down, which satisfy the condition.




On Sun, Apr 14, 2019 at 4:03 PM Saurabh Sharma 
wrote:

> fq=country :c1 OR c2 OR c3=if(termfreq (country,c2),0,1) desc
>
>
> Correcting query.
>
> On Sun 14 Apr, 2019, 3:36 PM Saurabh Sharma, 
> wrote:
>
> > I would suggest to sort on the basis of condition. First find all the
> > records and then sort on the basis of condition where you will be putting
> > spcific countries below other.
> >
> > fq=country :c1 OR c2 OR c3=if(termfreq (country,c2),1,0) desc
> >
> >
> > Here we are putting c2 below c1 and c3.
> >
> > You can also try term search and boost specific terms.
> >
> > Thanks and regards
> > Saurabh
> >
> > On Sun 14 Apr, 2019, 1:49 PM Anuj Bhargava,  wrote:
> >
> >> I have a field *country*. I need to do a search in which I need to show
> >> the
> >> search result of a country or some countries, last in the search result
> >> for
> >> eg. country code *BD*. What query should I use to get the above result.
> >>
> >> fq=country:???=*%3A*
> >>
> >
>


-- 
*Regards,
*
*Prince Manohar
*
*B.Tech (InformationTechnology)
*
*Bengaluru
*
*+91 7797045315
*


Re: Solr query particular value of a field last

2019-04-14 Thread Saurabh Sharma
fq=country :c1 OR c2 OR c3=if(termfreq (country,c2),0,1) desc


Correcting query.

On Sun 14 Apr, 2019, 3:36 PM Saurabh Sharma, 
wrote:

> I would suggest to sort on the basis of condition. First find all the
> records and then sort on the basis of condition where you will be putting
> spcific countries below other.
>
> fq=country :c1 OR c2 OR c3=if(termfreq (country,c2),1,0) desc
>
>
> Here we are putting c2 below c1 and c3.
>
> You can also try term search and boost specific terms.
>
> Thanks and regards
> Saurabh
>
> On Sun 14 Apr, 2019, 1:49 PM Anuj Bhargava,  wrote:
>
>> I have a field *country*. I need to do a search in which I need to show
>> the
>> search result of a country or some countries, last in the search result
>> for
>> eg. country code *BD*. What query should I use to get the above result.
>>
>> fq=country:???=*%3A*
>>
>


Re: Solr query particular value of a field last

2019-04-14 Thread Saurabh Sharma
I would suggest to sort on the basis of condition. First find all the
records and then sort on the basis of condition where you will be putting
spcific countries below other.

fq=country :c1 OR c2 OR c3=if(termfreq (country,c2),1,0) desc


Here we are putting c2 below c1 and c3.

You can also try term search and boost specific terms.

Thanks and regards
Saurabh

On Sun 14 Apr, 2019, 1:49 PM Anuj Bhargava,  wrote:

> I have a field *country*. I need to do a search in which I need to show the
> search result of a country or some countries, last in the search result for
> eg. country code *BD*. What query should I use to get the above result.
>
> fq=country:???=*%3A*
>


Solr query particular value of a field last

2019-04-14 Thread Anuj Bhargava
I have a field *country*. I need to do a search in which I need to show the
search result of a country or some countries, last in the search result for
eg. country code *BD*. What query should I use to get the above result.

fq=country:???=*%3A*


Re: Solr query high response time

2019-03-22 Thread Shawn Heisey

On 3/22/2019 7:52 AM, Rajdeep Sahoo wrote:

   My solr query sometime taking more than 60 sec to return the response .
Is there any way I can check why it is taking so much time .
   Please let me know if there is any way to analyse this issue(high
response time ) .Thanks


With the information provided, we have nothing to go on to figure out 
what is happening.


In many cases, the problem turns out to be insufficient memory.  If you 
can gather a specific screenshot of a process listing, we MIGHT be able 
to offer some insight.  The way to gather that info is posted here:


https://wiki.apache.org/solr/SolrPerformanceProblems#Asking_for_help_on_a_memory.2Fperformance_issue

Attachments to messages sent to this list will not make it through to 
us.  You will need to use a file sharing site and provide a link to the 
file.


Some queries, when executed on a very large index, will be slow even 
when there is sufficient memory.  After you send the screenshot 
mentioned above, we might need to ask for additional information.


Thanks,
Shawn


Solr query high response time

2019-03-22 Thread Rajdeep Sahoo
Hi all,
  My solr query sometime taking more than 60 sec to return the response .
Is there any way I can check why it is taking so much time .
  Please let me know if there is any way to analyse this issue(high
response time ) .Thanks


Re: solr-query

2019-01-20 Thread Aman Tandon
Hi Shilpa,

I am assuming you know the functionality of synonym.

Synonym in Solr can be applied over the tokens getting indexed/queried for
the field. In order to apply synonym to a field you need to update the
configuration file schema.xml where you also define a file (synonym.txt is
default, you can create per field separate file as well) which is keeping
synonym for your business requirement.

You can also define synonym to apply at index or query time or both for a
field. However if you applying at index time, then any new synonym addition
to synonym file, require to reindex the whole collection.

You could read more about synonym at here.

https://lucene.apache.org/solr/guide/6_6/filter-descriptions.html#FilterDescriptions-SynonymGraphFilter

Also a good blogs on multi word synonym.

https://lucidworks.com/2017/04/18/multi-word-synonyms-solr-adds-query-time-support/


On Fri, Jan 18, 2019, 21:44 Shilpa Solanki  Hello,
>
>  can you ask me how we use synonyms with apache solr.
>
>
> Thanks & Regards,
> Shilpa solanki
>


solr-query

2019-01-18 Thread Shilpa Solanki
Hello,

 can you ask me how we use synonyms with apache solr.


Thanks & Regards,
Shilpa solanki


Re: Solr Query running slow in Prod node

2019-01-09 Thread Zheng Lin Edwin Yeo
Hi,

You have to check if both of settings are using the same configurations,
and if the production Solr server have other programs running?
Also, the query performance might be affected if there is indexing going on
at the same time.

Regards,
Edwin

On Thu, 10 Jan 2019 at 06:50, Dasarathi Minjur  wrote:

> Hello,
> We have a Solr query that runs much slower in Production Solr cluster
> compared with lower environments.(Yes they may not be apples to apples
> comparison but it's really slow in prod as HDFS gets pounded)
> What are the general ways to track/trouble shoot slowness in the query. Is
> there any best practices or troubleshoot links. Thanks in advance for your
> responses.
>


Solr Query running slow in Prod node

2019-01-09 Thread Dasarathi Minjur
Hello,
We have a Solr query that runs much slower in Production Solr cluster
compared with lower environments.(Yes they may not be apples to apples
comparison but it's really slow in prod as HDFS gets pounded)
What are the general ways to track/trouble shoot slowness in the query. Is
there any best practices or troubleshoot links. Thanks in advance for your
responses.


Re: Tool to format the solr query for easier reading?

2019-01-08 Thread Jan Høydahl
I find myself doing exactly the same, so such a tool would be wonderful.
I sometimes use the Solr Query Debugger 
<https://chrome.google.com/webstore/detail/solr-query-debugger/gmpkeiamnmccifccnbfljffkcnacmmdl>
 Chrome plugin but that does not help with decoding the q parameter, only to 
more easily see all params and navigate explain.
And sometimes I use https://explain.solr.pl/explains/new 
<https://explain.solr.pl/explains/new> for decoding explain.
Lucene already parses the query string and builds a Lucene query, I wonder if 
it would be easiest to consume that Object graph with some kind of plugin to 
produce an indented view of the query. Or perhaps that could be a new display 
mode for debug=query as a standard feature?

Another option you have is of course to start sending your Solr queries as JSON 
DSL https://lucene.apache.org/solr/guide/7_6/json-query-dsl.html 
<https://lucene.apache.org/solr/guide/7_6/json-query-dsl.html> in the first 
place :)

--
Jan Høydahl, search solution architect
Cominvent AS - www.cominvent.com <http://www.cominvent.com/>

> 8. jan. 2019 kl. 05:33 skrev Hullegård, Jimi 
>  <mailto:jimi.hulleg...@svensktnaringsliv.se>>:
> 
> Hi,
> 
> I often find myself having to analyze an already existing solr query. But 
> when the number of clauses and/or number of nested parentheses reach a 
> certain level I can no longer grasp what the query is about by just a quick 
> glance. Sometimes I can look at the code generating the query, but it might 
> be autogenerated in a complex way, or I might only have access to a log 
> output of the query.
> 
> Here is an example query, based on a real query in our system:
> 
> 
> system:(a) type:(x OR y OR z) date1:[* TO 2019-08-31T06:15:00Z/DAY+1DAYS] 
> ((boolean1:false OR date2:[* TO 2019-08-31T06:15:00Z/DAY-30DAYS])) 
> -date3:[2019-08-31T06:15:00Z/DAY+1DAYS TO *] (((*:* -date4:*) OR date5:* OR 
> date3:[* TO 2019-08-31T06:15:00Z/DAY+1DAYS]))
> 
> 
> Here I find it quite difficult to what clauses are grouped together (using 
> parentheses). What I tend to do in these circumstances is to copy the query 
> into a simple text editor, and then manually add line breaks and indentation 
> matching the parentheses levels.
> 
> For the query above, it would result in something like this:
> 
> 
> system:(a)
> type:(x OR y OR z)
> date1:[* TO 2019-08-31T06:15:00Z/DAY+1DAYS]
> (
> (boolean1:false OR date2:[* TO 
> 2019-08-31T06:15:00Z/DAY-30DAYS])
> )
> -date3:[2019-08-31T06:15:00Z/DAY+1DAYS TO *]
> (
> ((*:* -date4:*) OR date5:* OR date3:[* TO 
> 2019-08-31T06:15:00Z/DAY+1DAYS])
> )
> 
> 
> But that is a slow process, and I might make a mistake that messes up the 
> interpretation completely. Especially when there are several levels of nested 
> parentheses.
> 
> Does anyone know of any kind of tool that would help automate this? It 
> wouldn't have to format its output like my example, as long as it makes it 
> easier to see what start and end parentheses belong to each other, preferably 
> using multiple lines and indentation.
> 
> A java tool would be perfect, because then I could easily integrate it into 
> our existing debugging tools, but an online formatter (like 
> http://jsonformatter.curiousconcept.com 
> <http://jsonformatter.curiousconcept.com/>) would also be very useful.
> 
> Regards
> /Jimi
> 
> Svenskt Näringsliv behandlar dina personuppgifter i enlighet med GDPR. Här 
> kan du läsa mer om vår behandling och dina rättigheter, 
> Integritetspolicy<https://www.svensktnaringsliv.se/dataskydd/integritet-och-behandling-av-personuppgifter_697219.html?utm_source=sn-email_medium=email
>  
> <https://www.svensktnaringsliv.se/dataskydd/integritet-och-behandling-av-personuppgifter_697219.html?utm_source=sn-email_medium=email>>



SV: SV: Tool to format the solr query for easier reading?

2019-01-08 Thread Hullegård , Jimi
I tried it now (but I had to install it from the official chrome store, the 
link from your blog didn't work). But the only formatting it seems to be doing 
is adding a line break after each "OR", which doesn't help much.

Although, to be fair, the plugin is still "Evaluating..." my query, so in 
theory I guess that it could do some more formatting when it is done (whenever 
that would be, it has been stuck in this "Evaluating..." for about 10 minutes 
now).

-Ursprungligt meddelande-
Från: Charlie Hull 
Skickat: den 8 januari 2019 16:32
Till: solr-user@lucene.apache.org
Ämne: Re: SV: Tool to format the solr query for easier reading?


Hi Jimi,

I recalled that the Chrome plugin would do this, obviously it's not a perfect 
solution for you as you've prefer a Java formatter but it's a start - have you 
tried this one?

Best

Charlie
>
> /Jimi
>
> -Ursprungligt meddelande-
> Från: Charlie Hull 
> Skickat: den 8 januari 2019 15:55
> Till: solr-user@lucene.apache.org
> Ämne: Re: Tool to format the solr query for easier reading?
>
> On 08/01/2019 04:33, Hullegård, Jimi wrote:
>> Hi,
>
> Hi Jimi,
>
> There are some suggestions in part 4 of my recent blog:
> http://www.flax.co.uk/blog/2018/11/15/defining-relevance-engineering-p
> art-4-tools/
>
> Cheers
>
> Charlie
>>
>> I often find myself having to analyze an already existing solr query. But 
>> when the number of clauses and/or number of nested parentheses reach a 
>> certain level I can no longer grasp what the query is about by just a quick 
>> glance. Sometimes I can look at the code generating the query, but it might 
>> be autogenerated in a complex way, or I might only have access to a log 
>> output of the query.
>>
>> Here is an example query, based on a real query in our system:
>>
>>
>> system:(a) type:(x OR y OR z) date1:[* TO
>> 2019-08-31T06:15:00Z/DAY+1DAYS] ((boolean1:false OR date2:[* TO
>> 2019-08-31T06:15:00Z/DAY-30DAYS]))
>> -date3:[2019-08-31T06:15:00Z/DAY+1DAYS TO *] (((*:* -date4:*) OR
>> date5:* OR date3:[* TO 2019-08-31T06:15:00Z/DAY+1DAYS]))
>>
>>
>> Here I find it quite difficult to what clauses are grouped together (using 
>> parentheses). What I tend to do in these circumstances is to copy the query 
>> into a simple text editor, and then manually add line breaks and indentation 
>> matching the parentheses levels.
>>
>> For the query above, it would result in something like this:
>>
>>
>> system:(a)
>> type:(x OR y OR z)
>> date1:[* TO 2019-08-31T06:15:00Z/DAY+1DAYS] (
>>(boolean1:false OR date2:[* TO
>> 2019-08-31T06:15:00Z/DAY-30DAYS])
>> )
>> -date3:[2019-08-31T06:15:00Z/DAY+1DAYS TO *] (
>>((*:* -date4:*) OR date5:* OR date3:[*
>> TO 2019-08-31T06:15:00Z/DAY+1DAYS])
>> )
>>
>>
>> But that is a slow process, and I might make a mistake that messes up the 
>> interpretation completely. Especially when there are several levels of 
>> nested parentheses.
>>
>> Does anyone know of any kind of tool that would help automate this? It 
>> wouldn't have to format its output like my example, as long as it makes it 
>> easier to see what start and end parentheses belong to each other, 
>> preferably using multiple lines and indentation.
>>
>> A java tool would be perfect, because then I could easily integrate it into 
>> our existing debugging tools, but an online formatter (like 
>> http://jsonformatter.curiousconcept.com) would also be very useful.
>>
>> Regards
>> /Jimi
>>
>> Svenskt Näringsliv behandlar dina personuppgifter i enlighet med GDPR.
>> Här kan du läsa mer om vår behandling och dina rättigheter,
>> Integritetspolicy<https://www.svensktnaringsliv.se/dataskydd/integrit
>> e
>> t-och-behandling-av-personuppgifter_697219.html?utm_source=sn-email
>> t
>> m_medium=email>
>>
>
>
> --
> Charlie Hull
> Flax - Open Source Enterprise Search
>
> tel/fax: +44 (0)8700 118334
> mobile:  +44 (0)7767 825828
> web: www.flax.co.uk
> Svenskt Näringsliv behandlar dina personuppgifter i enlighet med GDPR.
> Här kan du läsa mer om vår behandling och dina rättigheter,
> Integritetspolicy<https://www.svensktnaringsliv.se/dataskydd/integrite
> t-och-behandling-av-personuppgifter_697219.html?utm_source=sn-email
> m_medium=email>
>


--
Charlie Hull
Flax - Open Source Enterprise Search

tel/fax: +44 (0)8700 118334
mobile:  +44 (0)7767 825828
web: www.flax.co.uk
Svenskt Näringsliv behandlar dina personuppgifter i enlighet med GDPR. Här kan 
du läsa mer om vår behandling och dina rättigheter, 
Integritetspolicy<https://www.svensktnaringsliv.se/dataskydd/integritet-och-behandling-av-personuppgifter_697219.html?utm_source=sn-email_medium=email>


Re: SV: Tool to format the solr query for easier reading?

2019-01-08 Thread Charlie Hull

On 08/01/2019 09:20, Hullegård, Jimi wrote:

Hi Charlie,

Care to elaborate on that a little? I can't seem to find any tool in that blog 
entry that formats a given solr query. What tool did you have in mind?


Hi Jimi,

I recalled that the Chrome plugin would do this, obviously it's not a 
perfect solution for you as you've prefer a Java formatter but it's a 
start - have you tried this one?


Best

Charlie


/Jimi

-Ursprungligt meddelande-
Från: Charlie Hull 
Skickat: den 8 januari 2019 15:55
Till: solr-user@lucene.apache.org
Ämne: Re: Tool to format the solr query for easier reading?

On 08/01/2019 04:33, Hullegård, Jimi wrote:

Hi,


Hi Jimi,

There are some suggestions in part 4 of my recent blog:
http://www.flax.co.uk/blog/2018/11/15/defining-relevance-engineering-part-4-tools/

Cheers

Charlie


I often find myself having to analyze an already existing solr query. But when 
the number of clauses and/or number of nested parentheses reach a certain level 
I can no longer grasp what the query is about by just a quick glance. Sometimes 
I can look at the code generating the query, but it might be autogenerated in a 
complex way, or I might only have access to a log output of the query.

Here is an example query, based on a real query in our system:


system:(a) type:(x OR y OR z) date1:[* TO
2019-08-31T06:15:00Z/DAY+1DAYS] ((boolean1:false OR date2:[* TO
2019-08-31T06:15:00Z/DAY-30DAYS]))
-date3:[2019-08-31T06:15:00Z/DAY+1DAYS TO *] (((*:* -date4:*) OR
date5:* OR date3:[* TO 2019-08-31T06:15:00Z/DAY+1DAYS]))


Here I find it quite difficult to what clauses are grouped together (using 
parentheses). What I tend to do in these circumstances is to copy the query 
into a simple text editor, and then manually add line breaks and indentation 
matching the parentheses levels.

For the query above, it would result in something like this:


system:(a)
type:(x OR y OR z)
date1:[* TO 2019-08-31T06:15:00Z/DAY+1DAYS] (
   (boolean1:false OR date2:[* TO
2019-08-31T06:15:00Z/DAY-30DAYS])
)
-date3:[2019-08-31T06:15:00Z/DAY+1DAYS TO *] (
   ((*:* -date4:*) OR date5:* OR date3:[*
TO 2019-08-31T06:15:00Z/DAY+1DAYS])
)


But that is a slow process, and I might make a mistake that messes up the 
interpretation completely. Especially when there are several levels of nested 
parentheses.

Does anyone know of any kind of tool that would help automate this? It wouldn't 
have to format its output like my example, as long as it makes it easier to see 
what start and end parentheses belong to each other, preferably using multiple 
lines and indentation.

A java tool would be perfect, because then I could easily integrate it into our 
existing debugging tools, but an online formatter (like 
http://jsonformatter.curiousconcept.com) would also be very useful.

Regards
/Jimi

Svenskt Näringsliv behandlar dina personuppgifter i enlighet med GDPR.
Här kan du läsa mer om vår behandling och dina rättigheter,
Integritetspolicy<https://www.svensktnaringsliv.se/dataskydd/integrite
t-och-behandling-av-personuppgifter_697219.html?utm_source=sn-email
m_medium=email>




--
Charlie Hull
Flax - Open Source Enterprise Search

tel/fax: +44 (0)8700 118334
mobile:  +44 (0)7767 825828
web: www.flax.co.uk
Svenskt Näringsliv behandlar dina personuppgifter i enlighet med GDPR. Här kan du läsa 
mer om vår behandling och dina rättigheter, 
Integritetspolicy<https://www.svensktnaringsliv.se/dataskydd/integritet-och-behandling-av-personuppgifter_697219.html?utm_source=sn-email_medium=email>




--
Charlie Hull
Flax - Open Source Enterprise Search

tel/fax: +44 (0)8700 118334
mobile:  +44 (0)7767 825828
web: www.flax.co.uk


Re: SV: Tool to format the solr query for easier reading?

2019-01-08 Thread Charlie Hull

On 08/01/2019 09:20, Hullegård, Jimi wrote:

Hi Charlie,

Care to elaborate on that a little? I can't seem to find any tool in that blog 
entry that formats a given solr query. What tool did you have in mind?


This also does some basic URL splitting: 
https://www.freeformatter.com/url-parser-query-string-splitter.html


Cheers

Charlie


/Jimi

-Ursprungligt meddelande-
Från: Charlie Hull 
Skickat: den 8 januari 2019 15:55
Till: solr-user@lucene.apache.org
Ämne: Re: Tool to format the solr query for easier reading?

On 08/01/2019 04:33, Hullegård, Jimi wrote:

Hi,


Hi Jimi,

There are some suggestions in part 4 of my recent blog:
http://www.flax.co.uk/blog/2018/11/15/defining-relevance-engineering-part-4-tools/

Cheers

Charlie


I often find myself having to analyze an already existing solr query. But when 
the number of clauses and/or number of nested parentheses reach a certain level 
I can no longer grasp what the query is about by just a quick glance. Sometimes 
I can look at the code generating the query, but it might be autogenerated in a 
complex way, or I might only have access to a log output of the query.

Here is an example query, based on a real query in our system:


system:(a) type:(x OR y OR z) date1:[* TO
2019-08-31T06:15:00Z/DAY+1DAYS] ((boolean1:false OR date2:[* TO
2019-08-31T06:15:00Z/DAY-30DAYS]))
-date3:[2019-08-31T06:15:00Z/DAY+1DAYS TO *] (((*:* -date4:*) OR
date5:* OR date3:[* TO 2019-08-31T06:15:00Z/DAY+1DAYS]))


Here I find it quite difficult to what clauses are grouped together (using 
parentheses). What I tend to do in these circumstances is to copy the query 
into a simple text editor, and then manually add line breaks and indentation 
matching the parentheses levels.

For the query above, it would result in something like this:


system:(a)
type:(x OR y OR z)
date1:[* TO 2019-08-31T06:15:00Z/DAY+1DAYS] (
   (boolean1:false OR date2:[* TO
2019-08-31T06:15:00Z/DAY-30DAYS])
)
-date3:[2019-08-31T06:15:00Z/DAY+1DAYS TO *] (
   ((*:* -date4:*) OR date5:* OR date3:[*
TO 2019-08-31T06:15:00Z/DAY+1DAYS])
)


But that is a slow process, and I might make a mistake that messes up the 
interpretation completely. Especially when there are several levels of nested 
parentheses.

Does anyone know of any kind of tool that would help automate this? It wouldn't 
have to format its output like my example, as long as it makes it easier to see 
what start and end parentheses belong to each other, preferably using multiple 
lines and indentation.

A java tool would be perfect, because then I could easily integrate it into our 
existing debugging tools, but an online formatter (like 
http://jsonformatter.curiousconcept.com) would also be very useful.

Regards
/Jimi

Svenskt Näringsliv behandlar dina personuppgifter i enlighet med GDPR.
Här kan du läsa mer om vår behandling och dina rättigheter,
Integritetspolicy<https://www.svensktnaringsliv.se/dataskydd/integrite
t-och-behandling-av-personuppgifter_697219.html?utm_source=sn-email
m_medium=email>




--
Charlie Hull
Flax - Open Source Enterprise Search

tel/fax: +44 (0)8700 118334
mobile:  +44 (0)7767 825828
web: www.flax.co.uk
Svenskt Näringsliv behandlar dina personuppgifter i enlighet med GDPR. Här kan du läsa 
mer om vår behandling och dina rättigheter, 
Integritetspolicy<https://www.svensktnaringsliv.se/dataskydd/integritet-och-behandling-av-personuppgifter_697219.html?utm_source=sn-email_medium=email>




--
Charlie Hull
Flax - Open Source Enterprise Search

tel/fax: +44 (0)8700 118334
mobile:  +44 (0)7767 825828
web: www.flax.co.uk


SV: Tool to format the solr query for easier reading?

2019-01-08 Thread Hullegård , Jimi
Hi Charlie,

Care to elaborate on that a little? I can't seem to find any tool in that blog 
entry that formats a given solr query. What tool did you have in mind?

/Jimi

-Ursprungligt meddelande-
Från: Charlie Hull 
Skickat: den 8 januari 2019 15:55
Till: solr-user@lucene.apache.org
Ämne: Re: Tool to format the solr query for easier reading?

On 08/01/2019 04:33, Hullegård, Jimi wrote:
> Hi,

Hi Jimi,

There are some suggestions in part 4 of my recent blog:
http://www.flax.co.uk/blog/2018/11/15/defining-relevance-engineering-part-4-tools/

Cheers

Charlie
>
> I often find myself having to analyze an already existing solr query. But 
> when the number of clauses and/or number of nested parentheses reach a 
> certain level I can no longer grasp what the query is about by just a quick 
> glance. Sometimes I can look at the code generating the query, but it might 
> be autogenerated in a complex way, or I might only have access to a log 
> output of the query.
>
> Here is an example query, based on a real query in our system:
>
>
> system:(a) type:(x OR y OR z) date1:[* TO
> 2019-08-31T06:15:00Z/DAY+1DAYS] ((boolean1:false OR date2:[* TO
> 2019-08-31T06:15:00Z/DAY-30DAYS]))
> -date3:[2019-08-31T06:15:00Z/DAY+1DAYS TO *] (((*:* -date4:*) OR
> date5:* OR date3:[* TO 2019-08-31T06:15:00Z/DAY+1DAYS]))
>
>
> Here I find it quite difficult to what clauses are grouped together (using 
> parentheses). What I tend to do in these circumstances is to copy the query 
> into a simple text editor, and then manually add line breaks and indentation 
> matching the parentheses levels.
>
> For the query above, it would result in something like this:
>
>
> system:(a)
> type:(x OR y OR z)
> date1:[* TO 2019-08-31T06:15:00Z/DAY+1DAYS] (
>   (boolean1:false OR date2:[* TO
> 2019-08-31T06:15:00Z/DAY-30DAYS])
> )
> -date3:[2019-08-31T06:15:00Z/DAY+1DAYS TO *] (
>   ((*:* -date4:*) OR date5:* OR date3:[*
> TO 2019-08-31T06:15:00Z/DAY+1DAYS])
> )
>
>
> But that is a slow process, and I might make a mistake that messes up the 
> interpretation completely. Especially when there are several levels of nested 
> parentheses.
>
> Does anyone know of any kind of tool that would help automate this? It 
> wouldn't have to format its output like my example, as long as it makes it 
> easier to see what start and end parentheses belong to each other, preferably 
> using multiple lines and indentation.
>
> A java tool would be perfect, because then I could easily integrate it into 
> our existing debugging tools, but an online formatter (like 
> http://jsonformatter.curiousconcept.com) would also be very useful.
>
> Regards
> /Jimi
>
> Svenskt Näringsliv behandlar dina personuppgifter i enlighet med GDPR.
> Här kan du läsa mer om vår behandling och dina rättigheter,
> Integritetspolicy<https://www.svensktnaringsliv.se/dataskydd/integrite
> t-och-behandling-av-personuppgifter_697219.html?utm_source=sn-email
> m_medium=email>
>


--
Charlie Hull
Flax - Open Source Enterprise Search

tel/fax: +44 (0)8700 118334
mobile:  +44 (0)7767 825828
web: www.flax.co.uk
Svenskt Näringsliv behandlar dina personuppgifter i enlighet med GDPR. Här kan 
du läsa mer om vår behandling och dina rättigheter, 
Integritetspolicy<https://www.svensktnaringsliv.se/dataskydd/integritet-och-behandling-av-personuppgifter_697219.html?utm_source=sn-email_medium=email>


Re: Tool to format the solr query for easier reading?

2019-01-08 Thread Charlie Hull

On 08/01/2019 04:33, Hullegård, Jimi wrote:

Hi,


Hi Jimi,

There are some suggestions in part 4 of my recent blog: 
http://www.flax.co.uk/blog/2018/11/15/defining-relevance-engineering-part-4-tools/


Cheers

Charlie


I often find myself having to analyze an already existing solr query. But when 
the number of clauses and/or number of nested parentheses reach a certain level 
I can no longer grasp what the query is about by just a quick glance. Sometimes 
I can look at the code generating the query, but it might be autogenerated in a 
complex way, or I might only have access to a log output of the query.

Here is an example query, based on a real query in our system:


system:(a) type:(x OR y OR z) date1:[* TO 2019-08-31T06:15:00Z/DAY+1DAYS] 
((boolean1:false OR date2:[* TO 2019-08-31T06:15:00Z/DAY-30DAYS])) 
-date3:[2019-08-31T06:15:00Z/DAY+1DAYS TO *] (((*:* -date4:*) OR date5:* OR 
date3:[* TO 2019-08-31T06:15:00Z/DAY+1DAYS]))


Here I find it quite difficult to what clauses are grouped together (using 
parentheses). What I tend to do in these circumstances is to copy the query 
into a simple text editor, and then manually add line breaks and indentation 
matching the parentheses levels.

For the query above, it would result in something like this:


system:(a)
type:(x OR y OR z)
date1:[* TO 2019-08-31T06:15:00Z/DAY+1DAYS]
(
  (boolean1:false OR date2:[* TO 
2019-08-31T06:15:00Z/DAY-30DAYS])
)
-date3:[2019-08-31T06:15:00Z/DAY+1DAYS TO *]
(
  ((*:* -date4:*) OR date5:* OR date3:[* TO 
2019-08-31T06:15:00Z/DAY+1DAYS])
)


But that is a slow process, and I might make a mistake that messes up the 
interpretation completely. Especially when there are several levels of nested 
parentheses.

Does anyone know of any kind of tool that would help automate this? It wouldn't 
have to format its output like my example, as long as it makes it easier to see 
what start and end parentheses belong to each other, preferably using multiple 
lines and indentation.

A java tool would be perfect, because then I could easily integrate it into our 
existing debugging tools, but an online formatter (like 
http://jsonformatter.curiousconcept.com) would also be very useful.

Regards
/Jimi

Svenskt Näringsliv behandlar dina personuppgifter i enlighet med GDPR. Här kan du läsa 
mer om vår behandling och dina rättigheter, 
Integritetspolicy<https://www.svensktnaringsliv.se/dataskydd/integritet-och-behandling-av-personuppgifter_697219.html?utm_source=sn-email_medium=email>




--
Charlie Hull
Flax - Open Source Enterprise Search

tel/fax: +44 (0)8700 118334
mobile:  +44 (0)7767 825828
web: www.flax.co.uk


Tool to format the solr query for easier reading?

2019-01-07 Thread Hullegård , Jimi
Hi,

I often find myself having to analyze an already existing solr query. But when 
the number of clauses and/or number of nested parentheses reach a certain level 
I can no longer grasp what the query is about by just a quick glance. Sometimes 
I can look at the code generating the query, but it might be autogenerated in a 
complex way, or I might only have access to a log output of the query.

Here is an example query, based on a real query in our system:


system:(a) type:(x OR y OR z) date1:[* TO 2019-08-31T06:15:00Z/DAY+1DAYS] 
((boolean1:false OR date2:[* TO 2019-08-31T06:15:00Z/DAY-30DAYS])) 
-date3:[2019-08-31T06:15:00Z/DAY+1DAYS TO *] (((*:* -date4:*) OR date5:* OR 
date3:[* TO 2019-08-31T06:15:00Z/DAY+1DAYS]))


Here I find it quite difficult to what clauses are grouped together (using 
parentheses). What I tend to do in these circumstances is to copy the query 
into a simple text editor, and then manually add line breaks and indentation 
matching the parentheses levels.

For the query above, it would result in something like this:


system:(a)
type:(x OR y OR z)
date1:[* TO 2019-08-31T06:15:00Z/DAY+1DAYS]
(
 (boolean1:false OR date2:[* TO 
2019-08-31T06:15:00Z/DAY-30DAYS])
)
-date3:[2019-08-31T06:15:00Z/DAY+1DAYS TO *]
(
 ((*:* -date4:*) OR date5:* OR date3:[* TO 
2019-08-31T06:15:00Z/DAY+1DAYS])
)


But that is a slow process, and I might make a mistake that messes up the 
interpretation completely. Especially when there are several levels of nested 
parentheses.

Does anyone know of any kind of tool that would help automate this? It wouldn't 
have to format its output like my example, as long as it makes it easier to see 
what start and end parentheses belong to each other, preferably using multiple 
lines and indentation.

A java tool would be perfect, because then I could easily integrate it into our 
existing debugging tools, but an online formatter (like 
http://jsonformatter.curiousconcept.com) would also be very useful.

Regards
/Jimi

Svenskt Näringsliv behandlar dina personuppgifter i enlighet med GDPR. Här kan 
du läsa mer om vår behandling och dina rättigheter, 
Integritetspolicy<https://www.svensktnaringsliv.se/dataskydd/integritet-och-behandling-av-personuppgifter_697219.html?utm_source=sn-email_medium=email>


Re: Solr query response time analysis

2018-11-19 Thread Tanapol Nearunchorn
Hi Rajdeep,

For production-deployment at my company, we are using prometheus exporter,
https://github.com/noony/prometheus-solr-exporter.

You can start the exporter along with solr server and the exporter will
collect important metrics from solr.

By the way, you need to install and configure prometheus and grafana
(optional) to view and do some graph stuff.

If you have only single solr instance, I would suggest to view it via solr
admin page which is the most simple way.

If these metrics are not want you want, please tell me more about what you
want to measure.

Regards,
Tanapol

On Tue, Nov 20, 2018, 00:35 Chris Ulicny  Rajdeep,
>
> Not an external tool, but there is the option of using the "debug"
> parameter in the Solr query that can be used at least as a starting point
> for looking at the query timing.
>
>
> https://lucene.apache.org/solr/guide/6_6/common-query-parameters.html#CommonQueryParameters-ThedebugParameter
>
> Best,
> Chris
>
> On Mon, Nov 19, 2018 at 12:10 PM Rajdeep Sahoo  >
> wrote:
>
> > Hi all,
> >  Please suggest, how can I analyze the time taken by a solr query?
> > Is there any tool for analyzing the query response time.I f there is any
> > way to do this please suggest.
> >
>


Re: Solr query response time analysis

2018-11-19 Thread Chris Ulicny
Rajdeep,

Not an external tool, but there is the option of using the "debug"
parameter in the Solr query that can be used at least as a starting point
for looking at the query timing.

https://lucene.apache.org/solr/guide/6_6/common-query-parameters.html#CommonQueryParameters-ThedebugParameter

Best,
Chris

On Mon, Nov 19, 2018 at 12:10 PM Rajdeep Sahoo 
wrote:

> Hi all,
>  Please suggest, how can I analyze the time taken by a solr query?
> Is there any tool for analyzing the query response time.I f there is any
> way to do this please suggest.
>


Solr query response time analysis

2018-11-19 Thread Rajdeep Sahoo
Hi all,
 Please suggest, how can I analyze the time taken by a solr query?
Is there any tool for analyzing the query response time.I f there is any
way to do this please suggest.


Re: Is it possible to escape some texts from Solr query?

2018-09-04 Thread Erick Erickson
Alexandre's response is probably a better solution, assuming that the
field in question isn't complex, for instance:
http://localhost:8983/solr/techproducts/query?q={!term f=id}AND

Be aware that this requires that the value for the field (AND in this
case) be exactly as it appears in the index as no analysis is done at
all on the term when you use the term query parser. And you can
mix-n-match this with other parsers, something like:
.../query?q=name:Corsair AND {!term f=id}AND

Best,
Erick
On Tue, Sep 4, 2018 at 8:24 AM Alexandre Rafalovitch  wrote:
>
> As Erick said, you need to be looking into Query Parsers. There are
> many, depending on what search you are actually allowing your users to
> do. You probably know lucene/default, dismax and edismax, but there
> are many more: http://lucene.apache.org/solr/guide/7_4/other-parsers.html
>
> For example, you could allow a lot of flexibility but choose specific
> operators allowed with Simple Query Parser:
> http://lucene.apache.org/solr/guide/7_4/other-parsers.html#simple-query-parser
>
> Or, in the other extreme, you could allow to search against a single
> field only with Field Query Parser:
> http://lucene.apache.org/solr/guide/7_4/other-parsers.html#field-query-parser
>
> You may also benefit from dereferencing to ensure the full query is
> not overridden:
> http://lucene.apache.org/solr/guide/7_4/local-parameters-in-queries.html#parameter-dereferencing
> , possibly combined with invariants for the handler definition:
> http://lucene.apache.org/solr/guide/7_4/requesthandlers-and-searchcomponents-in-solrconfig.html#searchhandlers
>
> Regards,
>Alex.
>
> On 4 September 2018 at 11:11, Erick Erickson  wrote:
> > This is a query _parsing_ issue, way before a tokenizer ever gets to
> > it. The problem of course is that AND is an operator in the query
> > language, so your problem is how to distinguish it from the value of a
> > field.
> >
> > You can always quote the input for id, as in id:"AND" which you could
> > do for everything you put in that field. You'll have he same problem
> > with OR and NOT BTW.
> >
> > Best,
> > Erick
> > On Tue, Sep 4, 2018 at 3:10 AM girish.vignesh  
> > wrote:
> >>
> >> One of the ID attribute which we are using to query is AND so our looks 
> >> like
> >>
> >> http://localhost:8983/solr//select?fq=id:AND=json
> >>
> >> This throws below mentioned exception
> >>
> >> error: { metadata: [ "error-class", "org.apache.solr.common.SolrException",
> >> "root-error-class", "org.apache.solr.parser.ParseException" ], msg:
> >> "org.apache.solr.search.SyntaxError: Cannot parse 'id:AND': Encountered "
> >> "AND "" at line 1
> >>
> >> I can escape AND by using below mentioned queries
> >> http://localhost:8983/solr//select?fq=entityId:\AND=json
> >> http://localhost:8983/solr//select?fq=entityId:%22AND%22=json
> >>
> >> Question: I do not want to handle this while making a query. Is there any
> >> other way to handle this at Solr config level using tokenizer or some other
> >> way. This way I do not have to handle this at multiple places.
> >>
> >>
> >>
> >> --
> >> Sent from: http://lucene.472066.n3.nabble.com/Solr-User-f472068.html


Re: Is it possible to escape some texts from Solr query?

2018-09-04 Thread Alexandre Rafalovitch
As Erick said, you need to be looking into Query Parsers. There are
many, depending on what search you are actually allowing your users to
do. You probably know lucene/default, dismax and edismax, but there
are many more: http://lucene.apache.org/solr/guide/7_4/other-parsers.html

For example, you could allow a lot of flexibility but choose specific
operators allowed with Simple Query Parser:
http://lucene.apache.org/solr/guide/7_4/other-parsers.html#simple-query-parser

Or, in the other extreme, you could allow to search against a single
field only with Field Query Parser:
http://lucene.apache.org/solr/guide/7_4/other-parsers.html#field-query-parser

You may also benefit from dereferencing to ensure the full query is
not overridden:
http://lucene.apache.org/solr/guide/7_4/local-parameters-in-queries.html#parameter-dereferencing
, possibly combined with invariants for the handler definition:
http://lucene.apache.org/solr/guide/7_4/requesthandlers-and-searchcomponents-in-solrconfig.html#searchhandlers

Regards,
   Alex.

On 4 September 2018 at 11:11, Erick Erickson  wrote:
> This is a query _parsing_ issue, way before a tokenizer ever gets to
> it. The problem of course is that AND is an operator in the query
> language, so your problem is how to distinguish it from the value of a
> field.
>
> You can always quote the input for id, as in id:"AND" which you could
> do for everything you put in that field. You'll have he same problem
> with OR and NOT BTW.
>
> Best,
> Erick
> On Tue, Sep 4, 2018 at 3:10 AM girish.vignesh  
> wrote:
>>
>> One of the ID attribute which we are using to query is AND so our looks like
>>
>> http://localhost:8983/solr//select?fq=id:AND=json
>>
>> This throws below mentioned exception
>>
>> error: { metadata: [ "error-class", "org.apache.solr.common.SolrException",
>> "root-error-class", "org.apache.solr.parser.ParseException" ], msg:
>> "org.apache.solr.search.SyntaxError: Cannot parse 'id:AND': Encountered "
>> "AND "" at line 1
>>
>> I can escape AND by using below mentioned queries
>> http://localhost:8983/solr//select?fq=entityId:\AND=json
>> http://localhost:8983/solr//select?fq=entityId:%22AND%22=json
>>
>> Question: I do not want to handle this while making a query. Is there any
>> other way to handle this at Solr config level using tokenizer or some other
>> way. This way I do not have to handle this at multiple places.
>>
>>
>>
>> --
>> Sent from: http://lucene.472066.n3.nabble.com/Solr-User-f472068.html


Re: Is it possible to escape some texts from Solr query?

2018-09-04 Thread Erick Erickson
This is a query _parsing_ issue, way before a tokenizer ever gets to
it. The problem of course is that AND is an operator in the query
language, so your problem is how to distinguish it from the value of a
field.

You can always quote the input for id, as in id:"AND" which you could
do for everything you put in that field. You'll have he same problem
with OR and NOT BTW.

Best,
Erick
On Tue, Sep 4, 2018 at 3:10 AM girish.vignesh  wrote:
>
> One of the ID attribute which we are using to query is AND so our looks like
>
> http://localhost:8983/solr//select?fq=id:AND=json
>
> This throws below mentioned exception
>
> error: { metadata: [ "error-class", "org.apache.solr.common.SolrException",
> "root-error-class", "org.apache.solr.parser.ParseException" ], msg:
> "org.apache.solr.search.SyntaxError: Cannot parse 'id:AND': Encountered "
> "AND "" at line 1
>
> I can escape AND by using below mentioned queries
> http://localhost:8983/solr//select?fq=entityId:\AND=json
> http://localhost:8983/solr//select?fq=entityId:%22AND%22=json
>
> Question: I do not want to handle this while making a query. Is there any
> other way to handle this at Solr config level using tokenizer or some other
> way. This way I do not have to handle this at multiple places.
>
>
>
> --
> Sent from: http://lucene.472066.n3.nabble.com/Solr-User-f472068.html


Is it possible to escape some texts from Solr query?

2018-09-04 Thread girish.vignesh
One of the ID attribute which we are using to query is AND so our looks like

http://localhost:8983/solr//select?fq=id:AND=json

This throws below mentioned exception

error: { metadata: [ "error-class", "org.apache.solr.common.SolrException",
"root-error-class", "org.apache.solr.parser.ParseException" ], msg:
"org.apache.solr.search.SyntaxError: Cannot parse 'id:AND': Encountered "
"AND "" at line 1

I can escape AND by using below mentioned queries
http://localhost:8983/solr//select?fq=entityId:\AND=json
http://localhost:8983/solr//select?fq=entityId:%22AND%22=json

Question: I do not want to handle this while making a query. Is there any
other way to handle this at Solr config level using tokenizer or some other
way. This way I do not have to handle this at multiple places.



--
Sent from: http://lucene.472066.n3.nabble.com/Solr-User-f472068.html


Translating SQL having clause in Solr query

2018-08-07 Thread SAGAR PALAO
Hi Guys,



I am new to the Solr world and I am using Solr 5.4.1. I have a question and
hope to find answer to the same.



Consider a SQL query as:



select A, sum(B), sum(C)

from Col1

where D = ‘Test’

group by A

*having sum(B) > 20*

order by A

limit 100



I am able to translate the above to Solr Query partially using pivot facet.
But how do I have the having clause implemented in my Solr Query. Without
having clause in place the number of records is too large and so the
pivoting on A is returning a very large result. In addition the number of
distinct value for A is also very high.



Please advice me how to solve this problem.



P.S. It is not possible for me to use Solr SQL of Solr 6 which allows above
SQL to execute.



Regards,

Sagar Palao


Translating SQL having clause in Solr query

2018-08-07 Thread SAGAR PALO
Hi Guys,

I am new to the Solr world and I am using Solr 5.4.1. I have a question and 
hope to find answer to the same.

Consider a SQL query as:

select A, sum(B), sum(C)
from Col1
where D = ‘Test’
group by A
having sum(B) > 20
order by A
limit 100

I am able to translate the above to Solr Query partially using pivot facet. But 
how do I have the having clause implemented in my Solr Query. Without having 
clause in place the number of records is too large and so the pivoting on A is 
returning a very large result. In addition the number of distinct value for A 
is also very high.

Please advice me how to solve this problem.

P.S. It is not possible for me to use Solr SQL of Solr 6 which allows above SQL 
to execute. 

Regards,
Sagar Palao


Translating SQL having clause in Solr query

2018-08-07 Thread SAGAR PALAO
Hi Guys,



I am new to the Solr world and I am using Solr 5.4.1. I have a question and
hope to find answer to the same.



Consider a SQL query as:



select A, sum(B), sum(C)

from Col1

where D = ‘Test’

group by A

*having sum(B) > 20*

order by A

limit 100



I am able to translate the above to Solr Query partially using pivot facet.
But how do I have the having clause implemented in my Solr Query. Without
having clause in place the number of records is too large and so the
pivoting on A is returning a very large result. In addition the number of
distinct value for A is also very high.



Please advice me how to solve this problem.



P.S. It is not possible for me to use Solr SQL of Solr 6 which allows above
SQL to execute.



Regards,

Sagar Palao


Solr query string compare to actual date and build a new string on this?

2018-05-31 Thread servus01
Hey,

digging the web for a while now to find a solution due to a complex search
string.

what i've got:

xml file with a date/description fields which are not part of the index:

(start-date-time="2018-04-01T18:00:00.000+02:00" code-name="MD 28")
(start-date-time="2018-04-07T15:00:00.000+02:00" code-name="MD 29")
(start-date-time="2018-04-12T18:30:00.000+02:00" code-name="MD 30")

what i want to have is a query string which checks the xml document against
the actual date to query my solr search like this:

select?q=*Goals*=roundTypeWithIndex%3A*insert actual/latest MD
here*=json=true=0=50=true

Is there any kind of possibility to do this by solr itself or i would really
appriciate any kind of solution on this.

Thanks

Francois



--
Sent from: http://lucene.472066.n3.nabble.com/Solr-User-f472068.html


Re: solr query

2018-03-15 Thread Walter Underwood
We have an index with thousands of fields. Only a few are accessed on each 
query.

These fields break out three different kinds of weights for a thousand or so 
different school subjects. Each query is just for one subject, so the scoring 
uses those three fields. Like:

* weight_a_1234
* weight_b_1234
* weight_c_1234

Another query would use:

* weight_a_4567
* weight_b_4567
* weight_c_4567

And so on… Lots of fields, but queries run in 15 milliseconds even with updates 
every few minutes.

wunder
Walter Underwood
wun...@wunderwood.org
http://observer.wunderwood.org/  (my blog)

> On Mar 15, 2018, at 2:51 AM, Stefan Matheis <matheis.ste...@gmail.com> wrote:
> 
>> Is this practical adding so much additional fields?
> 
> Well, as always "it depends" .. the way I see it: what are 20 fields? They
> just sit around and make your life way easier.
> 
> You have two choices: stay with one field and have a hard time ... or add
> another 20 or so which do exactly what you want.
> 
> To complete this with another use case: full text search including phonetic
> matches. Instead of just having _one_ field for "name" and a awful list of
> analyzers on it ... I'd probably go with a bunch of them: Separate first-
> and last name, another two (one for each part of the name) for lowercase
> variants, another two for phonetic variants .. which already makes six. You
> get the possibility to do boosting on those aspects more or less for free
> ..
> 
> Almost always it's write once, read often .. so do the heavy lifting while
> indexing and enjoy simple queries.
> 
> - Stefan
> 
> On Mar 15, 2018 8:12 AM, "Albert Lee" <albertlee8...@gmail.com> wrote:
> 
>> Cause I got about 20 date fields or more. If add a separate field for it,
>> then I have to add additional 3 field for each of them.  For example, for
>> the field birthdate, I need to add birthdate_year, birthdate_month,
>> birthdate_day.
>> Is this practical adding so much additional fields?
>> 
>> Albert
>> From: Stefan Matheis
>> Sent: Thursday, March 15, 2018 3:05 PM
>> To: solr-user@lucene.apache.org
>> Subject: RE: solr query
>> 
>>> You have any other idea?
>> 
>> Yes, we go back to start and discuss again why you're not adding a separate
>> field for that. It's the simplest thing possible and avoids all those
>> workarounds that got mentioned.
>> 
>> -Stefan
>> 
>> On Mar 15, 2018 4:08 AM, "Albert Lee" <albertlee8...@gmail.com> wrote:
>> 
>>> Hi Emir,
>>> 
>>> If using OR-ed conditions for different years then the query will be very
>>> long if I got 100 years and I think this is not practical.
>>> You have any other idea?
>>> 
>>> Regards,
>>> Albert
>>> From: Gus Heck
>>> Sent: Thursday, March 15, 2018 12:43 AM
>>> To: solr-user@lucene.apache.org
>>> Subject: Re: solr query
>>> 
>>> I think you have inadvertently "corrected" the intentional exclusive end
>> on
>>> my range... [NOW/MONTH TO NOW/MONTH+1MONTH}
>>> 
>>> On Wed, Mar 14, 2018 at 12:08 PM, Emir Arnautović <
>>> emir.arnauto...@sematext.com> wrote:
>>> 
>>>> Hi Gus,
>>>> It is just current month, but Albert is interested in month, regardless
>>> of
>>>> year. It can be done with OR-ed conditions for different years:
>>>> birthDate:[NOW/MONTH TO NOW/MONTH+1MONTH] OR birthDate:[NOW-1YEAR/MONTH
>>> TO
>>>> NOW-1YEAR/MONTH+1MONTH] OR birthDate:[NOW-2YEAR/MONTH TO
>>>> NOW-2YEAR/MONTH+1MONTH] OR…
>>>> 
>>>> Emir
>>>> --
>>>> Monitoring - Log Management - Alerting - Anomaly Detection
>>>> Solr & Elasticsearch Consulting Support Training -
>> http://sematext.com/
>>>> 
>>>> 
>>>> 
>>>>> On 14 Mar 2018, at 16:55, Gus Heck <gus.h...@gmail.com> wrote:
>>>>> 
>>>>> I think you can specify the current month with
>>>>> 
>>>>> birthDate:[NOW/MONTH TO NOW/MONTH+1MONTH}
>>>>> 
>>>>> does that work for you?
>>>>> 
>>>>> On Wed, Mar 14, 2018 at 6:32 AM, Emir Arnautović <
>>>>> emir.arnauto...@sematext.com> wrote:
>>>>> 
>>>>>> Actually you don’t have to add another field - there is function ms
>>> that
>>>>>> converts date to timestamp. What you can do is use frange query
>> parser
>>>> and
>>>>>> play bit with math, e

RE: solr query

2018-03-15 Thread Stefan Matheis
> Is this practical adding so much additional fields?

Well, as always "it depends" .. the way I see it: what are 20 fields? They
just sit around and make your life way easier.

You have two choices: stay with one field and have a hard time ... or add
another 20 or so which do exactly what you want.

To complete this with another use case: full text search including phonetic
matches. Instead of just having _one_ field for "name" and a awful list of
analyzers on it ... I'd probably go with a bunch of them: Separate first-
and last name, another two (one for each part of the name) for lowercase
variants, another two for phonetic variants .. which already makes six. You
get the possibility to do boosting on those aspects more or less for free
..

Almost always it's write once, read often .. so do the heavy lifting while
indexing and enjoy simple queries.

- Stefan

On Mar 15, 2018 8:12 AM, "Albert Lee" <albertlee8...@gmail.com> wrote:

> Cause I got about 20 date fields or more. If add a separate field for it,
> then I have to add additional 3 field for each of them.  For example, for
> the field birthdate, I need to add birthdate_year, birthdate_month,
> birthdate_day.
> Is this practical adding so much additional fields?
>
> Albert
> From: Stefan Matheis
> Sent: Thursday, March 15, 2018 3:05 PM
> To: solr-user@lucene.apache.org
> Subject: RE: solr query
>
> > You have any other idea?
>
> Yes, we go back to start and discuss again why you're not adding a separate
> field for that. It's the simplest thing possible and avoids all those
> workarounds that got mentioned.
>
> -Stefan
>
> On Mar 15, 2018 4:08 AM, "Albert Lee" <albertlee8...@gmail.com> wrote:
>
> > Hi Emir,
> >
> > If using OR-ed conditions for different years then the query will be very
> > long if I got 100 years and I think this is not practical.
> > You have any other idea?
> >
> > Regards,
> > Albert
> > From: Gus Heck
> > Sent: Thursday, March 15, 2018 12:43 AM
> > To: solr-user@lucene.apache.org
> > Subject: Re: solr query
> >
> > I think you have inadvertently "corrected" the intentional exclusive end
> on
> > my range... [NOW/MONTH TO NOW/MONTH+1MONTH}
> >
> > On Wed, Mar 14, 2018 at 12:08 PM, Emir Arnautović <
> > emir.arnauto...@sematext.com> wrote:
> >
> > > Hi Gus,
> > > It is just current month, but Albert is interested in month, regardless
> > of
> > > year. It can be done with OR-ed conditions for different years:
> > > birthDate:[NOW/MONTH TO NOW/MONTH+1MONTH] OR birthDate:[NOW-1YEAR/MONTH
> > TO
> > > NOW-1YEAR/MONTH+1MONTH] OR birthDate:[NOW-2YEAR/MONTH TO
> > > NOW-2YEAR/MONTH+1MONTH] OR…
> > >
> > > Emir
> > > --
> > > Monitoring - Log Management - Alerting - Anomaly Detection
> > > Solr & Elasticsearch Consulting Support Training -
> http://sematext.com/
> > >
> > >
> > >
> > > > On 14 Mar 2018, at 16:55, Gus Heck <gus.h...@gmail.com> wrote:
> > > >
> > > > I think you can specify the current month with
> > > >
> > > > birthDate:[NOW/MONTH TO NOW/MONTH+1MONTH}
> > > >
> > > > does that work for you?
> > > >
> > > > On Wed, Mar 14, 2018 at 6:32 AM, Emir Arnautović <
> > > > emir.arnauto...@sematext.com> wrote:
> > > >
> > > >> Actually you don’t have to add another field - there is function ms
> > that
> > > >> converts date to timestamp. What you can do is use frange query
> parser
> > > and
> > > >> play bit with math, e.g. sub(ms(date_field),ms(NOW/YEAR)) will give
> > you
> > > >> ms elapsed since this year and you know that from 0 to 31*8640
> is
> > > >> January, from 31*8640+1 to … is February and so on.
> > > >>
> > > >> If you go this path, I would suggest custom function that will
> convert
> > > >> date to month/year.
> > > >>
> > > >> HTH,
> > > >> Emir
> > > >> --
> > > >> Monitoring - Log Management - Alerting - Anomaly Detection
> > > >> Solr & Elasticsearch Consulting Support Training -
> > http://sematext.com/
> > > >>
> > > >>
> > > >>
> > > >>> On 14 Mar 2018, at 10:53, Albert Lee <albertlee8...@gmail.com>
> > wrote:
> > > >>>
> > > >>> I don’t want to add separate fields since I have many dates to
> in

RE: solr query

2018-03-15 Thread Albert Lee
Cause I got about 20 date fields or more. If add a separate field for it, then 
I have to add additional 3 field for each of them.  For example, for the field 
birthdate, I need to add birthdate_year, birthdate_month, birthdate_day.
Is this practical adding so much additional fields?

Albert 
From: Stefan Matheis
Sent: Thursday, March 15, 2018 3:05 PM
To: solr-user@lucene.apache.org
Subject: RE: solr query

> You have any other idea?

Yes, we go back to start and discuss again why you're not adding a separate
field for that. It's the simplest thing possible and avoids all those
workarounds that got mentioned.

-Stefan

On Mar 15, 2018 4:08 AM, "Albert Lee" <albertlee8...@gmail.com> wrote:

> Hi Emir,
>
> If using OR-ed conditions for different years then the query will be very
> long if I got 100 years and I think this is not practical.
> You have any other idea?
>
> Regards,
> Albert
> From: Gus Heck
> Sent: Thursday, March 15, 2018 12:43 AM
> To: solr-user@lucene.apache.org
> Subject: Re: solr query
>
> I think you have inadvertently "corrected" the intentional exclusive end on
> my range... [NOW/MONTH TO NOW/MONTH+1MONTH}
>
> On Wed, Mar 14, 2018 at 12:08 PM, Emir Arnautović <
> emir.arnauto...@sematext.com> wrote:
>
> > Hi Gus,
> > It is just current month, but Albert is interested in month, regardless
> of
> > year. It can be done with OR-ed conditions for different years:
> > birthDate:[NOW/MONTH TO NOW/MONTH+1MONTH] OR birthDate:[NOW-1YEAR/MONTH
> TO
> > NOW-1YEAR/MONTH+1MONTH] OR birthDate:[NOW-2YEAR/MONTH TO
> > NOW-2YEAR/MONTH+1MONTH] OR…
> >
> > Emir
> > --
> > Monitoring - Log Management - Alerting - Anomaly Detection
> > Solr & Elasticsearch Consulting Support Training - http://sematext.com/
> >
> >
> >
> > > On 14 Mar 2018, at 16:55, Gus Heck <gus.h...@gmail.com> wrote:
> > >
> > > I think you can specify the current month with
> > >
> > > birthDate:[NOW/MONTH TO NOW/MONTH+1MONTH}
> > >
> > > does that work for you?
> > >
> > > On Wed, Mar 14, 2018 at 6:32 AM, Emir Arnautović <
> > > emir.arnauto...@sematext.com> wrote:
> > >
> > >> Actually you don’t have to add another field - there is function ms
> that
> > >> converts date to timestamp. What you can do is use frange query parser
> > and
> > >> play bit with math, e.g. sub(ms(date_field),ms(NOW/YEAR)) will give
> you
> > >> ms elapsed since this year and you know that from 0 to 31*8640 is
> > >> January, from 31*8640+1 to … is February and so on.
> > >>
> > >> If you go this path, I would suggest custom function that will convert
> > >> date to month/year.
> > >>
> > >> HTH,
> > >> Emir
> > >> --
> > >> Monitoring - Log Management - Alerting - Anomaly Detection
> > >> Solr & Elasticsearch Consulting Support Training -
> http://sematext.com/
> > >>
> > >>
> > >>
> > >>> On 14 Mar 2018, at 10:53, Albert Lee <albertlee8...@gmail.com>
> wrote:
> > >>>
> > >>> I don’t want to add separate fields since I have many dates to index.
> > >> How to index it as timestamp and do function query, any example or
> > >> documentation?
> > >>>
> > >>> Regards,
> > >>> Albert
> > >>>
> > >>> From: Emir Arnautović
> > >>> Sent: Wednesday, March 14, 2018 5:38 PM
> > >>> To: solr-user@lucene.apache.org
> > >>> Subject: Re: solr query
> > >>>
> > >>> Hi Albert,
> > >>> The simplest solution is to index month/year as separate fields.
> > >> Alternative is to index it as timestamp and do function query to do
> some
> > >> math and filter out records.
> > >>>
> > >>> Emir
> > >>> --
> > >>> Monitoring - Log Management - Alerting - Anomaly Detection
> > >>> Solr & Elasticsearch Consulting Support Training -
> > http://sematext.com/
> > >>>
> > >>>
> > >>>
> > >>>> On 14 Mar 2018, at 10:31, Albert Lee <albertlee8...@gmail.com>
> wrote:
> > >>>>
> > >>>> NOW/MONTH and NOW/YEAR to get the start of month/year, but how can I
> > >> get current month of regardless year. Like the use case,  people who’s
> > >> birthdate is this month?
> > >>>>
> >

RE: solr query

2018-03-15 Thread Stefan Matheis
> You have any other idea?

Yes, we go back to start and discuss again why you're not adding a separate
field for that. It's the simplest thing possible and avoids all those
workarounds that got mentioned.

-Stefan

On Mar 15, 2018 4:08 AM, "Albert Lee" <albertlee8...@gmail.com> wrote:

> Hi Emir,
>
> If using OR-ed conditions for different years then the query will be very
> long if I got 100 years and I think this is not practical.
> You have any other idea?
>
> Regards,
> Albert
> From: Gus Heck
> Sent: Thursday, March 15, 2018 12:43 AM
> To: solr-user@lucene.apache.org
> Subject: Re: solr query
>
> I think you have inadvertently "corrected" the intentional exclusive end on
> my range... [NOW/MONTH TO NOW/MONTH+1MONTH}
>
> On Wed, Mar 14, 2018 at 12:08 PM, Emir Arnautović <
> emir.arnauto...@sematext.com> wrote:
>
> > Hi Gus,
> > It is just current month, but Albert is interested in month, regardless
> of
> > year. It can be done with OR-ed conditions for different years:
> > birthDate:[NOW/MONTH TO NOW/MONTH+1MONTH] OR birthDate:[NOW-1YEAR/MONTH
> TO
> > NOW-1YEAR/MONTH+1MONTH] OR birthDate:[NOW-2YEAR/MONTH TO
> > NOW-2YEAR/MONTH+1MONTH] OR…
> >
> > Emir
> > --
> > Monitoring - Log Management - Alerting - Anomaly Detection
> > Solr & Elasticsearch Consulting Support Training - http://sematext.com/
> >
> >
> >
> > > On 14 Mar 2018, at 16:55, Gus Heck <gus.h...@gmail.com> wrote:
> > >
> > > I think you can specify the current month with
> > >
> > > birthDate:[NOW/MONTH TO NOW/MONTH+1MONTH}
> > >
> > > does that work for you?
> > >
> > > On Wed, Mar 14, 2018 at 6:32 AM, Emir Arnautović <
> > > emir.arnauto...@sematext.com> wrote:
> > >
> > >> Actually you don’t have to add another field - there is function ms
> that
> > >> converts date to timestamp. What you can do is use frange query parser
> > and
> > >> play bit with math, e.g. sub(ms(date_field),ms(NOW/YEAR)) will give
> you
> > >> ms elapsed since this year and you know that from 0 to 31*8640 is
> > >> January, from 31*8640+1 to … is February and so on.
> > >>
> > >> If you go this path, I would suggest custom function that will convert
> > >> date to month/year.
> > >>
> > >> HTH,
> > >> Emir
> > >> --
> > >> Monitoring - Log Management - Alerting - Anomaly Detection
> > >> Solr & Elasticsearch Consulting Support Training -
> http://sematext.com/
> > >>
> > >>
> > >>
> > >>> On 14 Mar 2018, at 10:53, Albert Lee <albertlee8...@gmail.com>
> wrote:
> > >>>
> > >>> I don’t want to add separate fields since I have many dates to index.
> > >> How to index it as timestamp and do function query, any example or
> > >> documentation?
> > >>>
> > >>> Regards,
> > >>> Albert
> > >>>
> > >>> From: Emir Arnautović
> > >>> Sent: Wednesday, March 14, 2018 5:38 PM
> > >>> To: solr-user@lucene.apache.org
> > >>> Subject: Re: solr query
> > >>>
> > >>> Hi Albert,
> > >>> The simplest solution is to index month/year as separate fields.
> > >> Alternative is to index it as timestamp and do function query to do
> some
> > >> math and filter out records.
> > >>>
> > >>> Emir
> > >>> --
> > >>> Monitoring - Log Management - Alerting - Anomaly Detection
> > >>> Solr & Elasticsearch Consulting Support Training -
> > http://sematext.com/
> > >>>
> > >>>
> > >>>
> > >>>> On 14 Mar 2018, at 10:31, Albert Lee <albertlee8...@gmail.com>
> wrote:
> > >>>>
> > >>>> NOW/MONTH and NOW/YEAR to get the start of month/year, but how can I
> > >> get current month of regardless year. Like the use case,  people who’s
> > >> birthdate is this month?
> > >>>>
> > >>>> Regard,
> > >>>> Albert
> > >>>>
> > >>>>
> > >>>> From: Emir Arnautović
> > >>>> Sent: Wednesday, March 14, 2018 5:26 PM
> > >>>> To: solr-user@lucene.apache.org
> > >>>> Subject: Re: solr query
> > >>>>
> > >>>> Hi Albert,
> > >>>> It does - you can use NOW/MONTH and NOW/YEAR to get the start of
> > >> month/year. Here is reference to date math:
> https://lucene.apache.org/
> > >> solr/guide/6_6/working-with-dates.html#WorkingwithDates-
> DateMathSyntax
> > <
> > >> https://lucene.apache.org/solr/guide/6_6/working-with-
> > >> dates.html#WorkingwithDates-DateMathSyntax>
> > >>>>
> > >>>> HTH,
> > >>>> Emir
> > >>>> --
> > >>>> Monitoring - Log Management - Alerting - Anomaly Detection
> > >>>> Solr & Elasticsearch Consulting Support Training -
> > http://sematext.com/
> > >>>>
> > >>>>
> > >>>>
> > >>>>> On 14 Mar 2018, at 04:21, Albert Lee <albertlee8...@gmail.com>
> > wrote:
> > >>>>>
> > >>>>> Dear Solr,
> > >>>>> I want to whether solr support query by this year or this month?
> > >>>>> If can, how to do that.
> > >>>>> Thanks.
> > >>>>>
> > >>>>> Regards,
> > >>>>> Albert
> > >>>>>
> > >>>>
> > >>>>
> > >>>
> > >>>
> > >>
> > >>
> > >
> > >
> > > --
> > > http://www.the111shift.com
> >
> >
>
>
> --
> http://www.the111shift.com
>
>


RE: solr query

2018-03-14 Thread Albert Lee
Hi Emir,

If using OR-ed conditions for different years then the query will be very long 
if I got 100 years and I think this is not practical. 
You have any other idea?

Regards,
Albert
From: Gus Heck
Sent: Thursday, March 15, 2018 12:43 AM
To: solr-user@lucene.apache.org
Subject: Re: solr query

I think you have inadvertently "corrected" the intentional exclusive end on
my range... [NOW/MONTH TO NOW/MONTH+1MONTH}

On Wed, Mar 14, 2018 at 12:08 PM, Emir Arnautović <
emir.arnauto...@sematext.com> wrote:

> Hi Gus,
> It is just current month, but Albert is interested in month, regardless of
> year. It can be done with OR-ed conditions for different years:
> birthDate:[NOW/MONTH TO NOW/MONTH+1MONTH] OR birthDate:[NOW-1YEAR/MONTH TO
> NOW-1YEAR/MONTH+1MONTH] OR birthDate:[NOW-2YEAR/MONTH TO
> NOW-2YEAR/MONTH+1MONTH] OR…
>
> Emir
> --
> Monitoring - Log Management - Alerting - Anomaly Detection
> Solr & Elasticsearch Consulting Support Training - http://sematext.com/
>
>
>
> > On 14 Mar 2018, at 16:55, Gus Heck <gus.h...@gmail.com> wrote:
> >
> > I think you can specify the current month with
> >
> > birthDate:[NOW/MONTH TO NOW/MONTH+1MONTH}
> >
> > does that work for you?
> >
> > On Wed, Mar 14, 2018 at 6:32 AM, Emir Arnautović <
> > emir.arnauto...@sematext.com> wrote:
> >
> >> Actually you don’t have to add another field - there is function ms that
> >> converts date to timestamp. What you can do is use frange query parser
> and
> >> play bit with math, e.g. sub(ms(date_field),ms(NOW/YEAR)) will give you
> >> ms elapsed since this year and you know that from 0 to 31*8640 is
> >> January, from 31*8640+1 to … is February and so on.
> >>
> >> If you go this path, I would suggest custom function that will convert
> >> date to month/year.
> >>
> >> HTH,
> >> Emir
> >> --
> >> Monitoring - Log Management - Alerting - Anomaly Detection
> >> Solr & Elasticsearch Consulting Support Training - http://sematext.com/
> >>
> >>
> >>
> >>> On 14 Mar 2018, at 10:53, Albert Lee <albertlee8...@gmail.com> wrote:
> >>>
> >>> I don’t want to add separate fields since I have many dates to index.
> >> How to index it as timestamp and do function query, any example or
> >> documentation?
> >>>
> >>> Regards,
> >>> Albert
> >>>
> >>> From: Emir Arnautović
> >>> Sent: Wednesday, March 14, 2018 5:38 PM
> >>> To: solr-user@lucene.apache.org
> >>> Subject: Re: solr query
> >>>
> >>> Hi Albert,
> >>> The simplest solution is to index month/year as separate fields.
> >> Alternative is to index it as timestamp and do function query to do some
> >> math and filter out records.
> >>>
> >>> Emir
> >>> --
> >>> Monitoring - Log Management - Alerting - Anomaly Detection
> >>> Solr & Elasticsearch Consulting Support Training -
> http://sematext.com/
> >>>
> >>>
> >>>
> >>>> On 14 Mar 2018, at 10:31, Albert Lee <albertlee8...@gmail.com> wrote:
> >>>>
> >>>> NOW/MONTH and NOW/YEAR to get the start of month/year, but how can I
> >> get current month of regardless year. Like the use case,  people who’s
> >> birthdate is this month?
> >>>>
> >>>> Regard,
> >>>> Albert
> >>>>
> >>>>
> >>>> From: Emir Arnautović
> >>>> Sent: Wednesday, March 14, 2018 5:26 PM
> >>>> To: solr-user@lucene.apache.org
> >>>> Subject: Re: solr query
> >>>>
> >>>> Hi Albert,
> >>>> It does - you can use NOW/MONTH and NOW/YEAR to get the start of
> >> month/year. Here is reference to date math: https://lucene.apache.org/
> >> solr/guide/6_6/working-with-dates.html#WorkingwithDates-DateMathSyntax
> <
> >> https://lucene.apache.org/solr/guide/6_6/working-with-
> >> dates.html#WorkingwithDates-DateMathSyntax>
> >>>>
> >>>> HTH,
> >>>> Emir
> >>>> --
> >>>> Monitoring - Log Management - Alerting - Anomaly Detection
> >>>> Solr & Elasticsearch Consulting Support Training -
> http://sematext.com/
> >>>>
> >>>>
> >>>>
> >>>>> On 14 Mar 2018, at 04:21, Albert Lee <albertlee8...@gmail.com>
> wrote:
> >>>>>
> >>>>> Dear Solr,
> >>>>> I want to whether solr support query by this year or this month?
> >>>>> If can, how to do that.
> >>>>> Thanks.
> >>>>>
> >>>>> Regards,
> >>>>> Albert
> >>>>>
> >>>>
> >>>>
> >>>
> >>>
> >>
> >>
> >
> >
> > --
> > http://www.the111shift.com
>
>


-- 
http://www.the111shift.com



Re: solr query

2018-03-14 Thread Emir Arnautović
Right - I focused more on the fact that Albert was not just looking for the 
current mont of the current year.

Emir
--
Monitoring - Log Management - Alerting - Anomaly Detection
Solr & Elasticsearch Consulting Support Training - http://sematext.com/



> On 14 Mar 2018, at 17:43, Gus Heck <gus.h...@gmail.com> wrote:
> 
> I think you have inadvertently "corrected" the intentional exclusive end on
> my range... [NOW/MONTH TO NOW/MONTH+1MONTH}
> 
> On Wed, Mar 14, 2018 at 12:08 PM, Emir Arnautović <
> emir.arnauto...@sematext.com> wrote:
> 
>> Hi Gus,
>> It is just current month, but Albert is interested in month, regardless of
>> year. It can be done with OR-ed conditions for different years:
>> birthDate:[NOW/MONTH TO NOW/MONTH+1MONTH] OR birthDate:[NOW-1YEAR/MONTH TO
>> NOW-1YEAR/MONTH+1MONTH] OR birthDate:[NOW-2YEAR/MONTH TO
>> NOW-2YEAR/MONTH+1MONTH] OR…
>> 
>> Emir
>> --
>> Monitoring - Log Management - Alerting - Anomaly Detection
>> Solr & Elasticsearch Consulting Support Training - http://sematext.com/
>> 
>> 
>> 
>>> On 14 Mar 2018, at 16:55, Gus Heck <gus.h...@gmail.com> wrote:
>>> 
>>> I think you can specify the current month with
>>> 
>>> birthDate:[NOW/MONTH TO NOW/MONTH+1MONTH}
>>> 
>>> does that work for you?
>>> 
>>> On Wed, Mar 14, 2018 at 6:32 AM, Emir Arnautović <
>>> emir.arnauto...@sematext.com> wrote:
>>> 
>>>> Actually you don’t have to add another field - there is function ms that
>>>> converts date to timestamp. What you can do is use frange query parser
>> and
>>>> play bit with math, e.g. sub(ms(date_field),ms(NOW/YEAR)) will give you
>>>> ms elapsed since this year and you know that from 0 to 31*8640 is
>>>> January, from 31*8640+1 to … is February and so on.
>>>> 
>>>> If you go this path, I would suggest custom function that will convert
>>>> date to month/year.
>>>> 
>>>> HTH,
>>>> Emir
>>>> --
>>>> Monitoring - Log Management - Alerting - Anomaly Detection
>>>> Solr & Elasticsearch Consulting Support Training - http://sematext.com/
>>>> 
>>>> 
>>>> 
>>>>> On 14 Mar 2018, at 10:53, Albert Lee <albertlee8...@gmail.com> wrote:
>>>>> 
>>>>> I don’t want to add separate fields since I have many dates to index.
>>>> How to index it as timestamp and do function query, any example or
>>>> documentation?
>>>>> 
>>>>> Regards,
>>>>> Albert
>>>>> 
>>>>> From: Emir Arnautović
>>>>> Sent: Wednesday, March 14, 2018 5:38 PM
>>>>> To: solr-user@lucene.apache.org
>>>>> Subject: Re: solr query
>>>>> 
>>>>> Hi Albert,
>>>>> The simplest solution is to index month/year as separate fields.
>>>> Alternative is to index it as timestamp and do function query to do some
>>>> math and filter out records.
>>>>> 
>>>>> Emir
>>>>> --
>>>>> Monitoring - Log Management - Alerting - Anomaly Detection
>>>>> Solr & Elasticsearch Consulting Support Training -
>> http://sematext.com/
>>>>> 
>>>>> 
>>>>> 
>>>>>> On 14 Mar 2018, at 10:31, Albert Lee <albertlee8...@gmail.com> wrote:
>>>>>> 
>>>>>> NOW/MONTH and NOW/YEAR to get the start of month/year, but how can I
>>>> get current month of regardless year. Like the use case,  people who’s
>>>> birthdate is this month?
>>>>>> 
>>>>>> Regard,
>>>>>> Albert
>>>>>> 
>>>>>> 
>>>>>> From: Emir Arnautović
>>>>>> Sent: Wednesday, March 14, 2018 5:26 PM
>>>>>> To: solr-user@lucene.apache.org
>>>>>> Subject: Re: solr query
>>>>>> 
>>>>>> Hi Albert,
>>>>>> It does - you can use NOW/MONTH and NOW/YEAR to get the start of
>>>> month/year. Here is reference to date math: https://lucene.apache.org/
>>>> solr/guide/6_6/working-with-dates.html#WorkingwithDates-DateMathSyntax
>> <
>>>> https://lucene.apache.org/solr/guide/6_6/working-with-
>>>> dates.html#WorkingwithDates-DateMathSyntax>
>>>>>> 
>>>>>> HTH,
>>>>>> Emir
>>>>>> --
>>>>>> Monitoring - Log Management - Alerting - Anomaly Detection
>>>>>> Solr & Elasticsearch Consulting Support Training -
>> http://sematext.com/
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>>> On 14 Mar 2018, at 04:21, Albert Lee <albertlee8...@gmail.com>
>> wrote:
>>>>>>> 
>>>>>>> Dear Solr,
>>>>>>> I want to whether solr support query by this year or this month?
>>>>>>> If can, how to do that.
>>>>>>> Thanks.
>>>>>>> 
>>>>>>> Regards,
>>>>>>> Albert
>>>>>>> 
>>>>>> 
>>>>>> 
>>>>> 
>>>>> 
>>>> 
>>>> 
>>> 
>>> 
>>> --
>>> http://www.the111shift.com
>> 
>> 
> 
> 
> -- 
> http://www.the111shift.com



Re: solr query

2018-03-14 Thread Gus Heck
I think you have inadvertently "corrected" the intentional exclusive end on
my range... [NOW/MONTH TO NOW/MONTH+1MONTH}

On Wed, Mar 14, 2018 at 12:08 PM, Emir Arnautović <
emir.arnauto...@sematext.com> wrote:

> Hi Gus,
> It is just current month, but Albert is interested in month, regardless of
> year. It can be done with OR-ed conditions for different years:
> birthDate:[NOW/MONTH TO NOW/MONTH+1MONTH] OR birthDate:[NOW-1YEAR/MONTH TO
> NOW-1YEAR/MONTH+1MONTH] OR birthDate:[NOW-2YEAR/MONTH TO
> NOW-2YEAR/MONTH+1MONTH] OR…
>
> Emir
> --
> Monitoring - Log Management - Alerting - Anomaly Detection
> Solr & Elasticsearch Consulting Support Training - http://sematext.com/
>
>
>
> > On 14 Mar 2018, at 16:55, Gus Heck <gus.h...@gmail.com> wrote:
> >
> > I think you can specify the current month with
> >
> > birthDate:[NOW/MONTH TO NOW/MONTH+1MONTH}
> >
> > does that work for you?
> >
> > On Wed, Mar 14, 2018 at 6:32 AM, Emir Arnautović <
> > emir.arnauto...@sematext.com> wrote:
> >
> >> Actually you don’t have to add another field - there is function ms that
> >> converts date to timestamp. What you can do is use frange query parser
> and
> >> play bit with math, e.g. sub(ms(date_field),ms(NOW/YEAR)) will give you
> >> ms elapsed since this year and you know that from 0 to 31*8640 is
> >> January, from 31*8640+1 to … is February and so on.
> >>
> >> If you go this path, I would suggest custom function that will convert
> >> date to month/year.
> >>
> >> HTH,
> >> Emir
> >> --
> >> Monitoring - Log Management - Alerting - Anomaly Detection
> >> Solr & Elasticsearch Consulting Support Training - http://sematext.com/
> >>
> >>
> >>
> >>> On 14 Mar 2018, at 10:53, Albert Lee <albertlee8...@gmail.com> wrote:
> >>>
> >>> I don’t want to add separate fields since I have many dates to index.
> >> How to index it as timestamp and do function query, any example or
> >> documentation?
> >>>
> >>> Regards,
> >>> Albert
> >>>
> >>> From: Emir Arnautović
> >>> Sent: Wednesday, March 14, 2018 5:38 PM
> >>> To: solr-user@lucene.apache.org
> >>> Subject: Re: solr query
> >>>
> >>> Hi Albert,
> >>> The simplest solution is to index month/year as separate fields.
> >> Alternative is to index it as timestamp and do function query to do some
> >> math and filter out records.
> >>>
> >>> Emir
> >>> --
> >>> Monitoring - Log Management - Alerting - Anomaly Detection
> >>> Solr & Elasticsearch Consulting Support Training -
> http://sematext.com/
> >>>
> >>>
> >>>
> >>>> On 14 Mar 2018, at 10:31, Albert Lee <albertlee8...@gmail.com> wrote:
> >>>>
> >>>> NOW/MONTH and NOW/YEAR to get the start of month/year, but how can I
> >> get current month of regardless year. Like the use case,  people who’s
> >> birthdate is this month?
> >>>>
> >>>> Regard,
> >>>> Albert
> >>>>
> >>>>
> >>>> From: Emir Arnautović
> >>>> Sent: Wednesday, March 14, 2018 5:26 PM
> >>>> To: solr-user@lucene.apache.org
> >>>> Subject: Re: solr query
> >>>>
> >>>> Hi Albert,
> >>>> It does - you can use NOW/MONTH and NOW/YEAR to get the start of
> >> month/year. Here is reference to date math: https://lucene.apache.org/
> >> solr/guide/6_6/working-with-dates.html#WorkingwithDates-DateMathSyntax
> <
> >> https://lucene.apache.org/solr/guide/6_6/working-with-
> >> dates.html#WorkingwithDates-DateMathSyntax>
> >>>>
> >>>> HTH,
> >>>> Emir
> >>>> --
> >>>> Monitoring - Log Management - Alerting - Anomaly Detection
> >>>> Solr & Elasticsearch Consulting Support Training -
> http://sematext.com/
> >>>>
> >>>>
> >>>>
> >>>>> On 14 Mar 2018, at 04:21, Albert Lee <albertlee8...@gmail.com>
> wrote:
> >>>>>
> >>>>> Dear Solr,
> >>>>> I want to whether solr support query by this year or this month?
> >>>>> If can, how to do that.
> >>>>> Thanks.
> >>>>>
> >>>>> Regards,
> >>>>> Albert
> >>>>>
> >>>>
> >>>>
> >>>
> >>>
> >>
> >>
> >
> >
> > --
> > http://www.the111shift.com
>
>


-- 
http://www.the111shift.com


Re: solr query

2018-03-14 Thread Emir Arnautović
Hi Gus,
It is just current month, but Albert is interested in month, regardless of 
year. It can be done with OR-ed conditions for different years:
birthDate:[NOW/MONTH TO NOW/MONTH+1MONTH] OR birthDate:[NOW-1YEAR/MONTH TO 
NOW-1YEAR/MONTH+1MONTH] OR birthDate:[NOW-2YEAR/MONTH TO 
NOW-2YEAR/MONTH+1MONTH] OR…

Emir
--
Monitoring - Log Management - Alerting - Anomaly Detection
Solr & Elasticsearch Consulting Support Training - http://sematext.com/



> On 14 Mar 2018, at 16:55, Gus Heck <gus.h...@gmail.com> wrote:
> 
> I think you can specify the current month with
> 
> birthDate:[NOW/MONTH TO NOW/MONTH+1MONTH}
> 
> does that work for you?
> 
> On Wed, Mar 14, 2018 at 6:32 AM, Emir Arnautović <
> emir.arnauto...@sematext.com> wrote:
> 
>> Actually you don’t have to add another field - there is function ms that
>> converts date to timestamp. What you can do is use frange query parser and
>> play bit with math, e.g. sub(ms(date_field),ms(NOW/YEAR)) will give you
>> ms elapsed since this year and you know that from 0 to 31*8640 is
>> January, from 31*8640+1 to … is February and so on.
>> 
>> If you go this path, I would suggest custom function that will convert
>> date to month/year.
>> 
>> HTH,
>> Emir
>> --
>> Monitoring - Log Management - Alerting - Anomaly Detection
>> Solr & Elasticsearch Consulting Support Training - http://sematext.com/
>> 
>> 
>> 
>>> On 14 Mar 2018, at 10:53, Albert Lee <albertlee8...@gmail.com> wrote:
>>> 
>>> I don’t want to add separate fields since I have many dates to index.
>> How to index it as timestamp and do function query, any example or
>> documentation?
>>> 
>>> Regards,
>>> Albert
>>> 
>>> From: Emir Arnautović
>>> Sent: Wednesday, March 14, 2018 5:38 PM
>>> To: solr-user@lucene.apache.org
>>> Subject: Re: solr query
>>> 
>>> Hi Albert,
>>> The simplest solution is to index month/year as separate fields.
>> Alternative is to index it as timestamp and do function query to do some
>> math and filter out records.
>>> 
>>> Emir
>>> --
>>> Monitoring - Log Management - Alerting - Anomaly Detection
>>> Solr & Elasticsearch Consulting Support Training - http://sematext.com/
>>> 
>>> 
>>> 
>>>> On 14 Mar 2018, at 10:31, Albert Lee <albertlee8...@gmail.com> wrote:
>>>> 
>>>> NOW/MONTH and NOW/YEAR to get the start of month/year, but how can I
>> get current month of regardless year. Like the use case,  people who’s
>> birthdate is this month?
>>>> 
>>>> Regard,
>>>> Albert
>>>> 
>>>> 
>>>> From: Emir Arnautović
>>>> Sent: Wednesday, March 14, 2018 5:26 PM
>>>> To: solr-user@lucene.apache.org
>>>> Subject: Re: solr query
>>>> 
>>>> Hi Albert,
>>>> It does - you can use NOW/MONTH and NOW/YEAR to get the start of
>> month/year. Here is reference to date math: https://lucene.apache.org/
>> solr/guide/6_6/working-with-dates.html#WorkingwithDates-DateMathSyntax <
>> https://lucene.apache.org/solr/guide/6_6/working-with-
>> dates.html#WorkingwithDates-DateMathSyntax>
>>>> 
>>>> HTH,
>>>> Emir
>>>> --
>>>> Monitoring - Log Management - Alerting - Anomaly Detection
>>>> Solr & Elasticsearch Consulting Support Training - http://sematext.com/
>>>> 
>>>> 
>>>> 
>>>>> On 14 Mar 2018, at 04:21, Albert Lee <albertlee8...@gmail.com> wrote:
>>>>> 
>>>>> Dear Solr,
>>>>> I want to whether solr support query by this year or this month?
>>>>> If can, how to do that.
>>>>> Thanks.
>>>>> 
>>>>> Regards,
>>>>> Albert
>>>>> 
>>>> 
>>>> 
>>> 
>>> 
>> 
>> 
> 
> 
> -- 
> http://www.the111shift.com



Re: solr query

2018-03-14 Thread Gus Heck
I think you can specify the current month with

birthDate:[NOW/MONTH TO NOW/MONTH+1MONTH}

does that work for you?

On Wed, Mar 14, 2018 at 6:32 AM, Emir Arnautović <
emir.arnauto...@sematext.com> wrote:

> Actually you don’t have to add another field - there is function ms that
> converts date to timestamp. What you can do is use frange query parser and
> play bit with math, e.g. sub(ms(date_field),ms(NOW/YEAR)) will give you
> ms elapsed since this year and you know that from 0 to 31*8640 is
> January, from 31*8640+1 to … is February and so on.
>
> If you go this path, I would suggest custom function that will convert
> date to month/year.
>
> HTH,
> Emir
> --
> Monitoring - Log Management - Alerting - Anomaly Detection
> Solr & Elasticsearch Consulting Support Training - http://sematext.com/
>
>
>
> > On 14 Mar 2018, at 10:53, Albert Lee <albertlee8...@gmail.com> wrote:
> >
> > I don’t want to add separate fields since I have many dates to index.
> How to index it as timestamp and do function query, any example or
> documentation?
> >
> > Regards,
> > Albert
> >
> > From: Emir Arnautović
> > Sent: Wednesday, March 14, 2018 5:38 PM
> > To: solr-user@lucene.apache.org
> > Subject: Re: solr query
> >
> > Hi Albert,
> > The simplest solution is to index month/year as separate fields.
> Alternative is to index it as timestamp and do function query to do some
> math and filter out records.
> >
> > Emir
> > --
> > Monitoring - Log Management - Alerting - Anomaly Detection
> > Solr & Elasticsearch Consulting Support Training - http://sematext.com/
> >
> >
> >
> >> On 14 Mar 2018, at 10:31, Albert Lee <albertlee8...@gmail.com> wrote:
> >>
> >> NOW/MONTH and NOW/YEAR to get the start of month/year, but how can I
> get current month of regardless year. Like the use case,  people who’s
> birthdate is this month?
> >>
> >> Regard,
> >> Albert
> >>
> >>
> >> From: Emir Arnautović
> >> Sent: Wednesday, March 14, 2018 5:26 PM
> >> To: solr-user@lucene.apache.org
> >> Subject: Re: solr query
> >>
> >> Hi Albert,
> >> It does - you can use NOW/MONTH and NOW/YEAR to get the start of
> month/year. Here is reference to date math: https://lucene.apache.org/
> solr/guide/6_6/working-with-dates.html#WorkingwithDates-DateMathSyntax <
> https://lucene.apache.org/solr/guide/6_6/working-with-
> dates.html#WorkingwithDates-DateMathSyntax>
> >>
> >> HTH,
> >> Emir
> >> --
> >> Monitoring - Log Management - Alerting - Anomaly Detection
> >> Solr & Elasticsearch Consulting Support Training - http://sematext.com/
> >>
> >>
> >>
> >>> On 14 Mar 2018, at 04:21, Albert Lee <albertlee8...@gmail.com> wrote:
> >>>
> >>> Dear Solr,
> >>> I want to whether solr support query by this year or this month?
> >>> If can, how to do that.
> >>> Thanks.
> >>>
> >>> Regards,
> >>> Albert
> >>>
> >>
> >>
> >
> >
>
>


-- 
http://www.the111shift.com


Re: solr query

2018-03-14 Thread Emir Arnautović
Actually you don’t have to add another field - there is function ms that 
converts date to timestamp. What you can do is use frange query parser and play 
bit with math, e.g. sub(ms(date_field),ms(NOW/YEAR)) will give you ms elapsed 
since this year and you know that from 0 to 31*8640 is January, from 
31*8640+1 to … is February and so on.

If you go this path, I would suggest custom function that will convert date to 
month/year.

HTH,
Emir
--
Monitoring - Log Management - Alerting - Anomaly Detection
Solr & Elasticsearch Consulting Support Training - http://sematext.com/



> On 14 Mar 2018, at 10:53, Albert Lee <albertlee8...@gmail.com> wrote:
> 
> I don’t want to add separate fields since I have many dates to index. How to 
> index it as timestamp and do function query, any example or documentation?
> 
> Regards,
> Albert
> 
> From: Emir Arnautović
> Sent: Wednesday, March 14, 2018 5:38 PM
> To: solr-user@lucene.apache.org
> Subject: Re: solr query
> 
> Hi Albert,
> The simplest solution is to index month/year as separate fields. Alternative 
> is to index it as timestamp and do function query to do some math and filter 
> out records.
> 
> Emir
> --
> Monitoring - Log Management - Alerting - Anomaly Detection
> Solr & Elasticsearch Consulting Support Training - http://sematext.com/
> 
> 
> 
>> On 14 Mar 2018, at 10:31, Albert Lee <albertlee8...@gmail.com> wrote:
>> 
>> NOW/MONTH and NOW/YEAR to get the start of month/year, but how can I get 
>> current month of regardless year. Like the use case,  people who’s birthdate 
>> is this month?
>> 
>> Regard,
>> Albert
>> 
>> 
>> From: Emir Arnautović
>> Sent: Wednesday, March 14, 2018 5:26 PM
>> To: solr-user@lucene.apache.org
>> Subject: Re: solr query
>> 
>> Hi Albert,
>> It does - you can use NOW/MONTH and NOW/YEAR to get the start of month/year. 
>> Here is reference to date math: 
>> https://lucene.apache.org/solr/guide/6_6/working-with-dates.html#WorkingwithDates-DateMathSyntax
>>  
>> <https://lucene.apache.org/solr/guide/6_6/working-with-dates.html#WorkingwithDates-DateMathSyntax>
>> 
>> HTH,
>> Emir
>> --
>> Monitoring - Log Management - Alerting - Anomaly Detection
>> Solr & Elasticsearch Consulting Support Training - http://sematext.com/
>> 
>> 
>> 
>>> On 14 Mar 2018, at 04:21, Albert Lee <albertlee8...@gmail.com> wrote:
>>> 
>>> Dear Solr,
>>> I want to whether solr support query by this year or this month?
>>> If can, how to do that. 
>>> Thanks.
>>> 
>>> Regards,
>>> Albert 
>>> 
>> 
>> 
> 
> 



  1   2   3   4   5   6   7   8   >