Hi Brian could your front end app do this field query logic?

(assuming you have an app in front of solr)



On 7 June 2011 18:53, Jonathan Rochkind <rochk...@jhu.edu> wrote:
> There's no feature in Solr to do what you ask, no. I don't think.
>
> On 6/7/2011 1:30 PM, Brian Lamb wrote:
>>
>> Hi Jonathan,
>>
>> Thank you for your reply. Your point about my example is a good one. So
>> let
>> me try to restate using your example. Suppose I want to apply AND to any
>> search terms within field1.
>>
>> Then
>>
>> field1:foo field2:bar field1:baz field2:bom
>>
>> would by written as
>>
>> http://localhost:8983/solr/?q=field1:foo OR field2:bar OR field1:baz OR
>> field2:bom
>>
>> But if they were written together like:
>>
>> http://localhost:8983/solr/?q=field1:(foo baz) field2:(bar bom)
>>
>> I would want it to be
>>
>> http://localhost:8983/solr/?q=field1:(foo AND baz) OR field2:(bar OR bom)
>>
>> But it sounds like you are saying that would not be possible.
>>
>> Thanks,
>>
>> Brian Lamb
>>
>> On Tue, Jun 7, 2011 at 11:27 AM, Jonathan Rochkind<rochk...@jhu.edu>
>>  wrote:
>>
>>> Nope, not possible.
>>>
>>> I'm not even sure what it would mean semantically. If you had default
>>> operator "OR" ordinarily, but default operator "AND" just for "field2",
>>> then
>>> what would happen if you entered:
>>>
>>> field1:foo field2:bar field1:baz field2:bom
>>>
>>> Where the heck would the ANDs and ORs go?  The operators are BETWEEN the
>>> clauses that specify fields, they don't belong to a field. In general,
>>> the
>>> operators are part of the query as a whole, not any specific field.
>>>
>>> In fact, I'd be careful of your example query:
>>>    q=field1:foo bar field2:baz
>>>
>>> I don't think that means what you think it means, I don't think the
>>> "field1" applies to the "bar" in that case. Although I could be wrong,
>>> but
>>> you definitely want to check it.  You need "field1:foo field1:bar", or
>>> set
>>> the default field for the query to "field1", or use parens (although that
>>> will change the execution strategy and ranking): q=field1:(foo bar)
>>> ....
>>>
>>> At any rate, even if there's a way to specify this so it makes sense, no,
>>> Solr/lucene doesn't support any such thing.
>>>
>>>
>>>
>>>
>>> On 6/7/2011 10:56 AM, Brian Lamb wrote:
>>>
>>>> I feel like this should be fairly easy to do but I just don't see
>>>> anywhere
>>>> in the documentation on how to do this. Perhaps I am using the wrong
>>>> search
>>>> parameters.
>>>>
>>>> On Mon, Jun 6, 2011 at 12:19 PM, Brian Lamb
>>>> <brian.l...@journalexperts.com>wrote:
>>>>
>>>>  Hi all,
>>>>>
>>>>> Is it possible to change the query parser operator for a specific field
>>>>> without having to explicitly type it in the search field?
>>>>>
>>>>> For example, I'd like to use:
>>>>>
>>>>> http://localhost:8983/solr/search/?q=field1:word token field2:parser
>>>>> syntax
>>>>>
>>>>> instead of
>>>>>
>>>>> http://localhost:8983/solr/search/?q=field1:word AND token
>>>>> field2:parser
>>>>> syntax
>>>>>
>>>>> But, I only want it to be applied to field1, not field2 and I want the
>>>>> operator to always be AND unless the user explicitly types in OR.
>>>>>
>>>>> Thanks,
>>>>>
>>>>> Brian Lamb
>>>>>
>>>>>
>

Reply via email to