You are viewing a plain text version of this content. The canonical link for it is here.
Posted to solr-user@lucene.apache.org by nativecoder <ro...@gmail.com> on 2014/05/05 15:11:38 UTC

Help to Understand a Solr Query

Hi All

I am completely new to solr and hoping to understand the basics. Can one of
you help me to understand what the following query does, in which order it
is getting executed

I understand that when this query is executed fields mentioned in fieldList
will be returned. What I don't understand is how the "samplestring1" and
"samplestring2" will get searched with the query fields specified

I think I will be able to understand how the search happens if this can be
illustrated in SQL ( Just to understand what happens behind the scene)

Following is the query. Please have a look at it and let me know how this
works internally.
query=samplestring1 AND samplestring2
defType: edismax
queryFields: Exact_Field1^1.0 Exact_Field2^0.9 Field1^0.8 Field2^0.7
fieldList: Column1, Column2
resultRows: 10
startRow: 0

P.S samplestring1 AND samplestring2  are some test strings in the query

Sample of Schema for fields

<fieldType name="sampletype1" class="solr.TextField"
positionIncrementGap="100"><analyzer type="index"><tokenizer
class="solr.KeywordTokenizerFactory"/><filter
class="solr.LowerCaseFilterFactory"/><filter class="solr.NGramFilterFactory"
minGramSize="5" maxGramSize="10"/></analyzer><analyzer
type="query"><tokenizer class="solr.KeywordTokenizerFactory"/><filter
class="solr.LowerCaseFilterFactory"/></analyzer></fieldType>

<fieldtype name="sampletype2" class="solr.TextField" sortMissingLast="true"
omitNorms="true"><analyzer><tokenizer
class="solr.KeywordTokenizerFactory"/><filter
class="solr.LowerCaseFilterFactory"/></analyzer></fieldtype>

<field name="Field1" compressed="true" type="sampletype1"
multiValued="false" indexed="true" stored="true" required="true"
omitNorms="true"/>

<field name="Field2" compressed="true" type="sampletype1"
multiValued="false" indexed="true" stored="true" required="true"
omitNorms="true"/>

<field name="Exact_Field1" omitPositions="true" termVectors="false"
omitTermFreqAndPositions="true" compressed="true" type="sampletype2"
multiValued="false" indexed="true" stored="true" required="true"
omitNorms="true"/>

<field name="Exact_Field2" omitPositions="true" termVectors="false"
omitTermFreqAndPositions="true" compressed="true" type="sampletype2"
multiValued="false" indexed="true" stored="true" required="false"
omitNorms="true"/>

<copyField source="Field1" dest="Exact_Field1"/>
<copyField source="Field2" dest="Exact_Field2"/> 



--
View this message in context: http://lucene.472066.n3.nabble.com/Help-to-Understand-a-Solr-Query-tp4134686.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Help to Understand a Solr Query

Posted by Shawn Heisey <so...@elyograg.org>.
On 5/13/2014 8:56 AM, nativecoder wrote:
> <field name=&quot;&lt;b>Exact_Word" omitPositions="true" termVectors="false"
> omitTermFreqAndPositions="true" compressed="true" type="string_ci"
> multiValued="false" indexed="true" stored="true" required="false"
> omitNorms="true"/>
> 
> <field name="Word" compressed="true" type="email_text_ptn"
> multiValued="false" indexed="true" stored="true" required="false"
> omitNorms="true"/>
> 
> <fieldtype name="string_ci" class="solr.TextField" sortMissingLast="true"
> omitNorms="true"><analyzer><tokenizer
> class="solr.KeywordTokenizerFactory"/><filter
> class="solr.LowerCaseFilterFactory"/></analyzer></fieldtype>
> 
> <copyField source="Word" dest="Exact_Word"/>
> 
> As you can see Exact_Word has the KeywordTokenizerFactory and that should
> treat the string as it is.
> 
> Following is my responseHeader. As you can see I am searching my string only
> in the filed Exact_Word and expecting it to return the Word field and the
> score
> 
> "responseHeader":{
>     "status":0,
>     "QTime":14,
>     "params":{
>       "explainOther":"",
>       "fl":"Word,score",
>       "debugQuery":"on",
>       "indent":"on",
>       "start":"0",
>       "q":"d!sdasdsdwasd!asd@dsadsadas.edu",
>       "qf":"Exact_Word",
>       "wt":"json",
>       "fq":"",
>       "version":"2.2",
>       "rows":"10"}},
> 
> 
> But when I enter email with the following string
> "d!sdasdsdwasdasd@dsadsadas.edu" it splits the string to two. I was under
> the impression that KeywordTokenizerFactory will treat the string as it is.
> 
> Following is the query debug result. There you can see it has split the word
>  "parsedquery":"+((DisjunctionMaxQuery((Exact_Word:d))
> -DisjunctionMaxQuery((Exact_Word:sdasdsdwasdasd@dsadsadas.edu)))~1)",
> 
> can someone please tell why it produce the query result as this
> 
> If I put a string without the "!" sign as below, the produced query will be
> as below
> 
> "parsedquery":"+DisjunctionMaxQuery((Exact_Word:d_sdasdsdwasd_asd@dsadsadas.edu))",.
> This is what I expected solr to even with the "!" mark. with "_" mark it
> wont do a string split and treats the string as it is
> 
> I thought if the KeywordTokenizerFactory is applied then it should return
> the exact string as it is
> 
> Please help me to understand what is going wrong here 

