Re: eDismax query syntax question

2020-06-16 Thread Shawn Heisey

On 6/15/2020 8:01 AM, Webster Homer wrote:

Only the minus following the parenthesis is treated as a NOT.
Are parentheses special? They're not mentioned in the eDismax documentation.


Yes, parentheses are special to edismax.  They are used just like in 
math equations, to group and separate things or to override the default 
operator order.


https://lucene.apache.org/solr/guide/8_5/the-standard-query-parser.html#escaping-special-characters

The edismax parser supports a superset of what the standard (lucene) 
parser does, so they have the same special characters.


Thanks,
Shawn


Re: eDismax query syntax question

2020-06-15 Thread Mikhail Khludnev
Hello.
Not sure if it's useful or relevant, I encountered another problem with
parentheses (braces) in eDisMax recently
https://issues.apache.org/jira/browse/SOLR-14557.

On Mon, Jun 15, 2020 at 5:01 PM Webster Homer <
webster.ho...@milliporesigma.com> wrote:

> Markus,
> Thanks, for the reference, but that doesn't answer my question. If - is a
> special character, it's not consistently special. In my example
> "3-DIMETHYL" behaves quite differently than ")-PYRIMIDINE".  If I escape
> the closing parenthesis the following minus no longer behaves specially.
> The referred article does not even mention parenthesis, but it changes the
> behavior of the following "-" if it is escaped. In "3-DIMETHYL" the minus
> is not special.
>
> These all fix the problem:
> 1,3-DIMETHYL-5-(3-PHENYL-ALLYLIDENE\)-PYRIMIDINE-2,4,6-TRIONE
> 1,3-DIMETHYL-5-(3-PHENYL-ALLYLIDENE)\-PYRIMIDINE-2,4,6-TRIONE
> 1,3-DIMETHYL-5-\(3-PHENYL-ALLYLIDENE\)-PYRIMIDINE-2,4,6-TRIONE
>
> Only the minus following the parenthesis is treated as a NOT.
> Are parentheses special? They're not mentioned in the eDismax
> documentation.
>
> -Original Message-
> From: Markus Jelsma 
> Sent: Saturday, June 13, 2020 4:57 AM
> To: solr-user@lucene.apache.org
> Subject: RE: eDismax query syntax question
>
> Hello,
>
> These are special characters, if you don't need them, you must escape them.
>
> See top of the article:
>
> https://lucene.apache.org/solr/guide/8_5/the-extended-dismax-query-parser.html
>
> Markus
>
>
>
>
> -Original message-
> > From:Webster Homer 
> > Sent: Friday 12th June 2020 22:09
> > To: solr-user@lucene.apache.org
> > Subject: eDismax query syntax question
> >
> > Recently we found strange behavior in a query. We use eDismax as the
> query parser.
> >
> > This is the query term:
> > 1,3-DIMETHYL-5-(3-PHENYL-ALLYLIDENE)-PYRIMIDINE-2,4,6-TRIONE
> >
> > It should hit one document in our index. It does not. However, if you
> use the Dismax query parser it does match the record.
> >
> > The problem seems to involve the parenthesis and the dashes. If you
> > escape the dash after the parenthesis it matches
> > 1,3-DIMETHYL-5-(3-PHENYL-ALLYLIDENE)\-PYRIMIDINE-2,4,6-TRIONE
> >
> > I thought that eDismax and Dismax escaped all lucene special characters
> before passing the query to lucene. Although I also remember reading that +
> and - can have special significance in a query if preceded with white
> space. I can find very little documentation on either query parser in how
> they work.
> >
> > Is this expected behavior or is this a bug? If expected, where can I
> find documentation?
> >
> >
> >
> > This message and any attachment are confidential and may be privileged
> or otherwise protected from disclosure. If you are not the intended
> recipient, you must not copy this message or attachment or disclose the
> contents to any other person. If you have received this transmission in
> error, please notify the sender immediately and delete the message and any
> attachment from your system. Merck KGaA, Darmstadt, Germany and any of its
> subsidiaries do not accept liability for any omissions or errors in this
> message which may arise as a result of E-Mail-transmission or for damages
> resulting from any unauthorized changes of the content of this message and
> any attachment thereto. Merck KGaA, Darmstadt, Germany and any of its
> subsidiaries do not guarantee that this message is free of viruses and does
> not accept liability for any damages caused by any virus transmitted
> therewith.
> >
> >
> >
> > Click http://www.merckgroup.com/disclaimer to access the German,
> French, Spanish and Portuguese versions of this disclaimer.
> >
>
>
> This message and any attachment are confidential and may be privileged or
> otherwise protected from disclosure. If you are not the intended recipient,
> you must not copy this message or attachment or disclose the contents to
> any other person. If you have received this transmission in error, please
> notify the sender immediately and delete the message and any attachment
> from your system. Merck KGaA, Darmstadt, Germany and any of its
> subsidiaries do not accept liability for any omissions or errors in this
> message which may arise as a result of E-Mail-transmission or for damages
> resulting from any unauthorized changes of the content of this message and
> any attachment thereto. Merck KGaA, Darmstadt, Germany and any of its
> subsidiaries do not guarantee that this message is free of viruses and does
> not accept liability for any damages caused by any virus transmitted
> therewith.
>
>
>
> Click http://www.merckgroup.com/disclaimer to access the German, French,
> Spanish and Portuguese versions of this disclaimer.
>


-- 
Sincerely yours
Mikhail Khludnev


Re: eDismax query syntax question

2020-06-15 Thread Andrea Gazzarini
Hi Webster,
what does the query debug say? if you set debug=true in the request you can
have a better idea about how the two queries get interpreted

Andrea

On Mon, 15 Jun 2020 at 16:01, Webster Homer <
webster.ho...@milliporesigma.com> wrote:

> Markus,
> Thanks, for the reference, but that doesn't answer my question. If - is a
> special character, it's not consistently special. In my example
> "3-DIMETHYL" behaves quite differently than ")-PYRIMIDINE".  If I escape
> the closing parenthesis the following minus no longer behaves specially.
> The referred article does not even mention parenthesis, but it changes the
> behavior of the following "-" if it is escaped. In "3-DIMETHYL" the minus
> is not special.
>
> These all fix the problem:
> 1,3-DIMETHYL-5-(3-PHENYL-ALLYLIDENE\)-PYRIMIDINE-2,4,6-TRIONE
> 1,3-DIMETHYL-5-(3-PHENYL-ALLYLIDENE)\-PYRIMIDINE-2,4,6-TRIONE
> 1,3-DIMETHYL-5-\(3-PHENYL-ALLYLIDENE\)-PYRIMIDINE-2,4,6-TRIONE
>
> Only the minus following the parenthesis is treated as a NOT.
> Are parentheses special? They're not mentioned in the eDismax
> documentation.
>
> -Original Message-
> From: Markus Jelsma 
> Sent: Saturday, June 13, 2020 4:57 AM
> To: solr-user@lucene.apache.org
> Subject: RE: eDismax query syntax question
>
> Hello,
>
> These are special characters, if you don't need them, you must escape them.
>
> See top of the article:
>
> https://lucene.apache.org/solr/guide/8_5/the-extended-dismax-query-parser.html
>
> Markus
>
>
>
>
> -Original message-
> > From:Webster Homer 
> > Sent: Friday 12th June 2020 22:09
> > To: solr-user@lucene.apache.org
> > Subject: eDismax query syntax question
> >
> > Recently we found strange behavior in a query. We use eDismax as the
> query parser.
> >
> > This is the query term:
> > 1,3-DIMETHYL-5-(3-PHENYL-ALLYLIDENE)-PYRIMIDINE-2,4,6-TRIONE
> >
> > It should hit one document in our index. It does not. However, if you
> use the Dismax query parser it does match the record.
> >
> > The problem seems to involve the parenthesis and the dashes. If you
> > escape the dash after the parenthesis it matches
> > 1,3-DIMETHYL-5-(3-PHENYL-ALLYLIDENE)\-PYRIMIDINE-2,4,6-TRIONE
> >
> > I thought that eDismax and Dismax escaped all lucene special characters
> before passing the query to lucene. Although I also remember reading that +
> and - can have special significance in a query if preceded with white
> space. I can find very little documentation on either query parser in how
> they work.
> >
> > Is this expected behavior or is this a bug? If expected, where can I
> find documentation?
> >
> >
> >
> > This message and any attachment are confidential and may be privileged
> or otherwise protected from disclosure. If you are not the intended
> recipient, you must not copy this message or attachment or disclose the
> contents to any other person. If you have received this transmission in
> error, please notify the sender immediately and delete the message and any
> attachment from your system. Merck KGaA, Darmstadt, Germany and any of its
> subsidiaries do not accept liability for any omissions or errors in this
> message which may arise as a result of E-Mail-transmission or for damages
> resulting from any unauthorized changes of the content of this message and
> any attachment thereto. Merck KGaA, Darmstadt, Germany and any of its
> subsidiaries do not guarantee that this message is free of viruses and does
> not accept liability for any damages caused by any virus transmitted
> therewith.
> >
> >
> >
> > Click http://www.merckgroup.com/disclaimer to access the German,
> French, Spanish and Portuguese versions of this disclaimer.
> >
>
>
> This message and any attachment are confidential and may be privileged or
> otherwise protected from disclosure. If you are not the intended recipient,
> you must not copy this message or attachment or disclose the contents to
> any other person. If you have received this transmission in error, please
> notify the sender immediately and delete the message and any attachment
> from your system. Merck KGaA, Darmstadt, Germany and any of its
> subsidiaries do not accept liability for any omissions or errors in this
> message which may arise as a result of E-Mail-transmission or for damages
> resulting from any unauthorized changes of the content of this message and
> any attachment thereto. Merck KGaA, Darmstadt, Germany and any of its
> subsidiaries do not guarantee that this message is free of viruses and does
> not accept liability for any damages caused by any virus transmitted
> therewith.
>
>
>
> Click http://www.merckgroup.com/disclaimer to access the German, French,
> Spanish and Portuguese versions of this disclaimer.
>
-- 
Andrea Gazzarini
*Search Consultant, R Software Engineer*


www.sease.io

email: a.gazzar...@sease.io
cell: +39 349 513 86 25


RE: eDismax query syntax question

2020-06-15 Thread Webster Homer
Markus,
Thanks, for the reference, but that doesn't answer my question. If - is a 
special character, it's not consistently special. In my example "3-DIMETHYL" 
behaves quite differently than ")-PYRIMIDINE".  If I escape the closing 
parenthesis the following minus no longer behaves specially. The referred 
article does not even mention parenthesis, but it changes the behavior of the 
following "-" if it is escaped. In "3-DIMETHYL" the minus is not special.

These all fix the problem:
1,3-DIMETHYL-5-(3-PHENYL-ALLYLIDENE\)-PYRIMIDINE-2,4,6-TRIONE
1,3-DIMETHYL-5-(3-PHENYL-ALLYLIDENE)\-PYRIMIDINE-2,4,6-TRIONE
1,3-DIMETHYL-5-\(3-PHENYL-ALLYLIDENE\)-PYRIMIDINE-2,4,6-TRIONE

Only the minus following the parenthesis is treated as a NOT.
Are parentheses special? They're not mentioned in the eDismax documentation.

-Original Message-
From: Markus Jelsma 
Sent: Saturday, June 13, 2020 4:57 AM
To: solr-user@lucene.apache.org
Subject: RE: eDismax query syntax question

Hello,

These are special characters, if you don't need them, you must escape them.

See top of the article:
https://lucene.apache.org/solr/guide/8_5/the-extended-dismax-query-parser.html

Markus




-Original message-
> From:Webster Homer 
> Sent: Friday 12th June 2020 22:09
> To: solr-user@lucene.apache.org
> Subject: eDismax query syntax question
>
> Recently we found strange behavior in a query. We use eDismax as the query 
> parser.
>
> This is the query term:
> 1,3-DIMETHYL-5-(3-PHENYL-ALLYLIDENE)-PYRIMIDINE-2,4,6-TRIONE
>
> It should hit one document in our index. It does not. However, if you use the 
> Dismax query parser it does match the record.
>
> The problem seems to involve the parenthesis and the dashes. If you
> escape the dash after the parenthesis it matches
> 1,3-DIMETHYL-5-(3-PHENYL-ALLYLIDENE)\-PYRIMIDINE-2,4,6-TRIONE
>
> I thought that eDismax and Dismax escaped all lucene special characters 
> before passing the query to lucene. Although I also remember reading that + 
> and - can have special significance in a query if preceded with white space. 
> I can find very little documentation on either query parser in how they work.
>
> Is this expected behavior or is this a bug? If expected, where can I find 
> documentation?
>
>
>
> This message and any attachment are confidential and may be privileged or 
> otherwise protected from disclosure. If you are not the intended recipient, 
> you must not copy this message or attachment or disclose the contents to any 
> other person. If you have received this transmission in error, please notify 
> the sender immediately and delete the message and any attachment from your 
> system. Merck KGaA, Darmstadt, Germany and any of its subsidiaries do not 
> accept liability for any omissions or errors in this message which may arise 
> as a result of E-Mail-transmission or for damages resulting from any 
> unauthorized changes of the content of this message and any attachment 
> thereto. Merck KGaA, Darmstadt, Germany and any of its subsidiaries do not 
> guarantee that this message is free of viruses and does not accept liability 
> for any damages caused by any virus transmitted therewith.
>
>
>
> Click http://www.merckgroup.com/disclaimer to access the German, French, 
> Spanish and Portuguese versions of this disclaimer.
>


This message and any attachment are confidential and may be privileged or 
otherwise protected from disclosure. If you are not the intended recipient, you 
must not copy this message or attachment or disclose the contents to any other 
person. If you have received this transmission in error, please notify the 
sender immediately and delete the message and any attachment from your system. 
Merck KGaA, Darmstadt, Germany and any of its subsidiaries do not accept 
liability for any omissions or errors in this message which may arise as a 
result of E-Mail-transmission or for damages resulting from any unauthorized 
changes of the content of this message and any attachment thereto. Merck KGaA, 
Darmstadt, Germany and any of its subsidiaries do not guarantee that this 
message is free of viruses and does not accept liability for any damages caused 
by any virus transmitted therewith.



Click http://www.merckgroup.com/disclaimer to access the German, French, 
Spanish and Portuguese versions of this disclaimer.


RE: eDismax query syntax question

2020-06-13 Thread Markus Jelsma
Hello,

These are special characters, if you don't need them, you must escape them.

See top of the article:
https://lucene.apache.org/solr/guide/8_5/the-extended-dismax-query-parser.html

Markus


 
 
-Original message-
> From:Webster Homer 
> Sent: Friday 12th June 2020 22:09
> To: solr-user@lucene.apache.org
> Subject: eDismax query syntax question
> 
> Recently we found strange behavior in a query. We use eDismax as the query 
> parser.
> 
> This is the query term:
> 1,3-DIMETHYL-5-(3-PHENYL-ALLYLIDENE)-PYRIMIDINE-2,4,6-TRIONE
> 
> It should hit one document in our index. It does not. However, if you use the 
> Dismax query parser it does match the record.
> 
> The problem seems to involve the parenthesis and the dashes. If you escape 
> the dash after the parenthesis it matches
> 1,3-DIMETHYL-5-(3-PHENYL-ALLYLIDENE)\-PYRIMIDINE-2,4,6-TRIONE
> 
> I thought that eDismax and Dismax escaped all lucene special characters 
> before passing the query to lucene. Although I also remember reading that + 
> and - can have special significance in a query if preceded with white space. 
> I can find very little documentation on either query parser in how they work.
> 
> Is this expected behavior or is this a bug? If expected, where can I find 
> documentation?
> 
> 
> 
> This message and any attachment are confidential and may be privileged or 
> otherwise protected from disclosure. If you are not the intended recipient, 
> you must not copy this message or attachment or disclose the contents to any 
> other person. If you have received this transmission in error, please notify 
> the sender immediately and delete the message and any attachment from your 
> system. Merck KGaA, Darmstadt, Germany and any of its subsidiaries do not 
> accept liability for any omissions or errors in this message which may arise 
> as a result of E-Mail-transmission or for damages resulting from any 
> unauthorized changes of the content of this message and any attachment 
> thereto. Merck KGaA, Darmstadt, Germany and any of its subsidiaries do not 
> guarantee that this message is free of viruses and does not accept liability 
> for any damages caused by any virus transmitted therewith.
> 
> 
> 
> Click http://www.merckgroup.com/disclaimer to access the German, French, 
> Spanish and Portuguese versions of this disclaimer.
> 


Re: Range query syntax on a polygon field is returning all documents

2019-05-12 Thread David Smiley
I answered in StackOverflow but will paste it here:

Geo3D requires that polygons adhere to the "right hand rule", and thus the
exterior ring must be in counter-clockwise order and holes must be
clockwise.  If you make this mistake then the meaning of the shape is
inverted, and thus that little rectangle in Alberta Canada represents the
inverse of that place.  Consequently most shapes will cover nearly the
entire globe!  There is certainly a documentation issue needed in Solr to
this effect.  Even I didn't know until I debugged this today!  It appears
some of the GIS industry is migrating to this rule as well:
http://mapster.me/right-hand-rule-geojson-fixer/

Separately: I would be very curious to see how Geo3D compares to JTS after
you get it working.  Additionally, you likely ought to use
solr.RptWithGeometrySpatialField instead of
solr.SpatialRecursivePrefixTreeFieldType to get the full accuracy of the
vector geometry instead of settling on a grid representation of shapes,
otherwise your queries might get false-positives for just being close to an
indexed shape.  Another thing to try is using prefixTree="s2" which is a
not-yet-documented prefixTree that supposedly is much more efficient for
Geo3D specifically.

~ David Smiley
Apache Lucene/Solr Search Developer
http://www.linkedin.com/in/davidwsmiley


On Wed, Mar 20, 2019 at 2:00 PM David Smiley 
wrote:

