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 Sagar Khetkade <sa...@hotmail.com> on 2009/04/14 11:38:48 UTC

Boolean query in Solr

Hi,
I am using SolrJ and firing the query on Solr indexes. The indexed contains three fields viz.
1.       Document_id (type=integer required= true)
2.       Ticket Id (type= integer)
3.       Content (type=text)
 
Here the query formulation is such that I am having query with “AND” clause. So the query, that I am firing on index files look like  “Content: search query AND Ticket_id:123 Ticket_Id:789)”.
Here I am using the AND clause  which make my job easy through which I retrieve the document  having the query words in the “Content” field and the document is having Ticket_id field(123). 
 
I know this type of query is easily fired on lucene indexes. But when I am firing the above query I  am not getting the required result . The result contains the document which does not belongs to the ticket id mentioned in the query.
Please can anyone help me out of this issue.
 
Thanks in advance.
 
Regards,
Sagar Khetkade
_________________________________________________________________
Windows Live Messenger. Multitasking at its finest.
http://www.microsoft.com/india/windows/windowslive/messenger.aspx

RE: Boolean query in Solr

Posted by Sagar Khetkade <sa...@hotmail.com>.

Hi Erik,
 
This mail just got into my junk so left unread. Well after I made debug query on., and firing the same query I am getting some different vibs from it.
Suppose the query is  Content: xyz AND Ticket_Id: (123 OR 1234)  and here the search query i.e “xyz” was in the stop word list even then the search results were retrieved. Expected was none of the document be retrieved. Here I am getting the documents where “xyz”  is not at all there.
 
The debug query was q=Content:xyz+AND+Ticket_Id:4
 
When I used SolrAdmin I got that the parsed query from solr was omitting the search field (Content) as it is marked as stop word but was taking the Ticket_Id and giving me the results. 

My question is whether it is possible in Solr to fire the query where I want to retrieve the document having the search field(Content) only in the selected Ticket_Id.
 
Thanks in advance.
~ Sagar
 

 
> From: erik@ehatchersolutions.com
> To: solr-user@lucene.apache.org
> Subject: Re: Boolean query in Solr
> Date: Tue, 14 Apr 2009 09:33:27 -0400
> 
> 
> On Apr 14, 2009, at 5:38 AM, Sagar Khetkade wrote:
> 
> >
> > Hi,
> > I am using SolrJ and firing the query on Solr indexes. The indexed 
> > contains three fields viz.
> > 1. Document_id (type=integer required= true)
> > 2. Ticket Id (type= integer)
> > 3. Content (type=text)
> >
> > Here the query formulation is such that I am having query with “AND” 
> > clause. So the query, that I am firing on index files look like 
> > “Content: search query AND Ticket_id:123 Ticket_Id:789)”.
> 
> That query is invalid query parser syntax, with an unopen paren first 
> of all. I assume that's a typo though. Be careful in how you 
> construct queries with field selectors. Saying:
> 
> Content:search query
> 
> does NOT necessarily mean that the term "query" is being searched in 
> the Content field, as that depends on your default field setting for 
> the query parser. This, however, does use the Content field for both 
> terms:
> 
> Content:(search query)
> 
> 
> > I know this type of query is easily fired on lucene indexes. But 
> > when I am firing the above query I am not getting the required 
> > result . The result contains the document which does not belongs to 
> > the ticket id mentioned in the query.
> > Please can anyone help me out of this issue.
> 
> What does the query parse to with &debugQuery output? That's mighty 
> informative info.
> 
> Erik
> 

_________________________________________________________________
More than messages–check out the rest of the Windows Live™.
http://www.microsoft.com/india/windows/windowslive/

Re: Boolean query in Solr

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
On Apr 14, 2009, at 5:38 AM, Sagar Khetkade wrote:

>
> Hi,
> I am using SolrJ and firing the query on Solr indexes. The indexed  
> contains three fields viz.
> 1.       Document_id (type=integer required= true)
> 2.       Ticket Id (type= integer)
> 3.       Content (type=text)
>
> Here the query formulation is such that I am having query with “AND”  
> clause. So the query, that I am firing on index files look like   
> “Content: search query AND Ticket_id:123 Ticket_Id:789)”.

That query is invalid query parser syntax, with an unopen paren first  
of all.  I assume that's a typo though.  Be careful in how you  
construct queries with field selectors.  Saying:

     Content:search query

does NOT necessarily mean that the term "query" is being searched in  
the Content field, as that depends on your default field setting for  
the query parser.  This, however, does use the Content field for both  
terms:

    Content:(search query)


> I know this type of query is easily fired on lucene indexes. But  
> when I am firing the above query I  am not getting the required  
> result . The result contains the document which does not belongs to  
> the ticket id mentioned in the query.
> Please can anyone help me out of this issue.

What does the query parse to with &debugQuery output?   That's mighty  
informative info.

	Erik