I cannot make Solr (4.7.2) behave this way with exclamation points.  I
tried debugQuery=true, using the standard query parser with df set to
the field as well as setting the qf parameter on the dismax parser and
the edismax parser.  None of these will split the string like what shows
up in your debugQuery.

Here's a screenshot of the analysis screen for a similar fieldType with
your input data:

https://www.dropbox.com/s/0v2lbc76h9wejw1/lowercase-analysis.png

KT is the KeywordTokenizer.  ICUFF is the ICUFoldingFilter -- lowercase
on steroids.  TF is the TrimFilter.

Restating what Jack said in his reply:

http://people.apache.org/~hossman/#threadhijack

Thanks,
Shawn


Re: Help to Understand a Solr Query

Posted by Jack Krupansky <ja...@basetechnology.com>.
Please don't re-use an existing message thread for a new, completely 
independent question!

Also, try to make the subject line indicate something about the actual 
issue.

-- Jack Krupansky

-----Original Message----- 
From: nativecoder
Sent: Tuesday, May 13, 2014 10:56 AM
To: solr-user@lucene.apache.org
Subject: Re: Help to Understand a Solr Query

Hi All

I have a following field settings in solr schema

<field name=&quot;&lt;b>Exact_Word" omitPositions="true" termVectors="false"
omitTermFreqAndPositions="true" compressed="true" type="string_ci"
multiValued="false" indexed="true" stored="true" required="false"
omitNorms="true"/>

<field name="Word" compressed="true" type="email_text_ptn"
multiValued="false" indexed="true" stored="true" required="false"
omitNorms="true"/>

<fieldtype name="string_ci" class="solr.TextField" sortMissingLast="true"
omitNorms="true"><analyzer><tokenizer
class="solr.KeywordTokenizerFactory"/><filter
class="solr.LowerCaseFilterFactory"/></analyzer></fieldtype>

<copyField source="Word" dest="Exact_Word"/>

As you can see Exact_Word has the KeywordTokenizerFactory and that should
treat the string as it is.

Following is my responseHeader. As you can see I am searching my string only
in the filed Exact_Word and expecting it to return the Word field and the
score

"responseHeader":{
    "status":0,
    "QTime":14,
    "params":{
      "explainOther":"",
      "fl":"Word,score",
      "debugQuery":"on",
      "indent":"on",
      "start":"0",
      "q":"d!sdasdsdwasd!asd@dsadsadas.edu",
      "qf":"Exact_Word",
      "wt":"json",
      "fq":"",
      "version":"2.2",
      "rows":"10"}},


But when I enter email with the following string
"d!sdasdsdwasdasd@dsadsadas.edu" it splits the string to two. I was under
the impression that KeywordTokenizerFactory will treat the string as it is.

Following is the query debug result. There you can see it has split the word
"parsedquery":"+((DisjunctionMaxQuery((Exact_Word:d))
-DisjunctionMaxQuery((Exact_Word:sdasdsdwasdasd@dsadsadas.edu)))~1)",

can someone please tell why it produce the query result as this