> Hi Mitchell,
>
> Seems like there's a bug based on what you've shown.
> * Can you please try RptWithGeometrySpatialField instead
> of SpatialRecursivePrefixTreeFieldType to see if the problem goes away?
> This could point to a precision issue; though still what you've seen is
> suspicious.
> * Can you try one other query syntax e.g. bbox query parser to see if the
> problem goes away?  I doubt this is it but you seem to point to the syntax
> being related.
>
> ~ David Smiley
> Apache Lucene/Solr Search Developer
> http://www.linkedin.com/in/davidwsmiley
>
>
> On Mon, Mar 18, 2019 at 12:24 AM Mitchell Bösecke <
> mitchell.bose...@forcorp.com> wrote:
>
>> Hi everyone,
>>
>> I'm trying to index geodetic polygons and then query them out using an
>> arbitrary rectangle. When using the Geo3D spatial context factory, the
>> data
>> indexes just fine but using a range query (as per the solr documentation)
>> does not seem to filter the results appropriately (I get all documents
>> back).
>>
>> When I switch it to JTS, everything works as expected. However, it
>> significantly slowed down the initial indexing time. A sample size of 3000
>> documents took 3 seconds with Geo3D and 50 seconds with JTS.
>>
>> I've documented my journey in detail on stack overflow:
>> https://stackoverflow.com/q/55212622/1017571
>>
>>1. Can I not use the range query syntax with Geo3D? I.e. am I
>>misreading the documentation?
>>2. Is it expected that using JTS will *significantly* slow down the
>>indexing time?
>>
>> Thanks for any insight.
>>
>> --
>> Mitchell Bosecke, B.Sc.
>> Senior Application Developer
>>
>> FORCORP
>> Suite 200, 15015 - 123 Ave NW,
>> Edmonton, AB, T5V 1J7
>> www.forcorp.com
>> (d) 780.733.0494
>> (o) 780.452.5878 ext. 263
>> (f) 780.453.3986
>>
>


Re: Range query syntax on a polygon field is returning all documents

2019-03-20 Thread David Smiley
Hi Mitchell,

Seems like there's a bug based on what you've shown.
* Can you please try RptWithGeometrySpatialField instead
of SpatialRecursivePrefixTreeFieldType to see if the problem goes away?
This could point to a precision issue; though still what you've seen is
suspicious.
* Can you try one other query syntax e.g. bbox query parser to see if the
problem goes away?  I doubt this is it but you seem to point to the syntax
being related.

~ David Smiley
Apache Lucene/Solr Search Developer
http://www.linkedin.com/in/davidwsmiley


On Mon, Mar 18, 2019 at 12:24 AM Mitchell Bösecke <
mitchell.bose...@forcorp.com> wrote:

> Hi everyone,
>
> I'm trying to index geodetic polygons and then query them out using an
> arbitrary rectangle. When using the Geo3D spatial context factory, the data
> indexes just fine but using a range query (as per the solr documentation)
> does not seem to filter the results appropriately (I get all documents
> back).
>
> When I switch it to JTS, everything works as expected. However, it
> significantly slowed down the initial indexing time. A sample size of 3000
> documents took 3 seconds with Geo3D and 50 seconds with JTS.
>
> I've documented my journey in detail on stack overflow:
> https://stackoverflow.com/q/55212622/1017571
>
>1. Can I not use the range query syntax with Geo3D? I.e. am I
>misreading the documentation?
>2. Is it expected that using JTS will *significantly* slow down the
>indexing time?
>
> Thanks for any insight.
>
> --
> Mitchell Bosecke, B.Sc.
> Senior Application Developer
>
> FORCORP
> Suite 200, 15015 - 123 Ave NW,
> Edmonton, AB, T5V 1J7
> www.forcorp.com
> (d) 780.733.0494
> (o) 780.452.5878 ext. 263
> (f) 780.453.3986
>


Re: Need a Query syntax for fetching results

2018-03-06 Thread Rick Leir
Hi Raj
Maybe this would be what you need.
"Keyword Tokenizer
This tokenizer treats the entire text field as a single token."
There used to be an example showing the use of this in schema.xml, but I am 
away from my computer so it is hard to check.
And everything Emir says is spot-on.
Then you might want to go further with ngrams or a spelling check so the user 
need not be perfect.
Cheers -- Rick


On March 6, 2018 5:40:02 AM EST, "Emir Arnautović" 
 wrote:
>Hi Raj,
>You need to get familiar with Solr analysis chain:
>https://lucene.apache.org/solr/guide/6_6/understanding-analyzers-tokenizers-and-filters.html
>
>
>When playing with it, use admin console analysis tab to see what tokens
>are produced.
>
>And you need to understand your search requirements and cover them with
>one or more fields. Note that you can use copyField to index the same
>content in different ways to handle different search requirements.
>
>It is probably not what you want, but based on what you described, you
>do not care about anything but the first token in your field, so you
>can use LimitTokenCountFilter to index only the first token. In query
>analysis you do not use it and with default operator OR you will get
>what you want.
>
>HTH,
>Emir
>--
>Monitoring - Log Management - Alerting - Anomaly Detection
>Solr & Elasticsearch Consulting Support Training - http://sematext.com/
>
>
>
>> On 6 Mar 2018, at 10:55, Rajvinder Pal 
>wrote:
>> 
>> Hi ,
>> I am new to Lucene. I have a requirement where when i request the
>> organization name, it should show the matching organization names.
>> 
>> I have written the q param as
>> 
>> orgname_text: ABC test
>> 
>> it is returning the result :-
>> 
>> ABC test limited
>> ABC XYZ limited
>> DEF ABC limted
>> test limited
>> 
>> I want all the matching result which starts  with either ABC or test.
>so
>> here i dont want DEF ABC limited. Please let me know what feature or
>> syntax  i should use to get the required result.
>> 
>> Thanks
>> Raj

-- 
Sorry for being brief. Alternate email is rickleir at yahoo dot com 

Re: Need a Query syntax for fetching results

2018-03-06 Thread Emir Arnautović
Hi Raj,
You need to get familiar with Solr analysis chain: 
https://lucene.apache.org/solr/guide/6_6/understanding-analyzers-tokenizers-and-filters.html
 


When playing with it, use admin console analysis tab to see what tokens are 
produced.

And you need to understand your search requirements and cover them with one or 
more fields. Note that you can use copyField to index the same content in 
different ways to handle different search requirements.

It is probably not what you want, but based on what you described, you do not 
care about anything but the first token in your field, so you can use 
LimitTokenCountFilter to index only the first token. In query analysis you do 
not use it and with default operator OR you will get what you want.

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



> On 6 Mar 2018, at 10:55, Rajvinder Pal  wrote:
> 
> Hi ,
> I am new to Lucene. I have a requirement where when i request the
> organization name, it should show the matching organization names.
> 
> I have written the q param as
> 
> orgname_text: ABC test
> 
> it is returning the result :-
> 
> ABC test limited
> ABC XYZ limited
> DEF ABC limted
> test limited
> 
> I want all the matching result which starts  with either ABC or test. so
> here i dont want DEF ABC limited. Please let me know what feature or
> syntax  i should use to get the required result.
> 
> Thanks
> Raj



Need a Query syntax for fetching results

2018-03-06 Thread Rajvinder Pal
Hi ,
I am new to Lucene. I have a requirement where when i request the
organization name, it should show the matching organization names.

I have written the q param as

orgname_text: ABC test

it is returning the result :-

ABC test limited
ABC XYZ limited
DEF ABC limted
test limited

I want all the matching result which starts  with either ABC or test. so
here i dont want DEF ABC limited. Please let me know what feature or
syntax  i should use to get the required result.

Thanks
Raj


Re: Solr regex phrase query syntax

2017-11-20 Thread Mikhail Khludnev
Hello, Chuming.
It doesn't. The closest thing is to create TermAutomatonQuery.

On Mon, Nov 20, 2017 at 11:03 PM, Chuming Chen 
wrote:

> Hi All,
>
> According to http://lucene.apache.org/core/7_1_0/core/org/apache/lucene/
> util/automaton/RegExp.html. Lucene supports repeat expressions.
>
> repeatexp   ::= repeatexp ? (zero or one occurrence)
> |   repeatexp * (zero or more occurrences)
> |   repeatexp + (one or more occurrences)
> |   repeatexp {n}   (n occurrences)
> |   repeatexp {n,}  (n or more occurrences)
> |   repeatexp {n,m} (n to m occurrences, including both)
>
>
> Does Solr support multiple occurrence of terms in a phrase query? For
> example: name:”abc{0, 3} def”, which means term “abc” repeats 0 to 3 times
> in the phrase.
>
> Thanks,
>
> Chuming
>
>


-- 
Sincerely yours
Mikhail Khludnev


Solr regex phrase query syntax

2017-11-20 Thread Chuming Chen
Hi All,

According to 
http://lucene.apache.org/core/7_1_0/core/org/apache/lucene/util/automaton/RegExp.html.
 Lucene supports repeat expressions.

repeatexp   ::= repeatexp ? (zero or one occurrence)
|   repeatexp * (zero or more occurrences)  
|   repeatexp + (one or more occurrences)   
|   repeatexp {n}   (n occurrences) 
|   repeatexp {n,}  (n or more occurrences) 
|   repeatexp {n,m} (n to m occurrences, including both)


Does Solr support multiple occurrence of terms in a phrase query? For example: 
name:”abc{0, 3} def”, which means term “abc” repeats 0 to 3 times in the phrase.

Thanks,

Chuming



Re: Need help with query syntax

2017-08-11 Thread Erick Erickson
Yep..

On Fri, Aug 11, 2017 at 6:31 AM, OTH  wrote:
> Hi, thanks for sharing the article.
>
> On Fri, Aug 11, 2017 at 4:38 AM, Erick Erickson 
> wrote:
>
>> Omer:
>>
>> Solr does not implement pure boolean logic, see:
>> https://lucidworks.com/2011/12/28/why-not-and-or-and-not/.
>>
>> With appropriate parentheses it can give the same results as you're
>> discovering.
>>
>> Best
>> Erick
>>
>> On Thu, Aug 10, 2017 at 3:00 PM, OTH  wrote:
>> > Thanks for the help!
>> > That's resolved the issue.
>> >
>> > On Fri, Aug 11, 2017 at 1:48 AM, David Hastings <
>> > hastings.recurs...@gmail.com> wrote:
>> >
>> >> type:value AND (name:america^1+name:state^1+name:united^1)
>> >>
>> >> but in reality what you want to do is use the fq parameter with
>> type:value
>> >>
>> >> On Thu, Aug 10, 2017 at 4:36 PM, OTH  wrote:
>> >>
>> >> > Hello,
>> >> >
>> >> > I have the following use case:
>> >> >
>> >> > I have two fields (among others); one is 'name' and the other is
>> 'type'.
>> >> >  'Name' is the field I need to search, whereas, with 'type', I need to
>> >> make
>> >> > sure that it has a certain value, depending on the situation.  Often,
>> >> when
>> >> > I search the 'name' field, the search query would have multiple
>> tokens.
>> >> > Furthermore, each query token needs to have a scoring weight attached
>> to
>> >> > it.
>> >> >
>> >> > However, I'm unable to figure out the syntax which would allow all
>> these
>> >> > things to happen.
>> >> >
>> >> > For example, if I use the following query:
>> >> > select?q=type:value+AND+name:america^1+name:state^1+name:united^1
>> >> > It would only return documents where 'name' includes the token
>> 'america'
>> >> > (and where type==value).  It will totally ignore
>> >> > "+name:state^1+name:united^1", it seems.
>> >> >
>> >> > This does not happen if I omit "type:value+AND+".  So, with the
>> following
>> >> > query:
>> >> > select?q=name:america^1+name:state^1+name:united^1
>> >> > It returns all documents which contain any of the three tokens
>> {america,
>> >> > state, united}; which is what I need.  However, it also returns
>> documents
>> >> > where type != value; which I can't have.
>> >> >
>> >> > If I put "type:value" at the end of the query command, like so:
>> >> > select?q=name:america^1+name:state^1+name:united^1+AND+type:value
>> >> > In this case, it will only return documents which contain the "united"
>> >> > token in the name field (and where type==value).  Again, it will
>> totally
>> >> > ignore "name:america^1+name:state^1", it seems.
>> >> >
>> >> > I tried putting an "AND" between everything, like so:
>> >> > select?q=type:value+AND+name:america^1+AND+name:state^1+
>> >> AND+name:united^1
>> >> > But this, of course, would only return documents which contain all the
>> >> > tokens {america, state, united}; whereas I need all documents which
>> >> contain
>> >> > any of those tokens.
>> >> >
>> >> >
>> >> > If anyone could help me out with how this could be done / what the
>> >> correct
>> >> > syntax would be, that would be a huge help.
>> >> >
>> >> > Much thanks
>> >> > Omer
>> >> >
>> >>
>>


Re: Need help with query syntax

2017-08-11 Thread OTH
Hi, thanks for sharing the article.

On Fri, Aug 11, 2017 at 4:38 AM, Erick Erickson 
wrote:

> Omer:
>
> Solr does not implement pure boolean logic, see:
> https://lucidworks.com/2011/12/28/why-not-and-or-and-not/.
>
> With appropriate parentheses it can give the same results as you're
> discovering.
>
> Best
> Erick
>
> On Thu, Aug 10, 2017 at 3:00 PM, OTH  wrote:
> > Thanks for the help!
> > That's resolved the issue.
> >
> > On Fri, Aug 11, 2017 at 1:48 AM, David Hastings <
> > hastings.recurs...@gmail.com> wrote:
> >
> >> type:value AND (name:america^1+name:state^1+name:united^1)
> >>
> >> but in reality what you want to do is use the fq parameter with
> type:value
> >>
> >> On Thu, Aug 10, 2017 at 4:36 PM, OTH  wrote:
> >>
> >> > Hello,
> >> >
> >> > I have the following use case:
> >> >
> >> > I have two fields (among others); one is 'name' and the other is
> 'type'.
> >> >  'Name' is the field I need to search, whereas, with 'type', I need to
> >> make
> >> > sure that it has a certain value, depending on the situation.  Often,
> >> when
> >> > I search the 'name' field, the search query would have multiple
> tokens.
> >> > Furthermore, each query token needs to have a scoring weight attached
> to
> >> > it.
> >> >
> >> > However, I'm unable to figure out the syntax which would allow all
> these
> >> > things to happen.
> >> >
> >> > For example, if I use the following query:
> >> > select?q=type:value+AND+name:america^1+name:state^1+name:united^1
> >> > It would only return documents where 'name' includes the token
> 'america'
> >> > (and where type==value).  It will totally ignore
> >> > "+name:state^1+name:united^1", it seems.
> >> >
> >> > This does not happen if I omit "type:value+AND+".  So, with the
> following
> >> > query:
> >> > select?q=name:america^1+name:state^1+name:united^1
> >> > It returns all documents which contain any of the three tokens
> {america,
> >> > state, united}; which is what I need.  However, it also returns
> documents
> >> > where type != value; which I can't have.
> >> >
> >> > If I put "type:value" at the end of the query command, like so:
> >> > select?q=name:america^1+name:state^1+name:united^1+AND+type:value
> >> > In this case, it will only return documents which contain the "united"
> >> > token in the name field (and where type==value).  Again, it will
> totally
> >> > ignore "name:america^1+name:state^1", it seems.
> >> >
> >> > I tried putting an "AND" between everything, like so:
> >> > select?q=type:value+AND+name:america^1+AND+name:state^1+
> >> AND+name:united^1
> >> > But this, of course, would only return documents which contain all the
> >> > tokens {america, state, united}; whereas I need all documents which
> >> contain
> >> > any of those tokens.
> >> >
> >> >
> >> > If anyone could help me out with how this could be done / what the
> >> correct
> >> > syntax would be, that would be a huge help.
> >> >
> >> > Much thanks
> >> > Omer
> >> >
> >>
>


Re: Need help with query syntax

2017-08-10 Thread Dave
Eric you going to vegas next month? 

> On Aug 10, 2017, at 7:38 PM, Erick Erickson  wrote:
> 
> Omer:
> 
> Solr does not implement pure boolean logic, see:
> https://lucidworks.com/2011/12/28/why-not-and-or-and-not/.
> 
> With appropriate parentheses it can give the same results as you're
> discovering.
> 
> Best
> Erick
> 
>> On Thu, Aug 10, 2017 at 3:00 PM, OTH  wrote:
>> Thanks for the help!
>> That's resolved the issue.
>> 
>> On Fri, Aug 11, 2017 at 1:48 AM, David Hastings <
>> hastings.recurs...@gmail.com> wrote:
>> 
>>> type:value AND (name:america^1+name:state^1+name:united^1)
>>> 
>>> but in reality what you want to do is use the fq parameter with type:value
>>> 
 On Thu, Aug 10, 2017 at 4:36 PM, OTH  wrote:
 
 Hello,
 
 I have the following use case:
 
 I have two fields (among others); one is 'name' and the other is 'type'.
 'Name' is the field I need to search, whereas, with 'type', I need to
>>> make
 sure that it has a certain value, depending on the situation.  Often,
>>> when
 I search the 'name' field, the search query would have multiple tokens.
 Furthermore, each query token needs to have a scoring weight attached to
 it.
 
 However, I'm unable to figure out the syntax which would allow all these
 things to happen.
 
 For example, if I use the following query:
 select?q=type:value+AND+name:america^1+name:state^1+name:united^1
 It would only return documents where 'name' includes the token 'america'
 (and where type==value).  It will totally ignore
 "+name:state^1+name:united^1", it seems.
 
 This does not happen if I omit "type:value+AND+".  So, with the following
 query:
 select?q=name:america^1+name:state^1+name:united^1
 It returns all documents which contain any of the three tokens {america,
 state, united}; which is what I need.  However, it also returns documents
 where type != value; which I can't have.
 
 If I put "type:value" at the end of the query command, like so:
 select?q=name:america^1+name:state^1+name:united^1+AND+type:value
 In this case, it will only return documents which contain the "united"
 token in the name field (and where type==value).  Again, it will totally
 ignore "name:america^1+name:state^1", it seems.
 
 I tried putting an "AND" between everything, like so:
 select?q=type:value+AND+name:america^1+AND+name:state^1+
