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 javaxmlsoapdev <vi...@yahoo.com> on 2009/12/03 20:28:59 UTC

dismax query syntax to replace standard query

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.


Re: dismax query syntax to replace standard query

Posted by Yonik Seeley <yo...@lucidimagination.com>.
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 <ia...@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 <vi...@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.
>>
>>
>

Re: dismax query syntax to replace standard query

Posted by javaxmlsoapdev <vi...@yahoo.com>.
Thanks. When I do it that way it gives me following query.

params={indent=on&start=0&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 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&lt;-1 5&lt;-2 6&lt;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"/> -- 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 <vi...@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.
>>
>>
> 
> 

-- 
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

Posted by Ian Sugar <ia...@gmail.com>.
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 <vi...@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.
>
>