If I put a string without the "!" sign as below, the produced query will be
as below

"parsedquery":"+DisjunctionMaxQuery((Exact_Word:d_sdasdsdwasd_asd@dsadsadas.edu))",.
This is what I expected solr to even with the "!" mark. with "_" mark it
wont do a string split and treats the string as it is

I thought if the KeywordTokenizerFactory is applied then it should return
the exact string as it is

Please help me to understand what is going wrong here



--
View this message in context: 
http://lucene.472066.n3.nabble.com/Help-to-Understand-a-Solr-Query-tp4134686p4135464.html
Sent from the Solr - User mailing list archive at Nabble.com. 


Re: Help to Understand a Solr Query

Posted by nativecoder <ro...@gmail.com>.
Hi All

I have a following field settings in solr schema

<field name=&quot;&lt;b>Exact_Word" omitPositions="true" termVectors="false"
omitTermFreqAndPositions="true" compressed="true" type="string_ci"
multiValued="false" indexed="true" stored="true" required="false"
omitNorms="true"/>

<field name="Word" compressed="true" type="email_text_ptn"
multiValued="false" indexed="true" stored="true" required="false"
omitNorms="true"/>

<fieldtype name="string_ci" class="solr.TextField" sortMissingLast="true"
omitNorms="true"><analyzer><tokenizer
class="solr.KeywordTokenizerFactory"/><filter
class="solr.LowerCaseFilterFactory"/></analyzer></fieldtype>

<copyField source="Word" dest="Exact_Word"/>

As you can see Exact_Word has the KeywordTokenizerFactory and that should
treat the string as it is.

Following is my responseHeader. As you can see I am searching my string only
in the filed Exact_Word and expecting it to return the Word field and the
score

"responseHeader":{
    "status":0,
    "QTime":14,
    "params":{
      "explainOther":"",
      "fl":"Word,score",
      "debugQuery":"on",
      "indent":"on",
      "start":"0",
      "q":"d!sdasdsdwasd!asd@dsadsadas.edu",
      "qf":"Exact_Word",
      "wt":"json",
      "fq":"",
      "version":"2.2",
      "rows":"10"}},


But when I enter email with the following string
"d!sdasdsdwasdasd@dsadsadas.edu" it splits the string to two. I was under
the impression that KeywordTokenizerFactory will treat the string as it is.

Following is the query debug result. There you can see it has split the word
 "parsedquery":"+((DisjunctionMaxQuery((Exact_Word:d))
-DisjunctionMaxQuery((Exact_Word:sdasdsdwasdasd@dsadsadas.edu)))~1)",

can someone please tell why it produce the query result as this

If I put a string without the "!" sign as below, the produced query will be
as below

"parsedquery":"+DisjunctionMaxQuery((Exact_Word:d_sdasdsdwasd_asd@dsadsadas.edu))",.
This is what I expected solr to even with the "!" mark. with "_" mark it
wont do a string split and treats the string as it is

I thought if the KeywordTokenizerFactory is applied then it should return
the exact string as it is

Please help me to understand what is going wrong here 



--
View this message in context: http://lucene.472066.n3.nabble.com/Help-to-Understand-a-Solr-Query-tp4134686p4135464.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Help to Understand a Solr Query

Posted by Jack Krupansky <ja...@basetechnology.com>.
Think of debugQuery as your "Solr BFF"!

-- Jack Krupansky

-----Original Message----- 
From: nativecoder
Sent: Tuesday, May 6, 2014 7:36 AM
To: solr-user@lucene.apache.org
Subject: Re: Help to Understand a Solr Query

Thank you this is what I was looking for all this time

I wanted to understand how the query that I passed being evaluated by solr




--
View this message in context: 
http://lucene.472066.n3.nabble.com/Help-to-Understand-a-Solr-Query-tp4134686p4134904.html
Sent from the Solr - User mailing list archive at Nabble.com. 


Re: Help to Understand a Solr Query

Posted by nativecoder <ro...@gmail.com>.
Thank you this is what I was looking for all this time 

I wanted to understand how the query that I passed being evaluated by solr




--
View this message in context: http://lucene.472066.n3.nabble.com/Help-to-Understand-a-Solr-Query-tp4134686p4134904.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Help to Understand a Solr Query