>>> AND+name:united^1
 But this, of course, would only return documents which contain all the
 tokens {america, state, united}; whereas I need all documents which
>>> contain
 any of those tokens.
 
 
 If anyone could help me out with how this could be done / what the
>>> correct
 syntax would be, that would be a huge help.
 
 Much thanks
 Omer
 
>>> 


Re: Need help with query syntax

2017-08-10 Thread Erick Erickson
Omer:

Solr does not implement pure boolean logic, see:
https://lucidworks.com/2011/12/28/why-not-and-or-and-not/.

With appropriate parentheses it can give the same results as you're
discovering.

Best
Erick

On Thu, Aug 10, 2017 at 3:00 PM, OTH  wrote:
> Thanks for the help!
> That's resolved the issue.
>
> On Fri, Aug 11, 2017 at 1:48 AM, David Hastings <
> hastings.recurs...@gmail.com> wrote:
>
>> type:value AND (name:america^1+name:state^1+name:united^1)
>>
>> but in reality what you want to do is use the fq parameter with type:value
>>
>> On Thu, Aug 10, 2017 at 4:36 PM, OTH  wrote:
>>
>> > Hello,
>> >
>> > I have the following use case:
>> >
>> > I have two fields (among others); one is 'name' and the other is 'type'.
>> >  'Name' is the field I need to search, whereas, with 'type', I need to
>> make
>> > sure that it has a certain value, depending on the situation.  Often,
>> when
>> > I search the 'name' field, the search query would have multiple tokens.
>> > Furthermore, each query token needs to have a scoring weight attached to
>> > it.
>> >
>> > However, I'm unable to figure out the syntax which would allow all these
>> > things to happen.
>> >
>> > For example, if I use the following query:
>> > select?q=type:value+AND+name:america^1+name:state^1+name:united^1
>> > It would only return documents where 'name' includes the token 'america'
>> > (and where type==value).  It will totally ignore
>> > "+name:state^1+name:united^1", it seems.
>> >
>> > This does not happen if I omit "type:value+AND+".  So, with the following
>> > query:
>> > select?q=name:america^1+name:state^1+name:united^1
>> > It returns all documents which contain any of the three tokens {america,
>> > state, united}; which is what I need.  However, it also returns documents
>> > where type != value; which I can't have.
>> >
>> > If I put "type:value" at the end of the query command, like so:
>> > select?q=name:america^1+name:state^1+name:united^1+AND+type:value
>> > In this case, it will only return documents which contain the "united"
>> > token in the name field (and where type==value).  Again, it will totally
>> > ignore "name:america^1+name:state^1", it seems.
>> >
>> > I tried putting an "AND" between everything, like so:
>> > select?q=type:value+AND+name:america^1+AND+name:state^1+
>> AND+name:united^1
>> > But this, of course, would only return documents which contain all the
>> > tokens {america, state, united}; whereas I need all documents which
>> contain
>> > any of those tokens.
>> >
>> >
>> > If anyone could help me out with how this could be done / what the
>> correct
>> > syntax would be, that would be a huge help.
>> >
>> > Much thanks
>> > Omer
>> >
>>


Re: Need help with query syntax

2017-08-10 Thread OTH
Thanks for the help!
That's resolved the issue.

On Fri, Aug 11, 2017 at 1:48 AM, David Hastings <
hastings.recurs...@gmail.com> wrote:

> type:value AND (name:america^1+name:state^1+name:united^1)
>
> but in reality what you want to do is use the fq parameter with type:value
>
> On Thu, Aug 10, 2017 at 4:36 PM, OTH  wrote:
>
> > Hello,
> >
> > I have the following use case:
> >
> > I have two fields (among others); one is 'name' and the other is 'type'.
> >  'Name' is the field I need to search, whereas, with 'type', I need to
> make
> > sure that it has a certain value, depending on the situation.  Often,
> when
> > I search the 'name' field, the search query would have multiple tokens.
> > Furthermore, each query token needs to have a scoring weight attached to
> > it.
> >
> > However, I'm unable to figure out the syntax which would allow all these
> > things to happen.
> >
> > For example, if I use the following query:
> > select?q=type:value+AND+name:america^1+name:state^1+name:united^1
> > It would only return documents where 'name' includes the token 'america'
> > (and where type==value).  It will totally ignore
> > "+name:state^1+name:united^1", it seems.
> >
> > This does not happen if I omit "type:value+AND+".  So, with the following
> > query:
> > select?q=name:america^1+name:state^1+name:united^1
> > It returns all documents which contain any of the three tokens {america,
> > state, united}; which is what I need.  However, it also returns documents
> > where type != value; which I can't have.
> >
> > If I put "type:value" at the end of the query command, like so:
> > select?q=name:america^1+name:state^1+name:united^1+AND+type:value
> > In this case, it will only return documents which contain the "united"
> > token in the name field (and where type==value).  Again, it will totally
> > ignore "name:america^1+name:state^1", it seems.
> >
> > I tried putting an "AND" between everything, like so:
> > select?q=type:value+AND+name:america^1+AND+name:state^1+
> AND+name:united^1
> > But this, of course, would only return documents which contain all the
> > tokens {america, state, united}; whereas I need all documents which
> contain
> > any of those tokens.
> >
> >
> > If anyone could help me out with how this could be done / what the
> correct
> > syntax would be, that would be a huge help.
> >
> > Much thanks
> > Omer
> >
>


Re: Need help with query syntax

2017-08-10 Thread David Hastings
type:value AND (name:america^1+name:state^1+name:united^1)

but in reality what you want to do is use the fq parameter with type:value

On Thu, Aug 10, 2017 at 4:36 PM, OTH  wrote:

> Hello,
>
> I have the following use case:
>
> I have two fields (among others); one is 'name' and the other is 'type'.
>  'Name' is the field I need to search, whereas, with 'type', I need to make
> sure that it has a certain value, depending on the situation.  Often, when
> I search the 'name' field, the search query would have multiple tokens.
> Furthermore, each query token needs to have a scoring weight attached to
> it.
>
> However, I'm unable to figure out the syntax which would allow all these
> things to happen.
>
> For example, if I use the following query:
> select?q=type:value+AND+name:america^1+name:state^1+name:united^1
> It would only return documents where 'name' includes the token 'america'
> (and where type==value).  It will totally ignore
> "+name:state^1+name:united^1", it seems.
>
> This does not happen if I omit "type:value+AND+".  So, with the following
> query:
> select?q=name:america^1+name:state^1+name:united^1
> It returns all documents which contain any of the three tokens {america,
> state, united}; which is what I need.  However, it also returns documents
> where type != value; which I can't have.
>
> If I put "type:value" at the end of the query command, like so:
> select?q=name:america^1+name:state^1+name:united^1+AND+type:value
> In this case, it will only return documents which contain the "united"
> token in the name field (and where type==value).  Again, it will totally
> ignore "name:america^1+name:state^1", it seems.
>
> I tried putting an "AND" between everything, like so:
> select?q=type:value+AND+name:america^1+AND+name:state^1+AND+name:united^1
> But this, of course, would only return documents which contain all the
> tokens {america, state, united}; whereas I need all documents which contain
> any of those tokens.
>
>
> If anyone could help me out with how this could be done / what the correct
> syntax would be, that would be a huge help.
>
> Much thanks
> Omer
>


Need help with query syntax

2017-08-10 Thread OTH
Hello,

I have the following use case:

I have two fields (among others); one is 'name' and the other is 'type'.
 'Name' is the field I need to search, whereas, with 'type', I need to make
sure that it has a certain value, depending on the situation.  Often, when
I search the 'name' field, the search query would have multiple tokens.
Furthermore, each query token needs to have a scoring weight attached to
it.

However, I'm unable to figure out the syntax which would allow all these
things to happen.

For example, if I use the following query:
select?q=type:value+AND+name:america^1+name:state^1+name:united^1
It would only return documents where 'name' includes the token 'america'
(and where type==value).  It will totally ignore
"+name:state^1+name:united^1", it seems.

This does not happen if I omit "type:value+AND+".  So, with the following
query:
select?q=name:america^1+name:state^1+name:united^1
It returns all documents which contain any of the three tokens {america,
state, united}; which is what I need.  However, it also returns documents
where type != value; which I can't have.

If I put "type:value" at the end of the query command, like so:
select?q=name:america^1+name:state^1+name:united^1+AND+type:value
In this case, it will only return documents which contain the "united"
token in the name field (and where type==value).  Again, it will totally
ignore "name:america^1+name:state^1", it seems.

I tried putting an "AND" between everything, like so:
select?q=type:value+AND+name:america^1+AND+name:state^1+AND+name:united^1
But this, of course, would only return documents which contain all the
tokens {america, state, united}; whereas I need all documents which contain
any of those tokens.


If anyone could help me out with how this could be done / what the correct
syntax would be, that would be a huge help.

Much thanks
Omer


Re: Need help with Query Syntax

2017-04-17 Thread OTH
I tried that, but it returned no results.
I understand now that the issue is that since the field has been tokenized
- searching for "*san\ *" will try to search for individual tokens which
contain the string sequence "san ", and so of course it won't find any.
I think I've found another workaround though which might work for me.
Thanks

On Tue, Apr 18, 2017 at 12:56 AM, Mikhail Khludnev  wrote:

> This can be done with escaping space
> select?q=field:*san\ *
> Probably sow=false in new version might also helo
>
>
> On Mon, Apr 17, 2017 at 4:42 PM, OTH  wrote:
>
> > If I submit the query:
> >  "select?q=field:*san*"
> > Then it works as expected; returning all values in the field which
> contain
> > the string "san".
> >
> > However if I submit:
> > "select?q=field:*san *"
> > It then seems to return all the values of the field, regardless of what
> the
> > value is (!)
> >
> > I only wish in this case to get the values which contain the string "san
> ",
> > but I'm unable to achieve that.
> >
> > Thanks
> >
>
>
>
> --
> Sincerely yours
> Mikhail Khludnev
>


Re: Need help with Query Syntax

2017-04-17 Thread Mikhail Khludnev
This can be done with escaping space
select?q=field:*san\ *
Probably sow=false in new version might also helo


On Mon, Apr 17, 2017 at 4:42 PM, OTH  wrote:

> If I submit the query:
>  "select?q=field:*san*"
> Then it works as expected; returning all values in the field which contain
> the string "san".
>
> However if I submit:
> "select?q=field:*san *"
> It then seems to return all the values of the field, regardless of what the
> value is (!)
>
> I only wish in this case to get the values which contain the string "san ",
> but I'm unable to achieve that.
>
> Thanks
>



-- 
Sincerely yours
Mikhail Khludnev


Re: Need help with Query Syntax

2017-04-17 Thread OTH
Ok.  What analyzer / fieldtype should I use to be able to search across
tokens?
Basically, I'm just trying to replicate the functionality of the
AnalyzingInfixLookupFactor Suggester, but I need to do it using a regular
index, because I need to utilize multiple fields using edismax bq, which
seems to not be possible with the Suggester
Thanks

On Mon, Apr 17, 2017 at 10:46 PM, Binoy Dalal 
wrote:

> Use the analyser available in the solr admin console to find out exactly
> how your query is analysed. That should give you a lot more information.
>
> On Mon 17 Apr, 2017, 21:58 OTH,  wrote:
>
> > Ok, I get it now, it's because the field has been indexed as tokens.  So
> > maybe I should use a field which does not have a tokenizer index?  I'll
> try
> > something like that.  Thanks
> >
> > On Mon, Apr 17, 2017 at 9:16 PM, OTH  wrote:
> >
> > > The field type is "text_general".
> > >
> > > On Mon, Apr 17, 2017 at 7:15 PM, Binoy Dalal 
> > > wrote:
> > >
> > >> I think it returns everything because your query matches *san or " *".
> > >> What is your field type definition?
> > >>
> > >> On Mon 17 Apr, 2017, 19:12 OTH,  wrote:
> > >>
> > >> > If I submit the query:
> > >> >  "select?q=field:*san*"
> > >> > Then it works as expected; returning all values in the field which
> > >> contain
> > >> > the string "san".
> > >> >
> > >> > However if I submit:
> > >> > "select?q=field:*san *"
> > >> > It then seems to return all the values of the field, regardless of
> > what
> > >> the
> > >> > value is (!)
> > >> >
> > >> > I only wish in this case to get the values which contain the string
> > >> "san ",
> > >> > but I'm unable to achieve that.
> > >> >
> > >> > Thanks
> > >> >
> > >> --
> > >> Regards,
> > >> Binoy Dalal
> > >>
> > >
> > >
> >
> --
> Regards,
> Binoy Dalal
>


Re: Need help with Query Syntax

2017-04-17 Thread Binoy Dalal
Use the analyser available in the solr admin console to find out exactly
how your query is analysed. That should give you a lot more information.

On Mon 17 Apr, 2017, 21:58 OTH,  wrote:

> Ok, I get it now, it's because the field has been indexed as tokens.  So
> maybe I should use a field which does not have a tokenizer index?  I'll try
> something like that.  Thanks
>
> On Mon, Apr 17, 2017 at 9:16 PM, OTH  wrote:
>
> > The field type is "text_general".
> >
> > On Mon, Apr 17, 2017 at 7:15 PM, Binoy Dalal 
> > wrote:
> >
> >> I think it returns everything because your query matches *san or " *".
> >> What is your field type definition?
> >>
> >> On Mon 17 Apr, 2017, 19:12 OTH,  wrote:
> >>
> >> > If I submit the query:
> >> >  "select?q=field:*san*"
> >> > Then it works as expected; returning all values in the field which
> >> contain
> >> > the string "san".
> >> >
> >> > However if I submit:
> >> > "select?q=field:*san *"
> >> > It then seems to return all the values of the field, regardless of
> what
> >> the
> >> > value is (!)
> >> >
> >> > I only wish in this case to get the values which contain the string
> >> "san ",
> >> > but I'm unable to achieve that.
> >> >
> >> > Thanks
> >> >
> >> --
> >> Regards,
> >> Binoy Dalal
> >>
> >
> >
>
-- 
Regards,
Binoy Dalal


Re: Need help with Query Syntax

2017-04-17 Thread OTH
Ok, I get it now, it's because the field has been indexed as tokens.  So
maybe I should use a field which does not have a tokenizer index?  I'll try
something like that.  Thanks

On Mon, Apr 17, 2017 at 9:16 PM, OTH  wrote:

> The field type is "text_general".
>
> On Mon, Apr 17, 2017 at 7:15 PM, Binoy Dalal 
> wrote:
>
>> I think it returns everything because your query matches *san or " *".
>> What is your field type definition?
>>
>> On Mon 17 Apr, 2017, 19:12 OTH,  wrote:
>>
>> > If I submit the query:
>> >  "select?q=field:*san*"
>> > Then it works as expected; returning all values in the field which
>> contain
>> > the string "san".
>> >
>> > However if I submit:
>> > "select?q=field:*san *"
>> > It then seems to return all the values of the field, regardless of what
>> the
>> > value is (!)
>> >
>> > I only wish in this case to get the values which contain the string
>> "san ",
>> > but I'm unable to achieve that.
>> >
>> > Thanks
>> >
>> --
>> Regards,
>> Binoy Dalal
>>
>
>


Re: Need help with Query Syntax

2017-04-17 Thread OTH
The field type is "text_general".

On Mon, Apr 17, 2017 at 7:15 PM, Binoy Dalal  wrote:

> I think it returns everything because your query matches *san or " *".
> What is your field type definition?
>
> On Mon 17 Apr, 2017, 19:12 OTH,  wrote:
>
> > If I submit the query:
> >  "select?q=field:*san*"
> > Then it works as expected; returning all values in the field which
> contain
> > the string "san".
> >
> > However if I submit:
> > "select?q=field:*san *"
> > It then seems to return all the values of the field, regardless of what
> the
> > value is (!)
> >
> > I only wish in this case to get the values which contain the string "san
> ",
> > but I'm unable to achieve that.
> >
> > Thanks
> >
> --
> Regards,
> Binoy Dalal
>


Re: Need help with Query Syntax

2017-04-17 Thread Binoy Dalal
I think it returns everything because your query matches *san or " *".
What is your field type definition?

On Mon 17 Apr, 2017, 19:12 OTH,  wrote:

> If I submit the query:
>  "select?q=field:*san*"
> Then it works as expected; returning all values in the field which contain
> the string "san".
>
> However if I submit:
> "select?q=field:*san *"
> It then seems to return all the values of the field, regardless of what the
> value is (!)
>
> I only wish in this case to get the values which contain the string "san ",
> but I'm unable to achieve that.
>
> Thanks
>
-- 
Regards,
Binoy Dalal


Need help with Query Syntax

2017-04-17 Thread OTH
If I submit the query:
 "select?q=field:*san*"
Then it works as expected; returning all values in the field which contain
the string "san".

However if I submit:
"select?q=field:*san *"
It then seems to return all the values of the field, regardless of what the
value is (!)

I only wish in this case to get the values which contain the string "san ",
but I'm unable to achieve that.

Thanks


Re: Boost query syntax error

2014-03-03 Thread Chris Hostetter

: But this query does not work:
: 
: q={!boost
: b=if(exists(query({!v='user_type:ADMIN'})),10,1)}id:1rows=1fl=*,score
: It gives an error like this:

