+fieldname sintax question

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

+fieldname sintax question

Leonardo Santagada
On our search, we need to especify some search criteria in some search  
fields, the only way to do that for us has been using the default  
query handler (and inside each field we escape the characters that we  
don't want to influence the search, more or less what dismax does for  
the whole query). But this is not working

Title:(NOT Canada) +authorOrCreator:(mcdonald)

Matches a lot of documents, the first one having a title that doesn't  
contains Canada in the title (and many others that doesnt also).

  but:

+Title:(NOT Canada) +authorOrCreator:(mcdonald)

Matches exactly 0 docs.

Why is that and how can we make solr search for a doc that does not  
contain canada and also does not contain mcdonald (and the default  
combinator can be either or or and).

thanks in advance

--
Leonardo Santagada



Reply | Threaded
Open this post in threaded view
|

Re: +fieldname sintax question

Otis Gospodnetic-2
Are you really trying to the following?

    -Title:(Canada) +authorOrCreator:(mcdonald)
 
Otis

--
Sematext -- http://sematext.com/ -- Lucene - Solr - Nutch

----- Original Message ----

> From: Leonardo Santagada <[hidden email]>
> To: [hidden email]
> Sent: Thursday, February 28, 2008 11:02:26 PM
> Subject: +fieldname sintax question
>
> On our search, we need to especify some search criteria in some search  
> fields, the only way to do that for us has been using the default  
> query handler (and inside each field we escape the characters that we  
> don't want to influence the search, more or less what dismax does for  
> the whole query). But this is not working
>
> Title:(NOT Canada) +authorOrCreator:(mcdonald)
>
> Matches a lot of documents, the first one having a title that doesn't  
> contains Canada in the title (and many others that doesnt also).
>
>   but:
>
> +Title:(NOT Canada) +authorOrCreator:(mcdonald)
>
> Matches exactly 0 docs.
>
> Why is that and how can we make solr search for a doc that does not  
> contain canada and also does not contain mcdonald (and the default  
> combinator can be either or or and).
>
> thanks in advance
>
> --
> Leonardo Santagada
>
>
>
>


Reply | Threaded
Open this post in threaded view
|

Re: +fieldname sintax question

Leonardo Santagada
yes, but they should be the same no?

and the problem is that the we are using something like "+fieldname:
(<whatever the user type in the field>)" to generate this query... so  
doing like you said is not really easy.

On 29/02/2008, at 01:25, Otis Gospodnetic wrote:

> Are you really trying to the following?
>
>    -Title:(Canada) +authorOrCreator:(mcdonald)
>
> Otis
>
> --
> Sematext -- http://sematext.com/ -- Lucene - Solr - Nutch
>
> ----- Original Message ----
>> From: Leonardo Santagada <[hidden email]>
>> To: [hidden email]
>> Sent: Thursday, February 28, 2008 11:02:26 PM
>> Subject: +fieldname sintax question
>>
>> On our search, we need to especify some search criteria in some  
>> search
>> fields, the only way to do that for us has been using the default
>> query handler (and inside each field we escape the characters that we
>> don't want to influence the search, more or less what dismax does for
>> the whole query). But this is not working
>>
>> Title:(NOT Canada) +authorOrCreator:(mcdonald)
>>
>> Matches a lot of documents, the first one having a title that doesn't
>> contains Canada in the title (and many others that doesnt also).
>>
>>  but:
>>
>> +Title:(NOT Canada) +authorOrCreator:(mcdonald)
>>
>> Matches exactly 0 docs.
>>
>> Why is that and how can we make solr search for a doc that does not
>> contain canada and also does not contain mcdonald (and the default
>> combinator can be either or or and).
>>
>> thanks in advance
>>
>> --
>> Leonardo Santagada
>>
>>
>>
>>
>
>

--
Leonardo Santagada



Reply | Threaded
Open this post in threaded view
|

Re: +fieldname sintax question

Otis Gospodnetic-2
In reply to this post by Leonardo Santagada
Well, you may want to massage that user-entered query string a little bit, perhaps just enough to get rid of AND, OR, and NOT.  What if the user enters *foo?  Leading wildcards won't work, most likely.  You can either let things break or proactively try to fix thing (like the annoying MS Word autocorrection feature ;)).

Otis
--
Sematext -- http://sematext.com/ -- Lucene - Solr - Nutch

----- Original Message ----

> From: Leonardo Santagada <[hidden email]>
> To: [hidden email]
> Sent: Thursday, February 28, 2008 11:41:40 PM
> Subject: Re: +fieldname sintax question
>
> yes, but they should be the same no?
>
> and the problem is that the we are using something like "+fieldname:
> ()" to generate this query... so  
> doing like you said is not really easy.
>
> On 29/02/2008, at 01:25, Otis Gospodnetic wrote:
>
> > Are you really trying to the following?
> >
> >    -Title:(Canada) +authorOrCreator:(mcdonald)
> >
> > Otis
> >
> > --
> > Sematext -- http://sematext.com/ -- Lucene - Solr - Nutch
> >
> > ----- Original Message ----
> >> From: Leonardo Santagada
> >> To: [hidden email]
> >> Sent: Thursday, February 28, 2008 11:02:26 PM
> >> Subject: +fieldname sintax question
> >>
> >> On our search, we need to especify some search criteria in some  
> >> search
> >> fields, the only way to do that for us has been using the default
> >> query handler (and inside each field we escape the characters that we
> >> don't want to influence the search, more or less what dismax does for
> >> the whole query). But this is not working
> >>
> >> Title:(NOT Canada) +authorOrCreator:(mcdonald)
> >>
> >> Matches a lot of documents, the first one having a title that doesn't
> >> contains Canada in the title (and many others that doesnt also).
> >>
> >>  but:
> >>
> >> +Title:(NOT Canada) +authorOrCreator:(mcdonald)
> >>
> >> Matches exactly 0 docs.
> >>
> >> Why is that and how can we make solr search for a doc that does not
> >> contain canada and also does not contain mcdonald (and the default
> >> combinator can be either or or and).
> >>
> >> thanks in advance
> >>
> >> --
> >> Leonardo Santagada
> >>
> >>
> >>
> >>
> >
> >
>
> --
> Leonardo Santagada
>
>
>
>


Reply | Threaded
Open this post in threaded view
|

Re: +fieldname sintax question

Leonardo Santagada

On 29/02/2008, at 01:52, Otis Gospodnetic wrote:

> Well, you may want to massage that user-entered query string a  
> little bit, perhaps just enough to get rid of AND, OR, and NOT.  
> What if the user enters *foo?  Leading wildcards won't work, most  
> likely.  You can either let things break or proactively try to fix  
> thing (like the annoying MS Word autocorrection feature ;)).


we are already removing everything but AND, OR and NOT so those are  
the only special things on the search string. We can remove the NOT  
and try to teach the users to use - in front of words like google,  
would that help?


--
Leonardo Santagada