Posted by Jack Krupansky <ja...@basetechnology.com>.
The "+" symbol means a clause of a boolean query that "must" be present, as 
opposed to "should" (optionally) be present. This is equivalent to the "AND" 
operator.

The "|" means "OR" for a disjunction maximum query to indicates the 
alternatives - at least one of the alternatives must match.

-- Jack Krupansky

-----Original Message----- 
From: nativecoder
Sent: Tuesday, May 6, 2014 4:44 AM
To: solr-user@lucene.apache.org
Subject: Re: Help to Understand a Solr Query

When I go through the debug results I found this. Can you explain me what
is the + and | sign means.

+(

+DisjunctionMaxQuery(
    (
      Exact_Field1:"samplestring1"^0.6 |
      Exact_Field2:samplestring1^0.5 |
      Field1:samplestring1^0.9 |
      Field2:samplestring1
     )
)
+DisjunctionMaxQuery(
   (
       Exact_Field1:samplestring2^0.6 |
      Exact_Field2:samplestring2^0.5 |
      Field1:samplestring2^0.9 |
      Field2:samplestring2
    )
  )
)




On Mon, May 5, 2014 at 11:42 PM, Alexandre Rafalovitch [via Lucene] <
ml-node+s472066n4134841h32@n3.nabble.com> wrote:

> If you are looking for that level of understanding, you are best
> enabling the debug flag. Then you will get a full breakdown of what
> matched which field and why. Including scores, preferences, etc.
> Possibly with debug.explained.structured enabled:
> http://wiki.apache.org/solr/CommonQueryParameters#debug.explain.structured
>
> Most people do not want to deep dive into debug info. But I am getting
> the feeling this would be right where you want to go.
>
> Regards,
>    Alex.
> Personal website: http://www.outerthoughts.com/
> Current project: http://www.solr-start.com/ - Accelerating your Solr
> proficiency
>
>
> On Tue, May 6, 2014 at 1:47 AM, nativecoder <[hidden 
> email]<http://user/SendEmail.jtp?type=node&node=4134841&i=0>>
> wrote:
>
> > That answer helps a lot
> >
> > Where would the OR clause be ?
> >
> > (Exact_Field1:samplestring1 OR Exact_Field1:samplestring2) AND
> > (Exact_Field2:samplestring1 OR Exact_Field2:samplestring2) AND
> > (Field1:samplestring1 OR Field1:samplestring2) AND (Field2:samplestring1
> > OR Field2:samplestring2)
> >
> > Please note that in my query it is an AND clause. I am trying to
> understand
> > where the AND fits in. To be more precise my query is as below
> >
> > q=samplestring1 AND samplestring2&defType: edismax&qf: Exact_Field1^1.0
> > Exact_Field2^0.9 Field1^0.8 Field2^0.7&fl= Column1, Column2
> >
> >
> >
> >
> > --
> > View this message in context:
> http://lucene.472066.n3.nabble.com/Help-to-Understand-a-Solr-Query-tp4134686p4134775.html
>
> > Sent from the Solr - User mailing list archive at Nabble.com.
>
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://lucene.472066.n3.nabble.com/Help-to-Understand-a-Solr-Query-tp4134686p4134841.html
>  To unsubscribe from Help to Understand a Solr Query, click 
> here<http://lucene.472066.n3.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4134686&code=cm9tcm9tMTIzQGdtYWlsLmNvbXw0MTM0Njg2fDE3MDI4MTA4MQ==>
> .
> NAML<http://lucene.472066.n3.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>




--
View this message in context: 
http://lucene.472066.n3.nabble.com/Help-to-Understand-a-Solr-Query-tp4134686p4134887.html
Sent from the Solr - User mailing list archive at Nabble.com. 


Re: Help to Understand a Solr Query

Posted by nativecoder <ro...@gmail.com>.
When I go through the debug results I found this. Can you explain me what
is the + and | sign means.

+(

 +DisjunctionMaxQuery(
    (
      Exact_Field1:"samplestring1"^0.6 |
      Exact_Field2:samplestring1^0.5 |
      Field1:samplestring1^0.9 |
      Field2:samplestring1
     )
)
 +DisjunctionMaxQuery(
   (
       Exact_Field1:samplestring2^0.6 |
      Exact_Field2:samplestring2^0.5 |
      Field1:samplestring2^0.9 |
      Field2:samplestring2
    )
  )
)