The problem is the way you are trying to nest queries inside of each other 
w/o any sort of quoting -- the parser has no indication that the b param 
is if(exists(query({!v='user_type:ADMIN'})),10,1) it thinks it' 
if(exists(query({!v='user_type:ADMIN' and the rest is confusing it.

If you quote the b param to the boost parser, then it should work...

http://localhost:8983/solr/select?q={!boost%20b=%22if%28exists%28query%28{!v=%27foo_s:ADMIN%27}%29%29,10,1%29%22}id:1

...or if you could use variable derefrencing, either of these should 
work...

http://localhost:8983/solr/select?q={!boost%20b=$b}id:1b=if%28exists%28query%28{!v=%27foo_s:ADMIN%27}%29%29,10,1%29
http://localhost:8983/solr/select?q={!boost%20b=if(exists(query($nestedq)),10,1)}id:1nestedq=foo_s:ADMIN


-Hoss
http://www.lucidworks.com/


Re: Boost query syntax error

2014-03-03 Thread Arun Rangarajan
All of them work like a charm! Thanks, Chris.


On Mon, Mar 3, 2014 at 1:28 PM, Chris Hostetter hossman_luc...@fucit.orgwrote:


 : But this query does not work:
 :
 : q={!boost
 : b=if(exists(query({!v='user_type:ADMIN'})),10,1)}id:1rows=1fl=*,score
 : It gives an error like this:

 The problem is the way you are trying to nest queries inside of each other
 w/o any sort of quoting -- the parser has no indication that the b param
 is if(exists(query({!v='user_type:ADMIN'})),10,1) it thinks it'
 if(exists(query({!v='user_type:ADMIN' and the rest is confusing it.

 If you quote the b param to the boost parser, then it should work...


 http://localhost:8983/solr/select?q={!boost%20b=%22if%28exists%28query%28{!v=%27foo_s:ADMIN%27}%29%29,10,1%29%22}id:1

 ...or if you could use variable derefrencing, either of these should
 work...


 http://localhost:8983/solr/select?q={!boost%20b=$b}id:1b=if%28exists%28query%28{!v=%27foo_s:ADMIN%27}%29%29,10,1%29

 http://localhost:8983/solr/select?q={!boost%20b=if(exists(query($nestedq)),10,1)}id:1nestedq=foo_s:ADMIN


 -Hoss
 http://www.lucidworks.com/



Re: Solr query syntax.

2013-12-02 Thread elmerfudd
Im using the default qparser that come with solr 4.4 , Is there anything
better?



--
View this message in context: 
http://lucene.472066.n3.nabble.com/Solr-query-syntax-tp4103784p4104344.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: Solr query syntax.

2013-12-02 Thread Ahmet Arslan
Hi,

Choice of query parser depends on your needs. I am just surprised that you used 
prefix notation in your example. 
Default query parser syntax for and(blabla , name: george)  is q=blabla AND 
name:george
Term blabla (which does not consider field) parsed against default search 
field. Default field is set via df parameter.
https://cwiki.apache.org/confluence/display/solr/The+Standard+Query+Parser  




On Monday, December 2, 2013 10:17 AM, elmerfudd na...@012.net.il wrote:
 
Im using the default qparser that come with solr 4.4 , Is there anything
better?



--
View this message in context: 
http://lucene.472066.n3.nabble.com/Solr-query-syntax-tp4103784p4104344.html

Sent from the Solr - User mailing list archive at Nabble.com.

Re: Solr query syntax.

2013-12-02 Thread Jack Krupansky
The edismax (ExtendedDisMax) query parser is the best, overall. There are 
other specialized query parsers with features that edismax does not have 
(e.g., surround for span queries, and complex phrase for wildcards in 
phrases.)


-- Jack Krupansky

-Original Message- 
From: elmerfudd

Sent: Monday, December 02, 2013 3:17 AM
To: solr-user@lucene.apache.org
Subject: Re: Solr query syntax.

Im using the default qparser that come with solr 4.4 , Is there anything
better?



--
View this message in context: 
http://lucene.472066.n3.nabble.com/Solr-query-syntax-tp4103784p4104344.html
Sent from the Solr - User mailing list archive at Nabble.com. 



Converting Fast ESP queries(fql) to Solr query syntax

2013-11-28 Thread elmerfudd
I would like to perform searches in Solr using queries I extracted from Fast
ESP  . The queries are written in FQL (fast query language) format and I
want to convert them to Solr query syntax . Is there any way to preform a
search like this in Solr? Maybe a tool available? Could not find anything on
the web. 

Thank you. 



--
View this message in context: 
http://lucene.472066.n3.nabble.com/Converting-Fast-ESP-queries-fql-to-Solr-query-syntax-tp4103754.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: Solr query syntax.

2013-11-28 Thread Ahmet Arslan
Hi,

No it does not ignore. debugQuery=on shows actual parsed query.
By the way default query parser does not support prefix AND(a, b, c) notation.
Which query parser are you using?





On Thursday, November 28, 2013 6:50 PM, elmerfudd na...@012.net.il wrote:
Is solr ignoring parts of the query that dont consider fields.
something like
and(blabla , name: george)

It wont throw an exeption, so what is he considering blablabla to?




--
View this message in context: 
http://lucene.472066.n3.nabble.com/Solr-query-syntax-tp4103784.html
Sent from the Solr - User mailing list archive at Nabble.com.



Re: JSON query syntax

2013-01-24 Thread Otis Gospodnetic
Nice, Yonik!
Here is one suggestion. OK, I'm beginning you - please don't make
it be as hard on the eyes as Local Params. :)  I thought it was just me who
could never get along with Local Params, but I've learned that a number of
people find Local Params very hard to grok.  Yes, this is JSON, so right
there it may be better, but for instance I see v here which to a regular
human may not be as nice as value if that is what v stands for.
Looking at examples from the JIRA issue

{'frange':{'v':'mul(foo_i,2)', 'l':20,'u':24}}}


v is value?

mul is multiply?

what's l? left? No, low(er)?

what's u? Aha, upper?


I'd rather use a few extra character and be clear, easily memorable, and
user friendly.  People love ES's JSON API and I have never ever heard
anyone say it's too verbose.

Thanks,
Otis





On Thu, Jan 24, 2013 at 8:44 PM, Yonik Seeley yo...@lucidworks.com wrote:

 Although lucene syntax tends to be quite concise, nice looking, and
 easy to build by hand (the web browser is a major debugging tool for
 me), some people prefer to use a more structured query language
 that's easier to build up programmatically.  XML fits the bill, but
 people tend to prefer JSON these days.

 Hence my first quick prototype:
 https://issues.apache.org/jira/browse/SOLR-4351

 I'm pretty happy so far with how easily it's fit in with our QParser
 framework, which should generally allow parsers to not care about the
 underlying syntax of queries they need to deal with.
 For example: the join qparser uses the query specified by v, but
 doesn't care of it's in lucene syntax, or if it was part of the JSON.

 {'join':{'from':'qqq_s', 'to':'www_s', 'v':'id:10'}}
 {'join':{'from':'qqq_s', 'to':'www_s', 'v':{'term':{'id':'10'

 Note: replace the single quotes with double quotes before trying it
 out - these are just test strings that have the replacement done in
 the test code so that they are easier to read.

 There's a fair bit left to do of course... like how to deal with
 boost, cache, cost, parameter dereferencing, etc.
 Feedback welcome... and hopefully this will be good to go for 4.2

 -Yonik
 http://lucidworks.com



Re: JSON query syntax

2013-01-24 Thread Yonik Seeley
On Thu, Jan 24, 2013 at 8:55 PM, Otis Gospodnetic
otis.gospodne...@gmail.com wrote:
 Yes, this is JSON, so right
 there it may be better, but for instance I see v here which to a regular
 human may not be as nice as value if that is what v stands for.

One goal was to reuse the parsers/parameter names.  A completely
disjoint set would certainly lead to confusion.
Concise *common* abbreviations are fine I think - for example we
quickly get used to (and prefer) f(x) over function(variable1)

We could add some aliases though.

-Yonik
http://lucidworks.com


Re: Date math query syntax

2012-11-18 Thread Jack Krupansky
You can do numeric math in function queries, but not string operations, and 
there is no provision for doing string operations in a query using the 
result of an embedded function query.


You haven't shown us a full query.

Sounds like we have another candidate for XY Problem. First you need to 
tell us what you are really trying to accomplish, THEN a solution can be 
pursued.


Take a look at the ms function query for date calculations - which is 
separate from so-called date-math which is a constant offset from a base 
date literal value.


-- Jack Krupansky

-Original Message- 
From: Indika Tantrigoda

Sent: Sunday, November 18, 2012 3:11 PM
To: solr-user@lucene.apache.org
Subject: Date math query syntax

Hi All,

I am trying to use date math along with a filed
value. 1970-01-01T04:32:010Z+(_val_:prep_time)MINUTES is the date math
query I am using. prep_time is of type int. I am having trouble properly
formatting the string resulting in exceptions. I am guessing that I am not
properly formatting the query with quotes and/or parenthesis.

Thanks,
Indika 



Re: Date math query syntax

2012-11-18 Thread Indika Tantrigoda
Hi Jack,

Thanks for the response. Let me explain my question better.

I have a filter query to limit the query results,
start_time:[* TO 1970-01-01T10:55:002Z] AND end_time:[1970-01-01T10:55:002Z
TO *] AND session_time_range_available:true

and I also use the same query as a function query in fl using the
if(exists(query), x, y) where query is,
{!edismax}(start_time:[* TO 1970-01-01T10:55:002Z] AND
end_time:[1970-01-01T10:55:002Z TO *] AND session_time_range_available:true)

I need to extend the end_time range query based on the logic, similar to
end_time:[1970-01-01T10:55:002Z+30MINUTUES TO *]

How much I need to offset the end_time range is defined as an int type in
the schema. I was trying to use the field value query (_val_:field) to
retrive the end_time offset, resulting in the query being
1970-01-01T04:32:010Z+(_val_:**prep_time)MINUTES

However the query seems to have syntax errors. Or is it allowed to use the
_val_:field in such instances ?

As an extension I'll also have two offsets resulting in something similar
to
1970-01-01T04:32:010Z+(_val_:**prep_time)MINUTES+(_val_:extend_time)MINUTES

Thanks,
Indika

On 19 November 2012 09:17, Jack Krupansky j...@basetechnology.com wrote:

 You can do numeric math in function queries, but not string operations,
 and there is no provision for doing string operations in a query using the
 result of an embedded function query.

 You haven't shown us a full query.

 Sounds like we have another candidate for XY Problem. First you need to
 tell us what you are really trying to accomplish, THEN a solution can be
 pursued.

 Take a look at the ms function query for date calculations - which is
 separate from so-called date-math which is a constant offset from a base
 date literal value.

 -- Jack Krupansky

 -Original Message- From: Indika Tantrigoda
 Sent: Sunday, November 18, 2012 3:11 PM
 To: solr-user@lucene.apache.org
 Subject: Date math query syntax


 Hi All,

 I am trying to use date math along with a filed
 value. 1970-01-01T04:32:010Z+(_val_:**prep_time)MINUTES is the date math
 query I am using. prep_time is of type int. I am having trouble properly
 formatting the string resulting in exceptions. I am guessing that I am not
 properly formatting the query with quotes and/or parenthesis.

 Thanks,
 Indika



Help with Query syntax. How to make a query that works in between AND and OR.

2012-09-21 Thread cleonard
I have a search text field that contains all the search terms.  I'm taking
user input and breaking it up into tokens of term1, term2, term3, etc and
the then submitting to Dismax.  

q=search_text:term1* AND search_text:term2* AND search_text:term3*

This works great.  The problem is when a user mistypes a term.  Then nothing
is found.  This is not good. 

To address this I'm now doing OR instead

q=search_text:term1* OR search_text:term2* OR search_text:term3*

Now a mistyped term is no problem.  I still get results.  The issue now is
that I get too many results back.  What I want is something that effectively
does an AND if a term is matched, but does an OR when a term is not found. 
To say it a differnt way -- If a term is found I only want results that
contain that term.  

I've tried many different boolean expressions to no success.  I've spent
hours searching for a solution, but so far I've not found the answer.  I
feel that there is a simple solution, so I'm hoping that someone can
enlighten me here.






--
View this message in context: 
http://lucene.472066.n3.nabble.com/Help-with-Query-syntax-How-to-make-a-query-that-works-in-between-AND-and-OR-tp4009451.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: Help with Query syntax. How to make a query that works in between AND and OR.

2012-09-21 Thread Shawn Heisey

On 9/21/2012 11:22 AM, cleonard wrote:

Now a mistyped term is no problem.  I still get results.  The issue now is
that I get too many results back.  What I want is something that effectively
does an AND if a term is matched, but does an OR when a term is not found.
To say it a differnt way -- If a term is found I only want results that
contain that term.


It won't be precisely what you describe, but you may want to switch to 
edismax and employ the mm parameter.


http://wiki.apache.org/solr/ExtendedDisMax

http://wiki.apache.org/solr/ExtendedDisMax#mm_.28Minimum_.27Should.27_Match.29

Thanks,
Shawn



Re: Help with Query syntax. How to make a query that works in between AND and OR.

2012-09-21 Thread cleonard
I've played with the mm parameter quite a bit.  It does sort of do what I
need if I do multiple queries decreasing the mm parameter with each call. 
However, I'm doing this for a web form auto complete or suggester so I
really want to make this happen in a single request if at all possible.



--
View this message in context: 
http://lucene.472066.n3.nabble.com/Help-with-Query-syntax-How-to-make-a-query-that-works-in-between-AND-and-OR-tp4009451p4009460.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: Help with Query syntax. How to make a query that works in between AND and OR.

2012-09-21 Thread Otis Gospodnetic
Hi,

I'm curious... why do you issue multiple queries for autocomplete purposes?
Have you tried using Suggester?  May also want
http://sematext.com/products/autocomplete/index.html which works
nicely with Solr.

Otis
Search Analytics - http://sematext.com/search-analytics/index.html
Performance Monitoring - http://sematext.com/spm/index.html


On Fri, Sep 21, 2012 at 2:50 PM, cleonard cleon...@whisolutions.com wrote:
 I've played with the mm parameter quite a bit.  It does sort of do what I
 need if I do multiple queries decreasing the mm parameter with each call.
 However, I'm doing this for a web form auto complete or suggester so I
 really want to make this happen in a single request if at all possible.



 --
 View this message in context: 
 http://lucene.472066.n3.nabble.com/Help-with-Query-syntax-How-to-make-a-query-that-works-in-between-AND-and-OR-tp4009451p4009460.html
 Sent from the Solr - User mailing list archive at Nabble.com.


Re: Help with Query syntax. How to make a query that works in between AND and OR.

2012-09-21 Thread cleonard
Otis Gospodnetic-5 wrote
 Hi,
 
 I'm curious... why do you issue multiple queries for autocomplete
 purposes?
 Have you tried using Suggester?  May also want
 http://sematext.com/products/autocomplete/index.html which works
 nicely with Solr.
 
 Otis
 Search Analytics - http://sematext.com/search-analytics/index.html
 Performance Monitoring - http://sematext.com/spm/index.html

I'm not doing multiple queries.  I'm trying to add some functionality and
not have to do multiple queries.  I've worked with the Suggester and so far
I've not been able to get that to do what I need.  I'll revisit the
suggester component and see if I can make it do what I need.

I have a kind of specialized search that I'm implenmenting.  It's actually
working great.  I just need this one more piece to make it just about
perfect.  




--
View this message in context: 
http://lucene.472066.n3.nabble.com/Help-with-Query-syntax-How-to-make-a-query-that-works-in-between-AND-and-OR-tp4009451p4009470.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: Join Query syntax

2012-05-11 Thread Sohail Aboobaker
Is it available in Solr 3.5 or is there a way to do something similar in
Solr 3.5,


Re: Join Query syntax

2012-05-10 Thread Otis Gospodnetic
Hi Sohail,

http://search-lucene.com/?q=Joinfc_project=Solr 


Hit #1.

Otis 

Performance Monitoring for Solr / ElasticSearch / HBase - 
http://sematext.com/spm 



- Original Message -
 From: Sohail Aboobaker sabooba...@gmail.com
 To: solr-user@lucene.apache.org
 Cc: 
 Sent: Thursday, May 10, 2012 10:13 PM
 Subject: Join Query syntax
 
 Hi,
 
 We have two indexes. One is for item master and other one is item detail.
 Our search results page is supposed to show all the item masters in a
 certain criteria but also include a column minimum price. This minimum
 price is the minimum price in item detail index.
 
 Is there a way to do this in one query or do we have to do a query within
 loop of search results?
 
 Thank you for your help.
 
 Sohail



The correct query syntax for date ?

2011-07-07 Thread duddy67
Hi,

I have a syntax problem in my query with the SOLR date format.
This is what I type:

q=datecreation:2001-10-11

but SOLR returns me an error message:

Invalid Date String:'2001-10-11'

I tried different combinations but none of them works.
Someone could tells me what is the correct syntax ?


Thanks for advance.

--
View this message in context: 
http://lucene.472066.n3.nabble.com/The-correct-query-syntax-for-date-tp3147532p3147532.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: The correct query syntax for date ?

2011-07-07 Thread Ahmet Arslan
 I have a syntax problem in my query with the SOLR date
 format.
 This is what I type:
 
 q=datecreation:2001-10-11
 
 but SOLR returns me an error message:
 
 Invalid Date String:'2001-10-11'
 
 I tried different combinations but none of them works.
 Someone could tells me what is the correct syntax ?

Please see the green colored comments in example schema.xml:

The format for this date field is of the form 1995-12-31T23:59:59Z, and
 is a more restricted form of the canonical representation of dateTime
 http://www.w3.org/TR/xmlschema-2/#dateTime
 The trailing Z designates UTC time and is mandatory.


Re: The correct query syntax for date ?

2011-07-07 Thread duddy67
Thanks but I'm still lost.
I didn't see any green colored comments.
Could you show me a concrete example of a date query ?

Thanks

--
View this message in context: 
http://lucene.472066.n3.nabble.com/The-correct-query-syntax-for-date-tp3147536p3147890.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: The correct query syntax for date ?

2011-07-07 Thread Erick Erickson
Well, just search for date field in schema.xml (assuming a recent
version of Solr, you haven't told us what version you're using).

The green assumes you're using an editor that highlights comments
in an XML file.

But all the information you need is right there in Ahmet's e-mail. Dates
are represented as 1995-12-31T23:59:59Z. Look at
http://lucene.apache.org/solr/api/org/apache/solr/schema/DateField.html

(first hit when googling solr date).

Best
Erick

On Thu, Jul 7, 2011 at 7:33 AM, duddy67 san...@littlemarc.com wrote:
 Thanks but I'm still lost.
 I didn't see any green colored comments.
 Could you show me a concrete example of a date query ?

 Thanks

 --
 View this message in context: 
 http://lucene.472066.n3.nabble.com/The-correct-query-syntax-for-date-tp3147536p3147890.html
 Sent from the Solr - User mailing list archive at Nabble.com.



Re: The correct query syntax for date ?

2011-07-07 Thread duddy67
I allready tried the format: 

q=datecreation:2001-10-11T00:00:00Z

but I still get the same error message.

I use the 1.4.1 version. Is this the reason of my pb ? 

--
View this message in context: 
http://lucene.472066.n3.nabble.com/The-correct-query-syntax-for-date-tp3147536p3148384.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: The correct query syntax for date ?

2011-07-07 Thread Erick Erickson
right, you have to escape the ':' in the date, those are Lucene
query syntax characters. Try:
q=datecreation:2001-10-11T00\:00\:00Z

On Thu, Jul 7, 2011 at 10:36 AM, duddy67 san...@littlemarc.com wrote:
 I allready tried the format:

 q=datecreation:2001-10-11T00:00:00Z

 but I still get the same error message.

 I use the 1.4.1 version. Is this the reason of my pb ?

 --
 View this message in context: 
 http://lucene.472066.n3.nabble.com/The-correct-query-syntax-for-date-tp3147536p3148384.html
 Sent from the Solr - User mailing list archive at Nabble.com.



Re: The correct query syntax for date ?

2011-07-07 Thread duddy67
It works. 
Thanks.

--
View this message in context: 
http://lucene.472066.n3.nabble.com/The-correct-query-syntax-for-date-tp3147536p3149588.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: bbox query syntax

2011-07-01 Thread David Smiley (@MITRE.org)
Hi.
By the way, your uses of parenthesis are completely superfluous.
You can't just plop that {! syntax anywhere you please, it only works at
the beginning of a query to establish the query parser for the rest of the
string and/or to set local-params.   There is a sub-query hacky syntax:
... AND _query_:{!bbox sfield=storeLocation pt=32.73,-96.97 d=20}.  But in
your case, I would simply use a second filter query: fq={!bbox
sfield=storeLocation pt=32.73,-96.97 d=20}

And by the way, you forgot to round down your first NOW to the day.

~ David

-
 Author: https://www.packtpub.com/solr-1-4-enterprise-search-server/book
--
View this message in context: 
http://lucene.472066.n3.nabble.com/bbox-query-syntax-tp3130329p3131458.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: Help with explain query syntax

2011-03-22 Thread Glòria Martínez
Thank you very much!

On Wed, Mar 9, 2011 at 2:01 AM, Yonik Seeley yo...@lucidimagination.comwrote:

 It's probably the WordDelimiterFilter:

  org.apache.solr.analysis.WordDelimiterFilterFactory
 args:{preserveOriginal:
  1 splitOnCaseChange: 1 generateNumberParts: 1 catenateWords: 0
  generateWordParts: 1 catenateAll: 0 catenateNumbers: 0 }

 Get rid of the preserveOriginal=1 in the query analyzer.

 -Yonik
 http://lucidimagination.com

 On Tue, Mar 1, 2011 at 9:01 AM, Glòria Martínez
 gloria.marti...@careesma.com wrote:
  Hello,
 
  I can't understand why this query is not matching anything. Could someone
  help me please?
 
  *Query*
 
 http://localhost:8894/solr/select?q=linguajob.plqf=company_namewt=xmlqt=dismaxdebugQuery=onexplainOther=id%3A1
 
  response
  -
  lst name=responseHeader
  int name=status0/int
  int name=QTime12/int
  -
  lst name=params
  str name=explainOtherid:1/str
  str name=debugQueryon/str
  str name=qlinguajob.pl/str
  str name=qfcompany_name/str
  str name=wtxml/str
  str name=qtdismax/str
  /lst
  /lst
  result name=response numFound=0 start=0/
  -
  lst name=debug
  str name=rawquerystringlinguajob.pl/str
  str name=querystringlinguajob.pl/str
  -
  str name=parsedquery
  +DisjunctionMaxQuery((company_name:(linguajob.pl linguajob) pl)~0.01)
 ()
  /str
  -
  str name=parsedquery_toString
  +(company_name:(linguajob.pl linguajob) pl)~0.01 ()
  /str
  lst name=explain/
  str name=otherQueryid:1/str
  -
  lst name=explainOther
  -
  str name=1
 
  0.0 = (NON-MATCH) Failure to meet condition(s) of required/prohibited
  clause(s)
   0.0 = no match on required clause (company_name:(linguajob.pllinguajob)
  pl) *- What does this syntax (field:(token1 token2) token3) mean?*
 0.0 = (NON-MATCH) fieldWeight(company_name:(linguajob.pl linguajob)
 pl
  in 0), product of:
   0.0 = tf(phraseFreq=0.0)
   1.6137056 = idf(company_name:(linguajob.pl linguajob) pl)
   0.4375 = fieldNorm(field=company_name, doc=0)
  /str
  /lst
  str name=QParserDisMaxQParser/str
  null name=altquerystring/
  null name=boostfuncs/
  +
  lst name=timing
  ...
  /response
 
 
 
  There's only one document indexed:
 
  *Document*
  http://localhost:8894/solr/select?q=1qf=idwt=xmlqt=dismax
  response
  -
  lst name=responseHeader
  int name=status0/int
  int name=QTime2/int
  -
  lst name=params
  str name=qfid/str
  str name=wtxml/str
  str name=qtdismax/str
  str name=q1/str
  /lst
  /lst
  -
  result name=response numFound=1 start=0
  -
  doc
  str name=company_nameLinguaJob.pl/str
  str name=id1/str
  int name=status6/int
  date name=timestamp2011-03-01T11:14:24.553Z/date
  /doc
  /result
  /response
 
  *Solr Admin Schema*
  Field: company_name
  Field Type: text
  Properties: Indexed, Tokenized, Stored
  Schema: Indexed, Tokenized, Stored
  Index: Indexed, Tokenized, Stored
 
  Position Increment Gap: 100
 
  Index Analyzer: org.apache.solr.analysis.TokenizerChain Details
  Tokenizer Class: org.apache.solr.analysis.WhitespaceTokenizerFactory
  Filters:
  schema.UnicodeNormalizationFilterFactory args:{composed: false
  remove_modifiers: true fold: true version: java6 remove_diacritics: true
 }
  org.apache.solr.analysis.StopFilterFactory args:{words: stopwords.txt
  ignoreCase: true enablePositionIncrements: true }
  org.apache.solr.analysis.WordDelimiterFilterFactory
 args:{preserveOriginal:
  1 splitOnCaseChange: 1 generateNumberParts: 1 catenateWords: 1
  generateWordParts: 1 catenateAll: 0 catenateNumbers: 1 }
  org.apache.solr.analysis.LowerCaseFilterFactory args:{}
  org.apache.solr.analysis.RemoveDuplicatesTokenFilterFactory args:{}
 
  Query Analyzer: org.apache.solr.analysis.TokenizerChain Details
  Tokenizer Class: org.apache.solr.analysis.WhitespaceTokenizerFactory
  Filters:
  schema.UnicodeNormalizationFilterFactory args:{composed: false
  remove_modifiers: true fold: true version: java6 remove_diacritics: true
 }
  org.apache.solr.analysis.SynonymFilterFactory args:{synonyms:
 synonyms.txt
  expand: true ignoreCase: true }
  org.apache.solr.analysis.StopFilterFactory args:{words: stopwords.txt
  ignoreCase: true }
  org.apache.solr.analysis.WordDelimiterFilterFactory
 args:{preserveOriginal:
  1 splitOnCaseChange: 1 generateNumberParts: 1 catenateWords: 0
  generateWordParts: 1 catenateAll: 0 catenateNumbers: 0 }
  org.apache.solr.analysis.LowerCaseFilterFactory args:{}
  org.apache.solr.analysis.RemoveDuplicatesTokenFilterFactory args:{}
 
  Docs: 1
  Distinct: 5
  Top 5 terms
  term frequency
  lingua 1
  linguajob.pl 1
  linguajobpl 1
  pl 1
  job 1
 
  *Solr Analysis*
  Field name: company_name
  Field value (Index): LinguaJob.pl
  Field value (Query): linguajob.pl
 
  *Index Analyzer
 
  org.apache.solr.analysis.WhitespaceTokenizerFactory {}
  term position 1
  term text LinguaJob.pl
  term type word
  source start,end 0,12
  payload
 
  schema.UnicodeNormalizationFilterFactory {composed=false,
  remove_modifiers=true, fold=true, version=java6, remove_diacritics=true}
  term 

Re: Help with explain query syntax

2011-03-08 Thread Chris Hostetter

: str name=parsedquery
: +DisjunctionMaxQuery((company_name:(linguajob.pl linguajob) pl)~0.01) ()
: /str

you can see the crux of your problem in this query string

it seems you have a query time synonym in place to *expand* linguajob.pl 
into [linguajob.pl] and [linguajob] [pl] but query time synonym expansion 
of multiword queries doesn't work -- what it is ultimatley requiring is 
that a doc contain linguajob.pl and linguajob at the same term 
position, followed by pl

this is not what you have indexed.

This type of specific example is warned against on the wiki...

http://wiki.apache.org/solr/AnalyzersTokenizersTokenFilters#solr.SynonymFilterFactory


-Hoss


Re: Help with explain query syntax

2011-03-08 Thread Yonik Seeley
It's probably the WordDelimiterFilter:

 org.apache.solr.analysis.WordDelimiterFilterFactory args:{preserveOriginal:
 1 splitOnCaseChange: 1 generateNumberParts: 1 catenateWords: 0
 generateWordParts: 1 catenateAll: 0 catenateNumbers: 0 }

Get rid of the preserveOriginal=1 in the query analyzer.

-Yonik
http://lucidimagination.com

On Tue, Mar 1, 2011 at 9:01 AM, Glòria Martínez
gloria.marti...@careesma.com wrote:
 Hello,

 I can't understand why this query is not matching anything. Could someone
 help me please?

 *Query*
 http://localhost:8894/solr/select?q=linguajob.plqf=company_namewt=xmlqt=dismaxdebugQuery=onexplainOther=id%3A1

 response
 -
 lst name=responseHeader
 int name=status0/int
 int name=QTime12/int
 -
 lst name=params
 str name=explainOtherid:1/str
 str name=debugQueryon/str
 str name=qlinguajob.pl/str
 str name=qfcompany_name/str
 str name=wtxml/str
 str name=qtdismax/str
 /lst
 /lst
 result name=response numFound=0 start=0/
 -
 lst name=debug
 str name=rawquerystringlinguajob.pl/str
 str name=querystringlinguajob.pl/str
 -
 str name=parsedquery
 +DisjunctionMaxQuery((company_name:(linguajob.pl linguajob) pl)~0.01) ()
 /str
 -
 str name=parsedquery_toString
 +(company_name:(linguajob.pl linguajob) pl)~0.01 ()
 /str
 lst name=explain/
 str name=otherQueryid:1/str
 -
 lst name=explainOther
 -
 str name=1

 0.0 = (NON-MATCH) Failure to meet condition(s) of required/prohibited
 clause(s)
  0.0 = no match on required clause (company_name:(linguajob.pl linguajob)
 pl) *- What does this syntax (field:(token1 token2) token3) mean?*
    0.0 = (NON-MATCH) fieldWeight(company_name:(linguajob.pl linguajob) pl
 in 0), product of:
      0.0 = tf(phraseFreq=0.0)
      1.6137056 = idf(company_name:(linguajob.pl linguajob) pl)
      0.4375 = fieldNorm(field=company_name, doc=0)
 /str
 /lst
 str name=QParserDisMaxQParser/str
 null name=altquerystring/
 null name=boostfuncs/
 +
 lst name=timing
 ...
 /response



 There's only one document indexed:

 *Document*
 http://localhost:8894/solr/select?q=1qf=idwt=xmlqt=dismax
 response
 -
 lst name=responseHeader
 int name=status0/int
 int name=QTime2/int
 -
 lst name=params
 str name=qfid/str
 str name=wtxml/str
 str name=qtdismax/str
 str name=q1/str
 /lst
 /lst
 -
 result name=response numFound=1 start=0
 -
 doc
 str name=company_nameLinguaJob.pl/str
 str name=id1/str
 int name=status6/int
 date name=timestamp2011-03-01T11:14:24.553Z/date
 /doc
 /result
 /response

 *Solr Admin Schema*
 Field: company_name
 Field Type: text
 Properties: Indexed, Tokenized, Stored
 Schema: Indexed, Tokenized, Stored
 Index: Indexed, Tokenized, Stored

 Position Increment Gap: 100

 Index Analyzer: org.apache.solr.analysis.TokenizerChain Details
 Tokenizer Class: org.apache.solr.analysis.WhitespaceTokenizerFactory
 Filters:
 schema.UnicodeNormalizationFilterFactory args:{composed: false
 remove_modifiers: true fold: true version: java6 remove_diacritics: true }
 org.apache.solr.analysis.StopFilterFactory args:{words: stopwords.txt
 ignoreCase: true enablePositionIncrements: true }
 org.apache.solr.analysis.WordDelimiterFilterFactory args:{preserveOriginal:
 1 splitOnCaseChange: 1 generateNumberParts: 1 catenateWords: 1
 generateWordParts: 1 catenateAll: 0 catenateNumbers: 1 }
 org.apache.solr.analysis.LowerCaseFilterFactory args:{}
 org.apache.solr.analysis.RemoveDuplicatesTokenFilterFactory args:{}

 Query Analyzer: org.apache.solr.analysis.TokenizerChain Details
 Tokenizer Class: org.apache.solr.analysis.WhitespaceTokenizerFactory
 Filters:
 schema.UnicodeNormalizationFilterFactory args:{composed: false
 remove_modifiers: true fold: true version: java6 remove_diacritics: true }
 org.apache.solr.analysis.SynonymFilterFactory args:{synonyms: synonyms.txt
 expand: true ignoreCase: true }
 org.apache.solr.analysis.StopFilterFactory args:{words: stopwords.txt
 ignoreCase: true }
 org.apache.solr.analysis.WordDelimiterFilterFactory args:{preserveOriginal:
 1 splitOnCaseChange: 1 generateNumberParts: 1 catenateWords: 0
 generateWordParts: 1 catenateAll: 0 catenateNumbers: 0 }
 org.apache.solr.analysis.LowerCaseFilterFactory args:{}
 org.apache.solr.analysis.RemoveDuplicatesTokenFilterFactory args:{}

 Docs: 1
 Distinct: 5
 Top 5 terms
 term frequency
 lingua 1
 linguajob.pl 1
 linguajobpl 1
 pl 1
 job 1

 *Solr Analysis*
 Field name: company_name
 Field value (Index): LinguaJob.pl
 Field value (Query): linguajob.pl

 *Index Analyzer

 org.apache.solr.analysis.WhitespaceTokenizerFactory {}
 term position 1
 term text LinguaJob.pl
 term type word
 source start,end 0,12
 payload

 schema.UnicodeNormalizationFilterFactory {composed=false,
 remove_modifiers=true, fold=true, version=java6, remove_diacritics=true}
 term position 1
 term text LinguaJob.pl
 term type word
 source start,end 0,12
 payload

 org.apache.solr.analysis.StopFilterFactory {words=stopwords.txt,
 ignoreCase=true, enablePositionIncrements=true}
 term position 1
 term text LinguaJob.pl
 term type word
 source start,end 

Help with explain query syntax

2011-03-01 Thread Glòria Martínez
Hello,

I can't understand why this query is not matching anything. Could someone
help me please?

*Query*
http://localhost:8894/solr/select?q=linguajob.plqf=company_namewt=xmlqt=dismaxdebugQuery=onexplainOther=id%3A1

response
-
lst name=responseHeader
int name=status0/int
int name=QTime12/int
-
lst name=params
str name=explainOtherid:1/str
str name=debugQueryon/str
str name=qlinguajob.pl/str
str name=qfcompany_name/str
str name=wtxml/str
str name=qtdismax/str
/lst
/lst
result name=response numFound=0 start=0/
-
lst name=debug
str name=rawquerystringlinguajob.pl/str
str name=querystringlinguajob.pl/str
-
str name=parsedquery
+DisjunctionMaxQuery((company_name:(linguajob.pl linguajob) pl)~0.01) ()
/str
-
str name=parsedquery_toString
+(company_name:(linguajob.pl linguajob) pl)~0.01 ()
/str
lst name=explain/
str name=otherQueryid:1/str
-
lst name=explainOther
-
str name=1

0.0 = (NON-MATCH) Failure to meet condition(s) of required/prohibited
clause(s)
  0.0 = no match on required clause (company_name:(linguajob.pl linguajob)
pl) *- What does this syntax (field:(token1 token2) token3) mean?*
0.0 = (NON-MATCH) fieldWeight(company_name:(linguajob.pl linguajob) pl
in 0), product of:
  0.0 = tf(phraseFreq=0.0)
  1.6137056 = idf(company_name:(linguajob.pl linguajob) pl)
  0.4375 = fieldNorm(field=company_name, doc=0)
/str
/lst
str name=QParserDisMaxQParser/str
null name=altquerystring/
null name=boostfuncs/
+
lst name=timing
...
/response



There's only one document indexed:

*Document*
http://localhost:8894/solr/select?q=1qf=idwt=xmlqt=dismax
response
-
lst name=responseHeader
int name=status0/int
int name=QTime2/int
-
lst name=params
str name=qfid/str
str name=wtxml/str
str name=qtdismax/str
str name=q1/str
/lst
/lst
-
result name=response numFound=1 start=0
-
doc
str name=company_nameLinguaJob.pl/str
str name=id1/str
int name=status6/int
date name=timestamp2011-03-01T11:14:24.553Z/date
/doc
/result
/response

*Solr Admin Schema*
Field: company_name
Field Type: text
Properties: Indexed, Tokenized, Stored
Schema: Indexed, Tokenized, Stored
Index: Indexed, Tokenized, Stored

Position Increment Gap: 100

Index Analyzer: org.apache.solr.analysis.TokenizerChain Details
Tokenizer Class: org.apache.solr.analysis.WhitespaceTokenizerFactory
Filters:
schema.UnicodeNormalizationFilterFactory args:{composed: false
remove_modifiers: true fold: true version: java6 remove_diacritics: true }
org.apache.solr.analysis.StopFilterFactory args:{words: stopwords.txt
ignoreCase: true enablePositionIncrements: true }
org.apache.solr.analysis.WordDelimiterFilterFactory args:{preserveOriginal:
1 splitOnCaseChange: 1 generateNumberParts: 1 catenateWords: 1
generateWordParts: 1 catenateAll: 0 catenateNumbers: 1 }
org.apache.solr.analysis.LowerCaseFilterFactory args:{}
org.apache.solr.analysis.RemoveDuplicatesTokenFilterFactory args:{}

Query Analyzer: org.apache.solr.analysis.TokenizerChain Details
Tokenizer Class: org.apache.solr.analysis.WhitespaceTokenizerFactory
Filters:
schema.UnicodeNormalizationFilterFactory args:{composed: false
remove_modifiers: true fold: true version: java6 remove_diacritics: true }
org.apache.solr.analysis.SynonymFilterFactory args:{synonyms: synonyms.txt
expand: true ignoreCase: true }
org.apache.solr.analysis.StopFilterFactory args:{words: stopwords.txt
ignoreCase: true }
org.apache.solr.analysis.WordDelimiterFilterFactory args:{preserveOriginal:
1 splitOnCaseChange: 1 generateNumberParts: 1 catenateWords: 0
generateWordParts: 1 catenateAll: 0 catenateNumbers: 0 }
org.apache.solr.analysis.LowerCaseFilterFactory args:{}
org.apache.solr.analysis.RemoveDuplicatesTokenFilterFactory args:{}

Docs: 1
Distinct: 5
Top 5 terms
term frequency
lingua 1
linguajob.pl 1
linguajobpl 1
pl 1
job 1

*Solr Analysis*
Field name: company_name
Field value (Index): LinguaJob.pl
Field value (Query): linguajob.pl

*Index Analyzer

org.apache.solr.analysis.WhitespaceTokenizerFactory {}
term position 1
term text LinguaJob.pl
term type word
source start,end 0,12
payload

schema.UnicodeNormalizationFilterFactory {composed=false,
remove_modifiers=true, fold=true, version=java6, remove_diacritics=true}
term position 1
term text LinguaJob.pl
term type word
source start,end 0,12
payload

org.apache.solr.analysis.StopFilterFactory {words=stopwords.txt,
ignoreCase=true, enablePositionIncrements=true}
term position 1
term text LinguaJob.pl
term type word
source start,end 0,12
payload

org.apache.solr.analysis.WordDelimiterFilterFactory {preserveOriginal=1,
splitOnCaseChange=1, generateNumberParts=1, catenateWords=1,
generateWordParts=1, catenateAll=0, catenateNumbers=1}
term position 123
term text LinguaJob.plJobpl
LinguaLinguaJobpl
term type wordwordword
wordword
source start,end 0,126,910,12
0,60,12
payload

org.apache.solr.analysis.LowerCaseFilterFactory {}
term position 123
term text linguajob.pljobpl
lingualinguajobpl
term type wordwordword
wordword
source start,end 0,126,910,12
0,60,12
payload


Re: Validate Query Syntax of Solr Request Before Sending

2011-02-18 Thread csj

Hi,

FYI, I found out. I'm using the SolrQueryParser (tadaa...)

It needs the solrconfig.xml and the solr.xml files in other to validate the
query.

Then I'm able to validate any query before sending it to the Solrserver,
thereby preventing unnecessary requests.

/Christian
-- 
View this message in context: 
http://lucene.472066.n3.nabble.com/Validate-Query-Syntax-of-Solr-Request-Before-Sending-tp2515797p2528183.html
Sent from the Solr - User mailing list archive at Nabble.com.


Re: Validate Query Syntax of Solr Request Before Sending

2011-02-17 Thread Markus Jelsma
Uh, how about the LuceneQParser? It does some checks and can return 
appropriate error messages.

On Thursday 17 February 2011 06:44:16 csj wrote:
 Hi,
 
 I wonder if it is possible to let the user build up a Solr Query and have
 it validated by some java API before sending it to Solr.
 
 Is there a parser that could help with that? I would like to help the user
 building a valid query as she types by showing messages like The query is
 not valid or purhaps even more advanced: The parentheses are not
 balanced.
 
 Maybe one day it would also be possible to analyse the semantics of the
 query like: This query has a build-in inconsistency because the two dates
 you have specified requires documents to be before AND after these date.
 But this is far future...
 
 Regards,
 
 Christian Sonne Jensen

-- 
Markus Jelsma - CTO - Openindex
http://www.linkedin.com/in/markus17
050-8536620 / 06-50258350


very quick question that will help me greatly... OR query syntax when using fields for solr dataset....

2011-02-15 Thread Ravish Bhagdev
Hi Guys,

I've been trying various combinations but unable to perform a OR query for
a specific field in my solr schema.

I have a string field called myfield and I want to return all documents that
have this field which either matches abc or  xyz

So all records that have myfield=abc and all records that have myfield=xyz
should be returned (union)

What should my query be?  I have tried (myfield=abc OR myfield=xyz) which
works, but only returns all the documents that contain xyz in that field,
which I find quite weird. I have tried running this as fq query as well but
same result!

It is such a simple thing but I can't find right syntax after going through
a lot of documentation and searching.

Will appreciate any quick reply or examples, thanks very much.

Ravish


Re: very quick question that will help me greatly... OR query syntax when using fields for solr dataset....

2011-02-15 Thread Jan Høydahl
http://wiki.apache.org/solr/SolrQuerySyntax

Examples:
q=myfield:(xyz OR abc)

q={!lucene q.op=OR df=myfield}xyz abc

q=xyz OR abcdefType=edismaxqf=myfield

PS: If using type=string, you will not match individual words inside the 
field, only an exact case sensitive match of whole field. Use some variant of 
text if this is not what you want.

--
Jan Høydahl, search solution architect
Cominvent AS - www.cominvent.com

On 15. feb. 2011, at 14.39, Ravish Bhagdev wrote:

 Hi Guys,
 
 I've been trying various combinations but unable to perform a OR query for
 a specific field in my solr schema.
 
 I have a string field called myfield and I want to return all documents that
 have this field which either matches abc or  xyz
 
 So all records that have myfield=abc and all records that have myfield=xyz
 should be returned (union)
 
 What should my query be?  I have tried (myfield=abc OR myfield=xyz) which
 works, but only returns all the documents that contain xyz in that field,
 which I find quite weird. I have tried running this as fq query as well but
 same result!
 
 It is such a simple thing but I can't find right syntax after going through
 a lot of documentation and searching.
 
 Will appreciate any quick reply or examples, thanks very much.
 
 Ravish



Re: very quick question that will help me greatly... OR query syntax when using fields for solr dataset....

2011-02-15 Thread Ravish Bhagdev
Hi Jan,

Thanks for reply.

I have tried the first variation in your example (and again after reading
your reply).

It returns no results!

Note: it is not a multivalued field, I think when you use example 1 below,
it looks for both xyz and abc in same field for same document, what i'm
trying to get are all records that match either of the two.

I hope I am making sense.

Thanks,
Ravish

On Tue, Feb 15, 2011 at 1:47 PM, Jan Høydahl jan@cominvent.com wrote:

 http://wiki.apache.org/solr/SolrQuerySyntax

 Examples:
 q=myfield:(xyz OR abc)

 q={!lucene q.op=OR df=myfield}xyz abc

 q=xyz OR abcdefType=edismaxqf=myfield

 PS: If using type=string, you will not match individual words inside the
 field, only an exact case sensitive match of whole field. Use some variant
 of text if this is not what you want.

 --
 Jan Høydahl, search solution architect
 Cominvent AS - www.cominvent.com

 On 15. feb. 2011, at 14.39, Ravish Bhagdev wrote:

  Hi Guys,
 
  I've been trying various combinations but unable to perform a OR query
 for
  a specific field in my solr schema.
 
  I have a string field called myfield and I want to return all documents
 that
  have this field which either matches abc or  xyz
 
  So all records that have myfield=abc and all records that have
 myfield=xyz
  should be returned (union)
 
  What should my query be?  I have tried (myfield=abc OR myfield=xyz) which
  works, but only returns all the documents that contain xyz in that field,
  which I find quite weird. I have tried running this as fq query as well
 but
  same result!
 
  It is such a simple thing but I can't find right syntax after going
 through
  a lot of documentation and searching.
 
  Will appreciate any quick reply or examples, thanks very much.
 
  Ravish




Re: very quick question that will help me greatly... OR query syntax when using fields for solr dataset....

2011-02-15 Thread Jan Høydahl
The OR implies that all documents matching either one of the two terms shold be 
returned.

Are you sure you are searching with correct uppercase/lowercase, as string 
fields are case sensitive?

To further help you, we need copies of relevant sections of your schema and an 
exact copy of the query string you attempt to run, as well as proof that the 
documents exist.

--
Jan Høydahl, search solution architect
Cominvent AS - www.cominvent.com

On 15. feb. 2011, at 14.54, Ravish Bhagdev wrote:

 Hi Jan,
 
 Thanks for reply.
 
 I have tried the first variation in your example (and again after reading
 your reply).
 
 It returns no results!
 
 Note: it is not a multivalued field, I think when you use example 1 below,
 it looks for both xyz and abc in same field for same document, what i'm
 trying to get are all records that match either of the two.
 
 I hope I am making sense.
 
 Thanks,
 Ravish
 
 On Tue, Feb 15, 2011 at 1:47 PM, Jan Høydahl jan@cominvent.com wrote:
 
 http://wiki.apache.org/solr/SolrQuerySyntax
 
 Examples:
 q=myfield:(xyz OR abc)
 
 q={!lucene q.op=OR df=myfield}xyz abc
 
 q=xyz OR abcdefType=edismaxqf=myfield
 
 PS: If using type=string, you will not match individual words inside the
 field, only an exact case sensitive match of whole field. Use some variant
 of text if this is not what you want.
 
 --
 Jan Høydahl, search solution architect
 Cominvent AS - www.cominvent.com
 
 On 15. feb. 2011, at 14.39, Ravish Bhagdev wrote:
 
 Hi Guys,
 
 I've been trying various combinations but unable to perform a OR query
 for
 a specific field in my solr schema.
 
 I have a string field called myfield and I want to return all documents
 that
 have this field which either matches abc or  xyz
 
 So all records that have myfield=abc and all records that have
 myfield=xyz
 should be returned (union)
 
 What should my query be?  I have tried (myfield=abc OR myfield=xyz) which
 works, but only returns all the documents that contain xyz in that field,
 which I find quite weird. I have tried running this as fq query as well
 but
 same result!
 
 It is such a simple thing but I can't find right syntax after going
 through
 a lot of documentation and searching.
 
 Will appreciate any quick reply or examples, thanks very much.
 
 Ravish
 
 



Re: very quick question that will help me greatly... OR query syntax when using fields for solr dataset....

2011-02-15 Thread Ravish Bhagdev
Arghhh..

I think its the regexp parser messing things up (just looked at the
debugQuery ouput and its parsing incorrectly some / kind of letters I had.

I think I can clean up the data off these characters or maybe there is  a
way to escape them...

Ravish

On Tue, Feb 15, 2011 at 1:54 PM, Ravish Bhagdev ravish.bhag...@gmail.comwrote:

 Hi Jan,

 Thanks for reply.

 I have tried the first variation in your example (and again after reading
 your reply).

 It returns no results!

 Note: it is not a multivalued field, I think when you use example 1 below,
 it looks for both xyz and abc in same field for same document, what i'm
 trying to get are all records that match either of the two.

 I hope I am making sense.

 Thanks,
 Ravish


 On Tue, Feb 15, 2011 at 1:47 PM, Jan Høydahl jan@cominvent.comwrote:

 http://wiki.apache.org/solr/SolrQuerySyntax

 Examples:
 q=myfield:(xyz OR abc)

 q={!lucene q.op=OR df=myfield}xyz abc

 q=xyz OR abcdefType=edismaxqf=myfield

 PS: If using type=string, you will not match individual words inside the
 field, only an exact case sensitive match of whole field. Use some variant
 of text if this is not what you want.

 --
 Jan Høydahl, search solution architect
 Cominvent AS - www.cominvent.com

 On 15. feb. 2011, at 14.39, Ravish Bhagdev wrote:

  Hi Guys,
 
  I've been trying various combinations but unable to perform a OR query
 for
  a specific field in my solr schema.
 
  I have a string field called myfield and I want to return all documents
 that
  have this field which either matches abc or  xyz
 
  So all records that have myfield=abc and all records that have
 myfield=xyz
  should be returned (union)
 
  What should my query be?  I have tried (myfield=abc OR myfield=xyz)
 which
  works, but only returns all the documents that contain xyz in that
 field,
  which I find quite weird. I have tried running this as fq query as well
 but
  same result!
 
  It is such a simple thing but I can't find right syntax after going
 through
  a lot of documentation and searching.
 
  Will appreciate any quick reply or examples, thanks very much.
 
  Ravish





Re: very quick question that will help me greatly... OR query syntax when using fields for solr dataset....

2011-02-15 Thread Erick Erickson
You might look at the analysis page from the admin console for the
field in question, it'll show you what various parts of the analysis chain
do.

But I agree with Jan, having your field as a string type is a red flag. This
field is NOT analyzed, parsed, or filtered. For instance, if a doc has
a value for the field of: [My life], only [My life] will match. Not [my], not
[life], not even [my life] (ignore all brackets, but quotes are often confused
with phrases).

It may well be that this is the exact behavior you want, but this is often
a point of confusion.

Best
Erick

On Tue, Feb 15, 2011 at 9:00 AM, Ravish Bhagdev
ravish.bhag...@gmail.com wrote:
 Arghhh..

 I think its the regexp parser messing things up (just looked at the
 debugQuery ouput and its parsing incorrectly some / kind of letters I had.

 I think I can clean up the data off these characters or maybe there is  a
 way to escape them...

 Ravish

 On Tue, Feb 15, 2011 at 1:54 PM, Ravish Bhagdev 
 ravish.bhag...@gmail.comwrote:

 Hi Jan,

 Thanks for reply.

 I have tried the first variation in your example (and again after reading
 your reply).

 It returns no results!

 Note: it is not a multivalued field, I think when you use example 1 below,
 it looks for both xyz and abc in same field for same document, what i'm
 trying to get are all records that match either of the two.

 I hope I am making sense.

 Thanks,
 Ravish


 On Tue, Feb 15, 2011 at 1:47 PM, Jan Høydahl jan@cominvent.comwrote:

 http://wiki.apache.org/solr/SolrQuerySyntax

 Examples:
 q=myfield:(xyz OR abc)

 q={!lucene q.op=OR df=myfield}xyz abc

 q=xyz OR abcdefType=edismaxqf=myfield

 PS: If using type=string, you will not match individual words inside the
 field, only an exact case sensitive match of whole field. Use some variant
 of text if this is not what you want.

 --
 Jan Høydahl, search solution architect
 Cominvent AS - www.cominvent.com

 On 15. feb. 2011, at 14.39, Ravish Bhagdev wrote:

  Hi Guys,
 
  I've been trying various combinations but unable to perform a OR query
 for
  a specific field in my solr schema.
 
  I have a string field called myfield and I want to return all documents
 that
  have this field which either matches abc or  xyz
 
  So all records that have myfield=abc and all records that have
 myfield=xyz
  should be returned (union)
 
  What should my query be?  I have tried (myfield=abc OR myfield=xyz)
 which
  works, but only returns all the documents that contain xyz in that
 field,
  which I find quite weird. I have tried running this as fq query as well
 but
  same result!
 
  It is such a simple thing but I can't find right syntax after going
 through
  a lot of documentation and searching.
 
  Will appreciate any quick reply or examples, thanks very much.
 
  Ravish






Re: very quick question that will help me greatly... OR query syntax when using fields for solr dataset....

2011-02-15 Thread Ravish Bhagdev
Hi Erick,

I've managed to fix the problem, it was to do with not encoding certain
characters.  Escaped with \ and it all works fine now :) .  Sorry I was just
being insane, look at debugQuery output helped.

I know about the string field, this is kind of a uuid field that I am
storing, so it it desired that it always be exact match, so I am being
careful about why I chose that type.

I am going to start looking at all that is available as Analyzer soon,
something that does string distance match would be cool

Ravish

On Tue, Feb 15, 2011 at 2:30 PM, Erick Erickson erickerick...@gmail.comwrote:

 You might look at the analysis page from the admin console for the
 field in question, it'll show you what various parts of the analysis chain
 do.

 But I agree with Jan, having your field as a string type is a red flag.
 This
 field is NOT analyzed, parsed, or filtered. For instance, if a doc has
 a value for the field of: [My life], only [My life] will match. Not [my],
 not
 [life], not even [my life] (ignore all brackets, but quotes are often
 confused
 with phrases).

 It may well be that this is the exact behavior you want, but this is often
 a point of confusion.

 Best
 Erick

 On Tue, Feb 15, 2011 at 9:00 AM, Ravish Bhagdev
 ravish.bhag...@gmail.com wrote:
  Arghhh..
 
  I think its the regexp parser messing things up (just looked at the
  debugQuery ouput and its parsing incorrectly some / kind of letters I
 had.
 
  I think I can clean up the data off these characters or maybe there is  a
  way to escape them...
 
  Ravish
 
  On Tue, Feb 15, 2011 at 1:54 PM, Ravish Bhagdev 
 ravish.bhag...@gmail.comwrote:
 
  Hi Jan,
 
  Thanks for reply.
 
  I have tried the first variation in your example (and again after
 reading
  your reply).
 
  It returns no results!
 
  Note: it is not a multivalued field, I think when you use example 1
 below,
  it looks for both xyz and abc in same field for same document, what i'm
  trying to get are all records that match either of the two.
 
  I hope I am making sense.
 
  Thanks,
  Ravish
 
 
  On Tue, Feb 15, 2011 at 1:47 PM, Jan Høydahl jan@cominvent.com
 wrote:
 
  http://wiki.apache.org/solr/SolrQuerySyntax
 
  Examples:
  q=myfield:(xyz OR abc)
 
  q={!lucene q.op=OR df=myfield}xyz abc
 
  q=xyz OR abcdefType=edismaxqf=myfield
 
  PS: If using type=string, you will not match individual words inside
 the
  field, only an exact case sensitive match of whole field. Use some
 variant
  of text if this is not what you want.
 
  --
  Jan Høydahl, search solution architect
  Cominvent AS - www.cominvent.com
 
  On 15. feb. 2011, at 14.39, Ravish Bhagdev wrote:
 
   Hi Guys,
  
   I've been trying various combinations but unable to perform a OR
 query
  for
   a specific field in my solr schema.
  
   I have a string field called myfield and I want to return all
 documents
  that
   have this field which either matches abc or  xyz
  
   So all records that have myfield=abc and all records that have
  myfield=xyz
   should be returned (union)
  
   What should my query be?  I have tried (myfield=abc OR myfield=xyz)
  which
   works, but only returns all the documents that contain xyz in that
  field,
   which I find quite weird. I have tried running this as fq query as
 well
  but
   same result!
  
   It is such a simple thing but I can't find right syntax after going
  through
   a lot of documentation and searching.
  
   Will appreciate any quick reply or examples, thanks very much.
  
   Ravish
 
 
 
 



Re: Function Query Syntax?

2010-12-29 Thread Ahmet Arslan
 We have documents which are comprised
 of:
 
     - A short list of terms (about 1 to 5 terms
 per document)
     - An estimate of the probability of the terms
 occurrence (stored as tint)
 
 For each term in the index, we would like to get the result
 of the following function:
 
     (our estimate of the probability/100) x (a
 term's Document Frequency)
 
 So if the term fox occurred in 7 documents, the desired
 query result would look something like:
 
 doc
 str name=termfox/str
 str name=DF7/str
 int name=probability23/int
 str name=functionResult1.61/str
 /doc
 
 We can find a number of examples for using function queries
 to alter scoring or sorting results, but can not find any
 that show how to get the value of actual function result
 back.


It seems that your requirement is not related to function queries. You are 
interested something that is term level rather than document level.

Anyway with http://wiki.apache.org/solr/TermsComponent you can iterate through 
all terms and it gives you DF information. You can multiple that DF with 
pre-computed (term level) probability. To get all terms use -1 as limit. e.g. = 
terms.limit=-1





Nested Function Query Syntax

2010-07-15 Thread Rodrigo Rezende
Hello,

I am trying to use function nested query syntax with solr 1.4.1, but I
am not sure if I am doing in right way:

I try this query and I get all documents which score is 12

http://localhost:8983/solr/articles.0/select/?q={!func}product(3,4)fl=Document.title,score,debugQuery=on

Using the same syntax, for nested query, I get an error

http://localhost:8983/solr/articles.0/select/?q={!func}query(hello)fl=Document.title,score,debugQuery=on

org.apache.lucene.queryParser.ParseException: Nested function query
must use $param or {!v=value} forms. got 'query(hello)'

Thanks,

Rodrigo.


Re: Nested Function Query Syntax

2010-07-15 Thread Rodrigo Rezende
I solved the problem.
The correct syntax is:

http://localhost:8983/solr/articles.0/select/?q={!func}query({!query
v='hello'})fl=Document.title,score,debugQuery=on

Rodrigo




On Thu, Jul 15, 2010 at 12:32 PM, Rodrigo Rezende rcreze...@gmail.com wrote:
 Hello,

 I am trying to use function nested query syntax with solr 1.4.1, but I
 am not sure if I am doing in right way:

 I try this query and I get all documents which score is 12

 http://localhost:8983/solr/articles.0/select/?q={!func}product(3,4)fl=Document.title,score,debugQuery=on

 Using the same syntax, for nested query, I get an error

 http://localhost:8983/solr/articles.0/select/?q={!func}query(hello)fl=Document.title,score,debugQuery=on

 org.apache.lucene.queryParser.ParseException: Nested function query
 must use $param or {!v=value} forms. got 'query(hello)'

 Thanks,

 Rodrigo.



Re: Nested Function Query Syntax

2010-07-15 Thread Yonik Seeley
On Thu, Jul 15, 2010 at 11:51 AM, Rodrigo Rezende rcreze...@gmail.com wrote:
 I solved the problem.
 The correct syntax is:

 http://localhost:8983/solr/articles.0/select/?q={!func}query({!query
 v='hello'})fl=Document.title,score,debugQuery=on

query() causes a new QParser to be created.  so does {!query}... so
using both is redundant.
If you want an embedded lucene query, then you could do

query({!lucene v='hello'})
  OR
query({!lucene v=$qq})qq=hello
  OR, since lucene is the default query type
query($qq)qq=hello

-Yonik
http://www.lucidimagination.com


Re: Nested Function Query Syntax

2010-07-15 Thread Rodrigo Rezende
Yeah, it is redundant, but I am using that to use the solr query
response as input of a plugin function:

http://localhost:8983/solr/articles.0/select/?q={!func}myFunction(query({!query
v='the query string here'}))

So in myFunction I can take the query results, with the score, and
write my custom sort/re-scorer.

Is that the best way?


On Thu, Jul 15, 2010 at 1:16 PM, Yonik Seeley
yo...@lucidimagination.com wrote:
 On Thu, Jul 15, 2010 at 11:51 AM, Rodrigo Rezende rcreze...@gmail.com wrote:
 I solved the problem.
 The correct syntax is:

 http://localhost:8983/solr/articles.0/select/?q={!func}query({!query
 v='hello'})fl=Document.title,score,debugQuery=on

 query() causes a new QParser to be created.  so does {!query}... so
 using both is redundant.
 If you want an embedded lucene query, then you could do

 query({!lucene v='hello'})
  OR
 query({!lucene v=$qq})    qq=hello
  OR, since lucene is the default query type
 query($qq)    qq=hello

 -Yonik
 http://www.lucidimagination.com



Re: Nested Function Query Syntax

2010-07-15 Thread Yonik Seeley
On Thu, Jul 15, 2010 at 12:49 PM, Rodrigo Rezende rcreze...@gmail.com wrote:
 Yeah, it is redundant, but I am using that to use the solr query
 response as input of a plugin function:

 http://localhost:8983/solr/articles.0/select/?q={!func}myFunction(query({!query
 v='the query string here'}))

This might be easier (requires no escaping of  the query string):
http://localhost:8983/solr/articles.0/select/?q={!func}myFunction(query($qq))qq=the
query string here

-Yonik
http://www.lucidimagination.com


Re: Nested Function Query Syntax

2010-07-15 Thread Rodrigo Rezende
Thank you, that works fine!

On Thu, Jul 15, 2010 at 2:01 PM, Yonik Seeley
yo...@lucidimagination.com wrote:
 On Thu, Jul 15, 2010 at 12:49 PM, Rodrigo Rezende rcreze...@gmail.com wrote:
 Yeah, it is redundant, but I am using that to use the solr query
 response as input of a plugin function:

 http://localhost:8983/solr/articles.0/select/?q={!func}myFunction(query({!query
 v='the query string here'}))

 This might be easier (requires no escaping of  the query string):
 http://localhost:8983/solr/articles.0/select/?q={!func}myFunction(query($qq))qq=the
 query string here

 -Yonik
 http://www.lucidimagination.com



