dismax query syntax to replace standard query

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

dismax query syntax to replace standard query

javaxmlsoapdev
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:"test"description:"test"name:"Joe"statusName:(Male OR Female)
Reply | Threaded
Open this post in threaded view
|

Re: dismax query syntax to replace standard query

isugar
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 <[hidden email]> 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:"test"description:"test"name:"Joe"statusName:(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.
>
>
Reply | Threaded
Open this post in threaded view
|

Re: dismax query syntax to replace standard query

Yonik Seeley-2-2
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 <[hidden email]> 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 <[hidden email]> 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:"test"description:"test"name:"Joe"statusName:(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.
>>
>>
>
Reply | Threaded
Open this post in threaded view
|

Re: dismax query syntax to replace standard query

javaxmlsoapdev
In reply to this post by isugar
Thanks. When I do it that way it gives me following query.

q=risk+test&qt=dismax&fq=statusName:(Male+OR+Female)+name:"Joe"&hl=on&rows=10&version=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 OR between words in the text area("q" param) e.g. word 'risk' or 'test' & 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="defType">dismax</str>
     <str name="echoParams">explicit</str>
     <float name="tie">0.01</float>
     <str name="qf">
        title^2 description
     </str>
     <str name="pf">
        title description
     </str>
     <str name="mm">
        2<-1 5<-2 6<90%
     </str>
     <int name="ps">100</int>
     <str name="q.alt">*:*</str>
     <str name="hl.fl">title description</str>
     <str name="f.name.hl.fragsize">100000</str>
     <str name="f.name.hl.alternateField">title</str>
     <str name="f.text.hl.fragmenter">regex</str>
    </lst>
  </requestHandler>

And schema.xml has
<defaultSearchField>title</defaultSearchField>
<solrQueryParser defaultOperator="OR"/> 

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 <vikasdp@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:"test"description:"test"name:"Joe"statusName:(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.
>
>