On Mon, May 5, 2014 at 11:42 PM, Alexandre Rafalovitch [via Lucene] <
ml-node+s472066n4134841h32@n3.nabble.com> wrote:

> If you are looking for that level of understanding, you are best
> enabling the debug flag. Then you will get a full breakdown of what
> matched which field and why. Including scores, preferences, etc.
> Possibly with debug.explained.structured enabled:
> http://wiki.apache.org/solr/CommonQueryParameters#debug.explain.structured
>
> Most people do not want to deep dive into debug info. But I am getting
> the feeling this would be right where you want to go.
>
> Regards,
>    Alex.
> Personal website: http://www.outerthoughts.com/
> Current project: http://www.solr-start.com/ - Accelerating your Solr
> proficiency
>
>
> On Tue, May 6, 2014 at 1:47 AM, nativecoder <[hidden email]<http://user/SendEmail.jtp?type=node&node=4134841&i=0>>
> wrote:
>
> > That answer helps a lot
> >
> > Where would the OR clause be ?
> >
> > (Exact_Field1:samplestring1 OR Exact_Field1:samplestring2) AND
> > (Exact_Field2:samplestring1 OR Exact_Field2:samplestring2) AND
> > (Field1:samplestring1 OR Field1:samplestring2) AND (Field2:samplestring1
> > OR Field2:samplestring2)
> >
> > Please note that in my query it is an AND clause. I am trying to
> understand
> > where the AND fits in. To be more precise my query is as below
> >
> > q=samplestring1 AND samplestring2&defType: edismax&qf: Exact_Field1^1.0
> > Exact_Field2^0.9 Field1^0.8 Field2^0.7&fl= Column1, Column2
> >
> >
> >
> >
> > --
> > View this message in context:
> http://lucene.472066.n3.nabble.com/Help-to-Understand-a-Solr-Query-tp4134686p4134775.html
>
> > Sent from the Solr - User mailing list archive at Nabble.com.
>
>
> ------------------------------
>  If you reply to this email, your message will be added to the discussion
> below:
>
> http://lucene.472066.n3.nabble.com/Help-to-Understand-a-Solr-Query-tp4134686p4134841.html
>  To unsubscribe from Help to Understand a Solr Query, click here<http://lucene.472066.n3.nabble.com/template/NamlServlet.jtp?macro=unsubscribe_by_code&node=4134686&code=cm9tcm9tMTIzQGdtYWlsLmNvbXw0MTM0Njg2fDE3MDI4MTA4MQ==>
> .
> NAML<http://lucene.472066.n3.nabble.com/template/NamlServlet.jtp?macro=macro_viewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicNamespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.NodeNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails%21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml>
>




--
View this message in context: http://lucene.472066.n3.nabble.com/Help-to-Understand-a-Solr-Query-tp4134686p4134887.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Help to Understand a Solr Query

Posted by Alexandre Rafalovitch <ar...@gmail.com>.
If you are looking for that level of understanding, you are best
enabling the debug flag. Then you will get a full breakdown of what
matched which field and why. Including scores, preferences, etc.
Possibly with debug.explained.structured enabled:
http://wiki.apache.org/solr/CommonQueryParameters#debug.explain.structured

Most people do not want to deep dive into debug info. But I am getting
the feeling this would be right where you want to go.

Regards,
   Alex.
Personal website: http://www.outerthoughts.com/
Current project: http://www.solr-start.com/ - Accelerating your Solr proficiency


On Tue, May 6, 2014 at 1:47 AM, nativecoder <ro...@gmail.com> wrote:
> That answer helps a lot
>
> Where would the OR clause be ?
>
> (Exact_Field1:samplestring1 OR Exact_Field1:samplestring2) AND
> (Exact_Field2:samplestring1 OR Exact_Field2:samplestring2) AND
> (Field1:samplestring1 OR Field1:samplestring2) AND (Field2:samplestring1
> OR Field2:samplestring2)
>
> Please note that in my query it is an AND clause. I am trying to understand
> where the AND fits in. To be more precise my query is as below
>
> q=samplestring1 AND samplestring2&defType: edismax&qf: Exact_Field1^1.0
> Exact_Field2^0.9 Field1^0.8 Field2^0.7&fl= Column1, Column2
>
>
>
>
> --
> View this message in context: http://lucene.472066.n3.nabble.com/Help-to-Understand-a-Solr-Query-tp4134686p4134775.html
> Sent from the Solr - User mailing list archive at Nabble.com.