Re: Help me understand query syntax of subqueries

2010-06-01 Thread Chris Hostetter

: Any idea why this query returns 0 records:
: sexual assault AND (-obama)
: while this one returns 1400 ?
: sexual assault AND -(obama)

in the first one, the parans create a boolean query consisting of a single 
negated clause -- but pure negative boolean queries (ie: boolean queries 
were every clause is negated) by definition can't match anything -- and 
then you say in your outermost query that that boolean query (that matches 
nothing) must match (because it's part of an AND)  this is expalined in 
your debugging info...

: sexual assault AND (-obama), translates to:  +text:sexual assault
: +(-text:obama), returns 0 records

In the second query, the negation applies to the entire boolean query 
-- since it contains one positive clause it's optimized away, also visible 
in your debugging info...

: sexual assault AND -(obama), translates to:  +text:sexual assault
: -text:obama, returns 1400 records


: (-obama), translates to: -text:obama, returns 716295 records
: -(obama), translates to: -text:obama, returns 716295 records

...this is because at the top level Solr does allow pure negative 
queries by inverting the search for you -- but it can't do that for sub 
queries.


-Hoss



Help me understand query syntax of subqueries

2010-05-25 Thread Tigi Scramble
Any idea why this query returns 0 records:
sexual assault AND (-obama)
while this one returns 1400 ?
sexual assault AND -(obama)


Some debug info:

sexual assault AND (-obama), translates to:  +text:sexual assault
+(-text:obama), returns 0 records

sexual assault AND -(obama), translates to:  +text:sexual assault
-text:obama, returns 1400 records

sexual assault AND obama,translates to:  +text:sexual assault
+text:obama, return 53 records

(-obama), translates to: -text:obama, returns 716295 records
-(obama), translates to: -text:obama, returns 716295 records


I am using Solr 1.4
qt:standard
QParser:LuceneQParser

Thanks,
Mis


Re: dismax query syntax to replace standard query

2009-12-04 Thread javaxmlsoapdev

Thanks. When I do it that way it gives me following query.

params={indent=onstart=0q=risk+testqt=dismaxfq=statusName:(Male+OR+Female)+name:Joehl=onrows=10version=2.2}
hits=63 status=0 QTime=54 

I typed in 'Risk test' (no quote in the text) in the text field in UI. I
want search to do AND between statusName and name attributes (all
attributes in fq param).  

Following is my dismax configuration in solrconfig.xml
requestHandler name=dismax class=solr.SearchHandler 
lst name=defaults
 str name=defTypedismax/str
 str name=echoParamsexplicit/str
 float name=tie0.01/float
 str name=qf
title^2 description
 /str
 str name=pf
title description
 /str
 str name=mm
2lt;-1 5lt;-2 6lt;90%
 /str
 int name=ps100/int
 str name=q.alt*:*/str
 str name=hl.fltitle description/str
 str name=f.name.hl.fragsize10/str
 str name=f.name.hl.alternateFieldtitle/str
 str name=f.text.hl.fragmenterregex/str
/lst
  /requestHandler

And schema.xml has
defaultSearchFieldtitle/defaultSearchField
solrQueryParser defaultOperator=OR/ -- when I change this to AND it does
AND all params in fq and also does ANDing between words in the text field
e.g. risk+test and doesn't return me results. 

basically I want to do ORing between words in q list and ANDing between
params in fq list.

Any pointers would be appreciated.

Thanks,


isugar wrote:
 
 I believe you need to use the fq parameter with dismax (not to be confused
 with qf) to add a filter query in addition to the q parameter.
 
 So your text search value goes in q parameter (which searches on the
 fields
 you configure) and the rest of the query goes in the fq.
 
 Would that work?
 
 On Thu, Dec 3, 2009 at 7:28 PM, javaxmlsoapdev vika...@yahoo.com wrote:
 

 I have configured dismax handler to search against both title 
 description fields now I have some other attributes on the page e.g.
 status, name etc. On the search page I have three fields for user to
 input search values

 1)Free text search field (which searchs against both title 
 description)
 2)Status (multi select dropdown)
 3)name(single select dropdown)

 I want to form query like textField1:value AND status:(Male OR Female)
 AND
 name:abc. I know first (textField1:value searchs against both title 
 description as that's how I have configured dixmax in the
 configuration)
 but not sure how I can AND other attributes (in my case status 
 name)

 note; standadquery looks like following (w/o using dixmax handler)
 title:testdescription:testname:JoestatusName:(Male OR Female)
 --
 View this message in context:
 http://old.nabble.com/dismax-query-syntax-to-replace-standard-query-tp26631725p26631725.html
 Sent from the Solr - User mailing list archive at Nabble.com.


 
 

