RE: QueryParsing

2004-10-19 Thread Rupinder Singh Mazara
hi erik and everyone else

 ok i will buy the book ;)
but this still does not solve the problem of
 why String x = \jakarta apache\~100; is being transalted as a
PhraseQuery
  FULL_TEXT:jakarta apache~100

 is the correct query beining formed ?  or is there something wrong with the
 Proximity Search topic in the URL
http://jakarta.apache.org/lucene/docs/queryparsersyntax.html


 Regards

 Rupinder

-Original Message-
From: Erik Hatcher [mailto:[EMAIL PROTECTED]
Sent: 18 October 2004 21:05
To: Lucene Users List
Subject: Re: QueryParsing


QueryParser does not (currently) support SpanQuery's.  PhraseQuery is
what you'll always get with double-quoted strings.  However, you can
customize the behavior and get a SpanQuery instead by subclassing and
overriding getPhraseQuery.  In fact, this is an example I wrote for
Lucene in Action.

   Erik


On Oct 18, 2004, at 2:39 PM, Rupinder Singh Mazara wrote:

 hi all

  i have a question regarding the QueryParser and Proximity Searches
  I executed the following piece of code

 String x = \jakarta apache\~100;
 QueryParser parser = new QueryParser(FULL_TEXT,new
 StandardAnalyzer() );
 parser.setOperator( QueryParser.DEFAULT_OPERATOR_AND );
 Query query = parser.parse(x);
 System.out.println(query.getClass()+ - +query.toString());

 IndexReader indexReader = IndexReader.open(  new File(luceneroot)
 );

 query =  query.rewrite(indexReader);
 System.out.println(query.getClass()+ - +query.toString());

 in both System.out.println I get the following result
 class org.apache.lucene.search.PhraseQuery - FULL_TEXT:jakarta
 apache~100

 is this correct, I was expecting to see a SpanQuery being formed  at
 the
 second println statement


 I have take this from the example in
 http://jakarta.apache.org/lucene/docs/queryparsersyntax.html

 If I remove the quotes I see a QueryParsing error which tell me that
 the
 Similarity should be between 0.0 and 1.0
 which is as expected

 please let me know if I missed something


 Regards


 Rupinder


 -
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 For additional commands, e-mail: [EMAIL PROTECTED]


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: QueryParsing

2004-10-19 Thread Morus Walter
Rupinder Singh Mazara writes:
 hi erik and everyone else
 
  ok i will buy the book ;)
 but this still does not solve the problem of
  why String x = \jakarta apache\~100; is being transalted as a
 PhraseQuery
   FULL_TEXT:jakarta apache~100
 
  is the correct query beining formed ?  or is there something wrong with the
  Proximity Search topic in the URL
 http://jakarta.apache.org/lucene/docs/queryparsersyntax.html
 
A proximity search is done by a PhraseQuery with a slop.
The slop makes the PhraseQuery to perform a proximity search (so you can
argue that the name is problematic).
That's what query parser creates.

SpanQueries where introduced later. Maybe you can get the effect of a
proximity search by SpanQueries also, but that's not handled by the query
parser.

Morus

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: QueryParsing

2004-10-19 Thread Rupinder Singh Mazara
thank you Morus

this makes things very clear to me 

Regards

Rupinder


-Original Message-
From: Morus Walter [mailto:[EMAIL PROTECTED]
Sent: 19 October 2004 10:05
To: Lucene Users List
Subject: RE: QueryParsing


Rupinder Singh Mazara writes:
 hi erik and everyone else
 
  ok i will buy the book ;)
 but this still does not solve the problem of
  why String x = \jakarta apache\~100; is being transalted as a
 PhraseQuery
   FULL_TEXT:jakarta apache~100
 
  is the correct query beining formed ?  or is there something 
wrong with the
  Proximity Search topic in the URL
 http://jakarta.apache.org/lucene/docs/queryparsersyntax.html
 
A proximity search is done by a PhraseQuery with a slop.
The slop makes the PhraseQuery to perform a proximity search (so you can
argue that the name is problematic).
That's what query parser creates.

SpanQueries where introduced later. Maybe you can get the effect of a
proximity search by SpanQueries also, but that's not handled by the query
parser.

Morus

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: QueryParsing

2004-10-18 Thread Erik Hatcher
QueryParser does not (currently) support SpanQuery's.  PhraseQuery is 
what you'll always get with double-quoted strings.  However, you can 
customize the behavior and get a SpanQuery instead by subclassing and 
overriding getPhraseQuery.  In fact, this is an example I wrote for 
Lucene in Action.

Erik
On Oct 18, 2004, at 2:39 PM, Rupinder Singh Mazara wrote:
hi all
 i have a question regarding the QueryParser and Proximity Searches
 I executed the following piece of code
String x = \jakarta apache\~100;
QueryParser parser = new QueryParser(FULL_TEXT,new
StandardAnalyzer() );
parser.setOperator( QueryParser.DEFAULT_OPERATOR_AND );
Query query = parser.parse(x);
System.out.println(query.getClass()+ - +query.toString());
IndexReader indexReader = IndexReader.open(  new File(luceneroot) 
);

query =  query.rewrite(indexReader);
System.out.println(query.getClass()+ - +query.toString());
in both System.out.println I get the following result
class org.apache.lucene.search.PhraseQuery - FULL_TEXT:jakarta 
apache~100

is this correct, I was expecting to see a SpanQuery being formed  at 
the
second println statement

I have take this from the example in
http://jakarta.apache.org/lucene/docs/queryparsersyntax.html
If I remove the quotes I see a QueryParsing error which tell me that 
the
Similarity should be between 0.0 and 1.0
which is as expected

please let me know if I missed something
Regards
Rupinder
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]