Re: Help to Understand a Solr Query

Posted by nativecoder <ro...@gmail.com>.
That answer helps a lot

Where would the OR clause be ?

(Exact_Field1:samplestring1 OR Exact_Field1:samplestring2) AND
(Exact_Field2:samplestring1 OR Exact_Field2:samplestring2) AND
(Field1:samplestring1 OR Field1:samplestring2) AND (Field2:samplestring1
OR Field2:samplestring2)

Please note that in my query it is an AND clause. I am trying to understand
where the AND fits in. To be more precise my query is as below

q=samplestring1 AND samplestring2&defType: edismax&qf: Exact_Field1^1.0
Exact_Field2^0.9 Field1^0.8 Field2^0.7&fl= Column1, Column2 




--
View this message in context: http://lucene.472066.n3.nabble.com/Help-to-Understand-a-Solr-Query-tp4134686p4134775.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Help to Understand a Solr Query

Posted by nativecoder <ro...@gmail.com>.
That answer helps a lot

Where would the OR clause be ? 

(Exact_Field1:samplestring1 *OR* Exact_Field1:samplestring2) AND
(Exact_Field2:samplestring1 *OR* Exact_Field2:samplestring2) AND
(Field1:samplestring1 *OR* Field1:samplestring2) AND (Field2:samplestring1
*OR* Field2:samplestring2)

Please note that in my query it is an AND clause. I am trying to understand
where the AND fits in.

*query=samplestring1 AND samplestring2*
defType: edismax
queryFields: Exact_Field1^1.0 Exact_Field2^0.9 Field1^0.8 Field2^0.7
fieldList: Column1, Column2 




--
View this message in context: http://lucene.472066.n3.nabble.com/Help-to-Understand-a-Solr-Query-tp4134686p4134763.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Help to Understand a Solr Query

Posted by nativecoder <ro...@gmail.com>.
When I go through the debug results I found this. Can someone explain me what
is the + and | sign means.

+(

 +DisjunctionMaxQuery(
    (
      Exact_Field1:"samplestring1"^0.6 | 
      Exact_Field2:samplestring1^0.5 | 
      Field1:samplestring1^0.9 | 
      Field2:samplestring1 
     )
)
 +DisjunctionMaxQuery(
   (
       Exact_Field1:samplestring2^0.6 | 
      Exact_Field2:samplestring2^0.5 | 
      Field1:samplestring2^0.9 | 
      Field2:samplestring2 
    )
  )
)





--
View this message in context: http://lucene.472066.n3.nabble.com/Help-to-Understand-a-Solr-Query-tp4134686p4134886.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Help to Understand a Solr Query

Posted by Jack Krupansky <ja...@basetechnology.com>.
"dismax" means Disjunction Maximum, which means Lucene takes the highest 
scoring clause (field), for each search term. This is effectively an OR of 
the clauses.


-- Jack Krupansky
-----Original Message----- 
From: nativecoder
Sent: Monday, May 5, 2014 11:21 AM
To: solr-user@lucene.apache.org
Subject: Re: Help to Understand a Solr Query

I already went through the link. I understand about the boosting factor for
the relevancy

query=samplestring1 AND samplestring2
defType: edismax
queryFields: Exact_Field1^1.0 Exact_Field2^0.9 Field1^0.8 Field2^0.7
fieldList: Column1, Column2

I need to understand whether the samplestring1 and samplestring 2 both will
be searched in each field mentioned in queryFields. What I meant was ;

e.g (Exact_Field1:samplestring1 AND Exact_Field1:samplestring2) AND
(Exact_Field2:samplestring1 AND Exact_Field2:samplestring2) AND
(Field1:samplestring1 AND Field1:samplestring2) AND (Field2:samplestring1
AND Field2:samplestring2)

Is the above correct ?





--
View this message in context: 
http://lucene.472066.n3.nabble.com/Help-to-Understand-a-Solr-Query-tp4134686p4134714.html
Sent from the Solr - User mailing list archive at Nabble.com. 