-- 
View this message in context: 
http://old.nabble.com/dismax-query-syntax-to-replace-standard-query-tp26631725p26635928.html
Sent from the Solr - User mailing list archive at Nabble.com.



Re: dismax query syntax to replace standard query

2009-12-03 Thread Ian Sugar
I believe you need to use the fq parameter with dismax (not to be confused
with qf) to add a filter query in addition to the q parameter.

So your text search value goes in q parameter (which searches on the fields
you configure) and the rest of the query goes in the fq.

Would that work?

On Thu, Dec 3, 2009 at 7:28 PM, javaxmlsoapdev vika...@yahoo.com wrote:


 I have configured dismax handler to search against both title 
 description fields now I have some other attributes on the page e.g.
 status, name etc. On the search page I have three fields for user to
 input search values

 1)Free text search field (which searchs against both title 
 description)
 2)Status (multi select dropdown)
 3)name(single select dropdown)

 I want to form query like textField1:value AND status:(Male OR Female) AND
 name:abc. I know first (textField1:value searchs against both title 
 description as that's how I have configured dixmax in the configuration)
 but not sure how I can AND other attributes (in my case status  name)

 note; standadquery looks like following (w/o using dixmax handler)
 title:testdescription:testname:JoestatusName:(Male OR Female)
 --
 View this message in context:
 http://old.nabble.com/dismax-query-syntax-to-replace-standard-query-tp26631725p26631725.html
 Sent from the Solr - User mailing list archive at Nabble.com.




Re: dismax query syntax to replace standard query

2009-12-03 Thread Yonik Seeley
For more complex queries (including full well-formed lucene queries),
there's the newly committed extended dismax parser in 1.5-dev (trunk)
http://issues.apache.org/jira/browse/SOLR-1553

-Yonik
http://www.lucidimagination.com



On Thu, Dec 3, 2009 at 4:14 PM, Ian Sugar iansu...@gmail.com wrote:
 I believe you need to use the fq parameter with dismax (not to be confused
 with qf) to add a filter query in addition to the q parameter.

 So your text search value goes in q parameter (which searches on the fields
 you configure) and the rest of the query goes in the fq.

 Would that work?

 On Thu, Dec 3, 2009 at 7:28 PM, javaxmlsoapdev vika...@yahoo.com wrote:


 I have configured dismax handler to search against both title 
 description fields now I have some other attributes on the page e.g.
 status, name etc. On the search page I have three fields for user to
 input search values

 1)Free text search field (which searchs against both title 
 description)
 2)Status (multi select dropdown)
 3)name(single select dropdown)

 I want to form query like textField1:value AND status:(Male OR Female) AND
 name:abc. I know first (textField1:value searchs against both title 
 description as that's how I have configured dixmax in the configuration)
 but not sure how I can AND other attributes (in my case status  name)

 note; standadquery looks like following (w/o using dixmax handler)
 title:testdescription:testname:JoestatusName:(Male OR Female)
 --
 View this message in context:
 http://old.nabble.com/dismax-query-syntax-to-replace-standard-query-tp26631725p26631725.html
 Sent from the Solr - User mailing list archive at Nabble.com.





How to use Lucene Query Syntax in Solr

2009-06-10 Thread chem leakhina
Hi

Could you please tell me about how to use Lucene Query Syntax in Solr?
My query example is that, I want to use wild card (*) with phrase.

For example:

I have field *text* and I want to search like *text:Cam* Yel** to match
with Cambodia Yellow or like *text:Cambodia yel**

Please help to give me detail examples because I am very new with Luene and
Solr.

Best regards,
Lee


Re: How to use Lucene Query Syntax in Solr

2009-06-10 Thread Yonik Seeley
On Thu, Jun 11, 2009 at 12:31 AM, chem leakhinachem.leakh...@gmail.com wrote:
 Could you please tell me about how to use Lucene Query Syntax in Solr?
 My query example is that, I want to use wild card (*) with phrase.

Solr supports the full Lucene QueryParser syntax, but wildcards in
phrase queries isn't supported in either.

-Yonik
http://www.lucidimagination.com


what is the query syntax to search a value in more than one field.

2009-05-06 Thread Radha C.
Hi,
 
I need to search a text value in field A, field B, and field C. Can anybody
tel me how to form the query. 
 
I am thinking of the option like q=A:text AND B:text AND C:text . Is it
correct ?
 
Thanks in advance.


Re: what is the query syntax to search a value in more than one field.

2009-05-06 Thread Avlesh Singh
Query for text to be present in all the fields:
q=(+A:text +B:text +C:text)

Query for text to be present in any of the fields:
q=(A:text B:text C:text)

Cheers
Avlesh

On Wed, May 6, 2009 at 4:43 PM, Radha C. cra...@ceiindia.com wrote:

 Hi,

 I need to search a text value in field A, field B, and field C. Can anybody
 tel me how to form the query.

 I am thinking of the option like q=A:text AND B:text AND C:text . Is it
 correct ?

 Thanks in advance.



RE: what is the query syntax to search a value in more than one field.

2009-05-06 Thread Radha C.
Thanks much Avlesh .

  _  

From: Avlesh Singh [mailto:avl...@gmail.com] 
Sent: Wednesday, May 06, 2009 5:01 PM
To: solr-user@lucene.apache.org; cra...@ceiindia.com
Subject: Re: what is the query syntax to search a value in more than one
field.


Query for text to be present in all the fields:
q=(+A:text +B:text +C:text)

Query for text to be present in any of the fields:
q=(A:text B:text C:text)

Cheers
Avlesh


On Wed, May 6, 2009 at 4:43 PM, Radha C. cra...@ceiindia.com wrote:


Hi,

I need to search a text value in field A, field B, and field C. Can anybody
tel me how to form the query.

I am thinking of the option like q=A:text AND B:text AND C:text . Is it
correct ?

Thanks in advance.





Re: OR/NOT query syntax

2009-03-12 Thread Jonathan Haddad
I might be wrong on this, but since you can't do a query that's just a
NOT statement, this wouldn't work either.  I believe the NOT must
negate results of a query, not the entire dataset.

On Wed, Mar 11, 2009 at 6:56 PM, Andrew Wall rew...@gmail.com wrote:
 I'm attempting to write a solr query that ensures that if one field has a
 particular value that another field also have a particular value.   I've
 arrived at this syntax, but it doesn't seem to work correctly.

 ((myField:superneat AND myOtherField:somethingElse) OR NOT myField:superneat)

 either operand functions correctly on its own - but not when joined together
 with the or not condition.  I don't understand why this syntax doesn't
 work - can someone shed some light on this?

 Thanks!
 Andrew Wall




-- 
Jonathan Haddad
http://www.rustyrazorblade.com


Re: OR/NOT query syntax

2009-03-12 Thread Yonik Seeley
On Wed, Mar 11, 2009 at 9:56 PM, Andrew Wall rew...@gmail.com wrote:
 I'm attempting to write a solr query that ensures that if one field has a
 particular value that another field also have a particular value. I've
 arrived at this syntax, but it doesn't seem to work correctly.

 ((myField:superneat AND myOtherField:somethingElse) OR NOT myField:superneat)

Try
(myField:superneat AND myOtherField:somethingElse) OR (*:* -myField:superneat)

-Yonik
http://www.lucidimagination.com


OR/NOT query syntax

2009-03-11 Thread Andrew Wall
I'm attempting to write a solr query that ensures that if one field has a
particular value that another field also have a particular value.   I've
arrived at this syntax, but it doesn't seem to work correctly.

((myField:superneat AND myOtherField:somethingElse) OR NOT myField:superneat)

either operand functions correctly on its own - but not when joined together
with the or not condition.  I don't understand why this syntax doesn't
work - can someone shed some light on this?

Thanks!
Andrew Wall


[solr-user] Correct query syntax for a multivalued string field?

2008-09-09 Thread hernan
Hey Solr users,

My schema defines a field like this:

field name=color type=string indexed=true required=true
multiValued=true/

If I have a document indexed that has the following values for this
field:  ['red','green']
...how do I write a query that says: I want all documents that have
color = 'red' AND color = 'green'?

When I try:

q=color:red+AND+green

I get zero documents back.  I've searched the Solr and Lucene docs and
I can't find the right syntax although I have a hunch that this is a
common query pattern.

Please let me know if you've encountered this before and have a solution.

thanks!
hs


Re: [solr-user] Correct query syntax for a multivalued string field?

2008-09-09 Thread Walter Underwood
color:red AND color:green

+color:red +color:green

Either one works.

wunder

On 9/9/08 3:47 PM, hernan [EMAIL PROTECTED] wrote:

 Hey Solr users,
 
 My schema defines a field like this:
 
 field name=color type=string indexed=true required=true
 multiValued=true/
 
 If I have a document indexed that has the following values for this
 field:  ['red','green']
 ...how do I write a query that says: I want all documents that have
 color = 'red' AND color = 'green'?
 
 When I try:
 
 q=color:red+AND+green
 
 I get zero documents back.  I've searched the Solr and Lucene docs and
 I can't find the right syntax although I have a hunch that this is a
 common query pattern.
 
 Please let me know if you've encountered this before and have a solution.
 
 thanks!
 hs



Re: [solr-user] Correct query syntax for a multivalued string field?

2008-09-09 Thread hernan
On Tue, Sep 9, 2008 at 3:50 PM, Walter Underwood [EMAIL PROTECTED] wrote:
 color:red AND color:green

 +color:red +color:green

 Either one works.

Just what I was looking for, thanks for the quick response and for
helping a new user.
hs

 wunder

 On 9/9/08 3:47 PM, hernan [EMAIL PROTECTED] wrote:

 Hey Solr users,

 My schema defines a field like this:

 field name=color type=string indexed=true required=true
 multiValued=true/

 If I have a document indexed that has the following values for this
 field:  ['red','green']
 ...how do I write a query that says: I want all documents that have
 color = 'red' AND color = 'green'?

 When I try:

 q=color:red+AND+green

 I get zero documents back.  I've searched the Solr and Lucene docs and
 I can't find the right syntax although I have a hunch that this is a
 common query pattern.

 Please let me know if you've encountered this before and have a solution.

 thanks!
 hs




Re: solr query syntax

2008-06-06 Thread Otis Gospodnetic
Hi Cam,

Unless I'm misunderstanding your question, you should be able to do that pretty 
just like you typed it.
If you enter that on Solr /admin page, do you get an error or do you not get 
the desired results?  If you add debugQuery=true to the URL, you will see what 
query is getting executed.


Otis
--
Sematext -- http://sematext.com/ -- Lucene - Solr - Nutch


- Original Message 
 From: Cam Bazz [EMAIL PROTECTED]
 To: solr-user@lucene.apache.org
 Sent: Thursday, June 5, 2008 4:14:30 PM
 Subject: solr query syntax
 
 Hello,
 
 how can we specify in query so it will just bring certain field and query in
 the default field?
 
 for example can I do a
 
 year:1998 AND searchword
 
 Best Regards,
 -C.B.



Re: new user: some questions about parameters and query syntax

2008-06-05 Thread Bram de Jong
 we can start having more explict structured info
 about all of the concepts that are really core to how a param works (ie:
 name, datatype, is it multivalued, can it be overridden per field, what
 is/are the value(s) used for).

 defaults as well, please

Structured information per parameter will be AWESOME.

 - Bram


Re: new user: some questions about parameters and query syntax

2008-06-04 Thread Chris Hostetter

: I dunno...  for something like fl, it still seems a bit verbose to
: list every field separately.
: Some of these things feel like trade offs in ease of readability 
: manually typing of URLs vs ease of programmatic manipulation.

I don't even think the primary issue is programmatic manipulation ... it's 
ease of readability and manual typing vs a need for external mapping of 
internal field names to external field labels.  even the simplest use 
cases of Solr almost allways need some external mapping from field labels 
they display to end users and field names that are used in the schema ... 
it would be really nice if that wasn't actually neccessary.

just making fl a multivalued field wouldn't get you far enough obviously, 
you'd also need some aliasing mechanism to deal with field names 
for sorting vs field names for quering, and in many cases you have to 
worry about whether your field names contain characters the 
standard QueryParser considers special (like whitespace) but it would 
certainly be nice to say...
  q=*:*fl=Product+Idfl=Product+Namefl=Sales+Price





-Hoss



Re: new user: some questions about parameters and query syntax

2008-06-02 Thread Bram de Jong
On Sat, May 31, 2008 at 7:03 AM, Chris Hostetter
[EMAIL PROTECTED] wrote:

 : For date faceting, count missing the order doesn't matter either, and
 : there it's given as a comma-separated list.

 Either you are mistaken, or i don't understand your statement.  date
 faceting works just like field faceting -- no comma seperated lists.

http://wiki.apache.org/solr/SimpleFacetParameters#head-aaf1cd9feb4cbaa5a156e318a469eb023574e7f4

Now I'm doubting as well: this doesn't say comma separated list

 I'm adamantly opposed to adding any new params that have special
 splitting rules -- it imposes arbitrary and unneccessarsy limitations on
 the values thta you can pass to those params (unless you also have some
 escaping mechanism for the split character, but that just gets messy).
 x-url-form-encoding supports multivalued params for a reason.

I wasn't saying that this is very important, I was just poitning out
that for a newbie, there is a certain confusion when it comes to one
thing with comma a separated list, the other can have multiple
values. This could also be solved perfectly in the wiki (i.e. making
it very clear multiple GET params with the same name can be used, or
if a comma-separated list should be used).

 The only reason *any* existing solr params use comma or white space
snip

Hehe, thanks for the historical background. Always cool to read :)

 - bram

