Thanks a lot for that!

I wanted to use dismax but hit a wall because I require trailing
wildcards in some instances. Methods 1 and 3 do not work in my case.
However upon further thinking I realized in the cases I required
wildcard I'm only searching one field. So I'll just turn dismax on and
off as required.

Thanks again :)

On Wed, Nov 17, 2010 at 12:40 PM, Ken Stanley <doh...@gmail.com> wrote:
> 2010/11/17 Jón Helgi Jónsson <jonjons...@gmail.com>:
>> I'm using index time boosting and need to specify every field I want
>> to search (not use copy fields) or else the boosting wont work.
>>
>> This query with 1 saerchterm works fine, boosts look good:
>>
>> http://localhost:8983/solr/select/?
>> q=companyName:foo
>> +descriptionTxt:verslun
>> &fl=*%20score&rows=10&start=0
>>
>> However if I have 2 words in the query and do it like this boosting
>> seems not to be working
>>
>> http://localhost:8983/solr/select/?
>> q=companyName:foo+bar
>> +descriptionTxt:foo+bar
>> &fl=*%20score&rows=10&start=0
>>
>> Its probably using the default search field for the second word which
>> has no boosting configured. How do I go about this?
>>
>> Thanks,
>> Jon
>>
>
> Jon,
>
> You have a few options here, depending on what you want to achieve
> with your query:
>
> 1. If you're trying to do a phrase query, you simply need to ensure
> that your phrases are quoted. The default behavior in SOLR is to split
> the phrase into multiple chunks. If a word is not preceded with a
> field definition, then SOLR will automatically apply the word(s) as if
> you had specified the default field. So for your example, SOLR would
> parse your query into companyName:foo defaultField:bar
> descriptionTxt:foo defaultField:bar.
> 2. You can use the dismax query plugin instead of the standard query
> plugin. You simply configure the dismax section of your solrconfig.xml
> to your liking - you define which fields to search, apply any special
> boosts for your needs, etc
> (http://wiki.apache.org/solr/DisMaxQParserPlugin) - and then you
> simply feed the query terms without naming your fields (i.e.,
> q=foo+bar), along with telling SOLR to use dismax (i.e.,
> qt=whatever_you_named_your_dismax_handler).
> 3. If phrase queries are not important to you, you can manually prefix
> each term in your query with the field you wish to search; for
> example, you would do companyName:foo companyName:bar
> descriptionTxt:foo descriptionTxt:bar.
>
> Whichever way you decide to go, the best thing that you can do to
> understand SOLR and how it's working in your environment is to append
> debugQuery=on to the end of your URL; this tells SOLR to output
> information about how it parsed your query, how long each component
> took to run, and some other useful debugging information. It's very
> useful, and has come in handy several times here where I'm at when I
> wanted to know why SOLR returned the results (or didn't return) that I
> expected.
>
> I hope this helps.
>
> - Ken
>

Reply via email to