Re: Help to Understand a Solr Query

Posted by nativecoder <ro...@gmail.com>.
I already went through the link. I understand about the boosting factor for
the relevancy

query=samplestring1 AND samplestring2
defType: edismax
queryFields: Exact_Field1^1.0 Exact_Field2^0.9 Field1^0.8 Field2^0.7
fieldList: Column1, Column2 

I need to understand whether the samplestring1 and samplestring 2 both will
be searched in each field mentioned in queryFields. What I meant was ;

e.g (Exact_Field1:samplestring1 AND Exact_Field1:samplestring2) AND
(Exact_Field2:samplestring1 AND Exact_Field2:samplestring2) AND
(Field1:samplestring1 AND Field1:samplestring2) AND (Field2:samplestring1
AND Field2:samplestring2)

Is the above correct ?
 




--
View this message in context: http://lucene.472066.n3.nabble.com/Help-to-Understand-a-Solr-Query-tp4134686p4134714.html
Sent from the Solr - User mailing list archive at Nabble.com.

Re: Help to Understand a Solr Query

Posted by Jack Krupansky <ja...@basetechnology.com>.
Read up on the edismax query parser first:
http://wiki.apache.org/solr/ExtendedDisMax

The "^" operator is known as boosting or field boosting and is used to 
influence document scores for relevancy.

It has no analog in SQL.

-- Jack Krupansky

-----Original Message----- 
From: nativecoder
Sent: Monday, May 5, 2014 9:11 AM
To: solr-user@lucene.apache.org
Subject: Help to Understand a Solr Query

Hi All

I am completely new to solr and hoping to understand the basics. Can one of
you help me to understand what the following query does, in which order it
is getting executed

I understand that when this query is executed fields mentioned in fieldList
will be returned. What I don't understand is how the "samplestring1" and
"samplestring2" will get searched with the query fields specified

I think I will be able to understand how the search happens if this can be
illustrated in SQL ( Just to understand what happens behind the scene)

Following is the query. Please have a look at it and let me know how this
works internally.
query=samplestring1 AND samplestring2
defType: edismax
queryFields: Exact_Field1^1.0 Exact_Field2^0.9 Field1^0.8 Field2^0.7
fieldList: Column1, Column2
resultRows: 10
startRow: 0

P.S samplestring1 AND samplestring2  are some test strings in the query

Sample of Schema for fields

<fieldType name="sampletype1" class="solr.TextField"
positionIncrementGap="100"><analyzer type="index"><tokenizer
class="solr.KeywordTokenizerFactory"/><filter
class="solr.LowerCaseFilterFactory"/><filter class="solr.NGramFilterFactory"
minGramSize="5" maxGramSize="10"/></analyzer><analyzer
type="query"><tokenizer class="solr.KeywordTokenizerFactory"/><filter
class="solr.LowerCaseFilterFactory"/></analyzer></fieldType>

<fieldtype name="sampletype2" class="solr.TextField" sortMissingLast="true"
omitNorms="true"><analyzer><tokenizer
class="solr.KeywordTokenizerFactory"/><filter
class="solr.LowerCaseFilterFactory"/></analyzer></fieldtype>

<field name="Field1" compressed="true" type="sampletype1"
multiValued="false" indexed="true" stored="true" required="true"
omitNorms="true"/>

<field name="Field2" compressed="true" type="sampletype1"
multiValued="false" indexed="true" stored="true" required="true"
omitNorms="true"/>

<field name="Exact_Field1" omitPositions="true" termVectors="false"
omitTermFreqAndPositions="true" compressed="true" type="sampletype2"
multiValued="false" indexed="true" stored="true" required="true"
omitNorms="true"/>

<field name="Exact_Field2" omitPositions="true" termVectors="false"
omitTermFreqAndPositions="true" compressed="true" type="sampletype2"
multiValued="false" indexed="true" stored="true" required="false"
omitNorms="true"/>

<copyField source="Field1" dest="Exact_Field1"/>
<copyField source="Field2" dest="Exact_Field2"/>



--
View this message in context: 
http://lucene.472066.n3.nabble.com/Help-to-Understand-a-Solr-Query-tp4134686.html
Sent from the Solr - User mailing list archive at Nabble.com.