-- 
http://freesound.iua.upf.edu
http://www.smartelectronix.com
http://www.musicdsp.org


Re: new user: some questions about parameters and query syntax

2008-05-30 Thread Otis Gospodnetic
Right, the only actively developed Solr client is really Solrj.  All other ones 
are not well maintained - I don't recall seeing any patches for any of them in 
the recent months.  In other words, if your Python client offers everything 
(and more) that the reptile client in Solr's repo offers, that smells like a 
potential contribution, should you feel like it.

 Otis
--
Sematext -- http://sematext.com/ -- Lucene - Solr - Nutch


- Original Message 
 From: Bram de Jong [EMAIL PROTECTED]
 To: solr-user@lucene.apache.org
 Sent: Thursday, May 29, 2008 8:22:09 PM
 Subject: Re: new user: some questions about parameters and query syntax
 
 On Thu, May 29, 2008 at 6:40 PM, Otis Gospodnetic
 wrote:
  I haven't been paying close attention to the uniformity of URL parameters, 
  but 
 if there is room for making them more uniform
  (e.g. always use singular, always use comma as a delimiting character, 
  etc.) 
 without hurting anything, I'm for it.
 
 As far as my opinion goes, I would always take
 comma-or-space-separated fields for all things that can have multiple
 inputs.
 
  As for pysolr - I had a quick look the other day and saw last activity was 
  in 
 March and there was no release.  Perhaps Jacob
  would like to simply contribute his time and skills to Solr's existing 
  python 
 client?  Feel free to make that suggestion to Jacob.
 
 I've taken most of the pysolr code (in google code), and
 mergerd/embedded it into the one I made,
 making some simplifications and some nice additions. It now allows for
 using your own decoder (for returned JSON)
 and encoder (for adding documents of your type)
 
 http://iua-share.upf.edu/svn/nightingale/trunk/sandbox/solr/solrquery.py
 
 I've contacted both Jacob and Joseph to see if we can join forces...
 I personally have no problem whatsoever with donating my code to Solr
 (and adapting the license to the apache license to fit).
 To be honest the solr.py client in the Solr repository is a bit...
 unpythonic as they say.
 
 Not only that, but -for example- you can't do multi-field faceting
 with it as it is!
 
 
 - Bram



Re: new user: some questions about parameters and query syntax

2008-05-30 Thread Erik Hatcher


On May 30, 2008, at 2:40 AM, Otis Gospodnetic wrote:
Right, the only actively developed Solr client is really Solrj.   
All other ones are not well maintained - I don't recall seeing any  
patches for any of them in the recent months


Ummm solr-ruby!   It doesn't need any patches ;)   It's up to  
date with trunk Solr, works really nicely, and has near 100% test  
code coverage.


Erik



Re: new user: some questions about parameters and query syntax

2008-05-30 Thread Mike Klaas


On 29-May-08, at 11:22 AM, Bram de Jong wrote:


On Thu, May 29, 2008 at 6:40 PM, Otis Gospodnetic
[EMAIL PROTECTED] wrote:
I haven't been paying close attention to the uniformity of URL  
parameters, but if there is room for making them more uniform
(e.g. always use singular, always use comma as a delimiting  
character, etc.) without hurting anything, I'm for it.


As far as my opinion goes, I would always take
comma-or-space-separated fields for all things that can have multiple
inputs.


We've been moving away from comma/space separate lists to multiple  
request params.  It find it much nicer to deal with, especially when  
the entities are rather independent (fq, bq, etc).


Don't miss the do_seq parameter of urllib.urlencode.

-Mike


Re: new user: some questions about parameters and query syntax

2008-05-30 Thread Chris Hostetter

: For date faceting, count missing the order doesn't matter either, and
: there it's given as a comma-separated list.

Either you are mistaken, or i don't understand your statement.  date 
faceting works just like field faceting -- no comma seperated lists.

: I think it makes sense doing everything in comma (or space) separated
: lists, it's also more compatible with
: other programming languages:
: in many languages you can represent the GET variables as a dictionary,

just about every (usable) langauge allows you to have lists as the value 
of a map (aka: dictionary).

I'm adamantly opposed to adding any new params that have special 
splitting rules -- it imposes arbitrary and unneccessarsy limitations on 
the values thta you can pass to those params (unless you also have some 
escaping mechanism for the split character, but that just gets messy). 
x-url-form-encoding supports multivalued params for a reason.

The only reason *any* existing solr params use comma or white space 
seperated lists is because way, way, WAY back in the day when it was just 
me and Yonik working on Solr at CNET, he was on the east coast working on 
the guts of Solr on the east coast, and i was on the west coast working 
on a meaty RequestHandler and we needed an API for modeling request 
params.  Yonik put in a simple MapString,String and some code to 
populare it with ServletRequest params.  I asked about multi value params 
for things like fl and some other faceting params i needed and he said 
something to the effect of can't we just stringify the lists?  I didn't 
relaly know him that well yet, and i had about 45 more important features 
i needed him to implement, so i said yeah, i guess and resigned myself 
to never using anything but alphanumeric characters i nfield names.

If Solr had been open source at the time, i would have just submitted a 
patch, and hounded him until he committed it :)

: Using faceting.fields (plural) it could be backwards compatible.

The problem with syntactic sugar like that, is that it breaks things 
like defaults, appends, and invariant params ... where by break i 
mean, not work the way the user expects/wants them to work without code in 
SolrParams jumping through a *lot* of hoops that i don't think anyone 
wants to write.



-Hoss



Re: new user: some questions about parameters and query syntax

2008-05-29 Thread Bram de Jong
Hello Eric (and others)

 snip
 repeating the parameter:
 sort=field1,field2 desc,field3
 but
 facet.field=field1facet.field=field2
 This is pretty confusing to first-hand users! :-)

 Yeah, it is confusing.  But we have to be careful with order.  I don't
 believe you can rely on the order of same named request parameters (right?),
 so sort needs to be a list where order matters.  Whereas with facet.field,
 order does not matter.

For date faceting, count missing the order doesn't matter either, and
there it's given as a comma-separated list.
I think it makes sense doing everything in comma (or space) separated
lists, it's also more compatible with
other programming languages:
in many languages you can represent the GET variables as a dictionary,
but of course GET variables can have
repeated keys, that's where it breaks down. If instead of using
multiple facet.field=... using one facet.fields=field1,field2
you'd get rid of the only place where it's used (well, ok, also in the
date faceting).

Using faceting.fields (plural) it could be backwards compatible.

snip
 Using the standard Solr/Lucene query parser, tag:(bass drum) will use the
 operator specified in schema.xml, and it defaults to OR.
 is +bass +drum essentially the same as bass AND drum ?

 yes, exactly the same.

Ahh, great.

 I'm working on a query/parameter builder in python.

 Cool deal.  Might be worth collaborating with the pysolr project here:
 http://code.google.com/p/pysolr/ so as to not duplicate efforts.

I've contacted Jacob (a famous man in the python/django community).
Let's see how we can merge both projects.

 - bram

-- 
http://freesound.iua.upf.edu
http://www.smartelectronix.com
http://www.musicdsp.org


Re: new user: some questions about parameters and query syntax

2008-05-29 Thread Bram de Jong
On Thu, May 29, 2008 at 6:40 PM, Otis Gospodnetic
[EMAIL PROTECTED] wrote:
 I haven't been paying close attention to the uniformity of URL parameters, 
 but if there is room for making them more uniform
 (e.g. always use singular, always use comma as a delimiting character, etc.) 
 without hurting anything, I'm for it.

As far as my opinion goes, I would always take
comma-or-space-separated fields for all things that can have multiple
inputs.

 As for pysolr - I had a quick look the other day and saw last activity was in 
 March and there was no release.  Perhaps Jacob
 would like to simply contribute his time and skills to Solr's existing python 
 client?  Feel free to make that suggestion to Jacob.

I've taken most of the pysolr code (in google code), and
mergerd/embedded it into the one I made,
making some simplifications and some nice additions. It now allows for
using your own decoder (for returned JSON)
and encoder (for adding documents of your type)

http://iua-share.upf.edu/svn/nightingale/trunk/sandbox/solr/solrquery.py

I've contacted both Jacob and Joseph to see if we can join forces...
I personally have no problem whatsoever with donating my code to Solr
(and adapting the license to the apache license to fit).
To be honest the solr.py client in the Solr repository is a bit...
unpythonic as they say.

Not only that, but -for example- you can't do multi-field faceting
with it as it is!


 - Bram


new user: some questions about parameters and query syntax

2008-05-28 Thread Bram de Jong
hello all,


a new user here. I will be using solr to power the search over at
freesound ( http://freesound.iua.upf.edu ).

been experimenting with solr and it's damned cool :)

here we go:

1. I have a minor remark about the inconsistencies in the
query-parameter definitions... Sometimes multiple fields are given
with comma/space-separated values, sometimes they are given by
repeating the parameter:
sort=field1,field2 desc,field3
but
facet.field=field1facet.field=field2
This is pretty confusing to first-hand users! :-)

2. two questions about the query syntax:

is
   tag:(bass drum)
the same as:
   tag:bass OR tag:drum
or the same as:
   tag:bass AND tag:drum
or neither?

is +bass +drum essentially the same as bass AND drum ?


I'm working on a query/parameter builder in python. It's work in
progress but you can see what's been done over here:
http://iua-share.upf.edu/svn/nightingale/trunk/sandbox/solr/solrquery.py
it's basically a wrapper around all the parameters you can pass via
the GET string to SOLR so you can do things like:

q = SolrQuery()
q.set_query(tag:bass)
q.set_query_options(start=0, rows=10, sort=[date desc],
field_list=[id, tag, description])
q.add_facet_field(author)
q.add_facet_field(tag)
q.set_global_facet_options(limit=20, count_missing=True)
q.set_facet_options(tag, mincount=5)
q.add_date_facet(date_written)
q.set_global_date_facet_options(start=-2YEARS, end=-1YEARS,
gap=+1MONTH, count_other=[before, after])
print q.get_query_string()

which results in:

sort=date+descfacet.date.gap=%2B1MONTHfacet.field=authorfacet.field=tagfacet.date=date_writtenfacet=truefacet.date.start=-2YEARSfacet.date.end=-2YEARSfl=id%2Ctag%2Cdescriptionfacet.date.other=beforefacet.date.other=afterrows=10facet.missing=truefacet.limit=20start=0wt=jsonq=tag%3Abassf.tag.facet.mincount=5



 - bram

-- 
http://freesound.iua.upf.edu
http://www.smartelectronix.com
http://www.musicdsp.org


  1   2   >