You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-user@lucene.apache.org by Stray Toaster <mw...@stray-toaster.co.uk> on 2003/03/07 13:51:51 UTC

Unusual query results

Hi there.

Consider the following examples that I do while searching:

fun    -> 19 results
fun () -> 0 results
fun "" -> ParseException


Help! I really don't want to get ParseException thrown.
(I am using Lucene version 1.2.)

Anyone any ideas? (I am adverse to saying this is a bug, but rather that
I am doing something silly. As I run this on a (private) site, I don't
want my users spotting anything silly. Where users is currently defined
as me!)

m.
-- 
Charlotte-Ann: *wail*
Val: What's up, wee girl?
Charlotte-Ann: I have just spilt juice on my Penelope Busstop teeshirt!

--
Family ties : http://www.thefamilykerr.co.uk
Playtime    : http://www.stray-toaster.co.uk

---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-user-help@jakarta.apache.org


Re: Unusual query results

Posted by Marty Pauley <ma...@kasei.com>.
I'm using the same system as the Stray Toaster, so I'll chip in.

> fun    -> 19 results
> fun () -> 0 results
> fun "" -> ParseException


On Fri Mar  7 06:33:30 2003, Otis Gospodnetic wrote:
> () and "" are special characters (in QueryParser realm).  You could try
> escaping them with \.  Make sure you use an Analyzer that doesn't strip
> that character though.  WhitespaceAnalyzer won't strip them, for
> example.

That's not the problem.  We were expecting [ fun () ] to produce the
same results as [ fun ].  I thought that a Term combined with an empty
Query should be the same as the Term alone.  What I wasn't sure about
was if an empty Query was allowed.

The results with an empty phrase confused me more.

I had a look at the syntax explanation in the faq and assumed the three
examples above would parse as:

  fun    -> Query(Clause(BasicClause(Term("fun"))))
  fun () -> Query(
              Clause(BasicClause(Term("fun"))),
              Clause(BasicClause(Query(Clause(BasicClause(Term(""))))))
	    )
  fun "" -> Query(
              Clause(BasicClause(Term("fun"))),
              Clause(BasicClause(Phrase(Term(""))))
	    )

I was not sure if a Term could be empty, so I tried both.  I would
expect [ fun () ] and [ fun "" ] to behave the same way: either they
both throw ParseException or both do nothing.

-- 
Marty

---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-user-help@jakarta.apache.org


Re: Unusual query results

Posted by Otis Gospodnetic <ot...@yahoo.com>.
() and "" are special characters (in QueryParser realm).  You could try
escaping them with \.  Make sure you use an Analyzer that doesn't strip
that character though.  WhitespaceAnalyzer won't strip them, for
example.

Otis


--- Stray Toaster <mw...@stray-toaster.co.uk> wrote:
> Hi there.
> 
> Consider the following examples that I do while searching:
> 
> fun    -> 19 results
> fun () -> 0 results
> fun "" -> ParseException
> 
> 
> Help! I really don't want to get ParseException thrown.
> (I am using Lucene version 1.2.)
> 
> Anyone any ideas? (I am adverse to saying this is a bug, but rather
> that
> I am doing something silly. As I run this on a (private) site, I
> don't
> want my users spotting anything silly. Where users is currently
> defined
> as me!)
> 
> m.
> -- 
> Charlotte-Ann: *wail*
> Val: What's up, wee girl?
> Charlotte-Ann: I have just spilt juice on my Penelope Busstop
> teeshirt!
> 
> --
> Family ties : http://www.thefamilykerr.co.uk
> Playtime    : http://www.stray-toaster.co.uk
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: lucene-user-help@jakarta.apache.org
> 


__________________________________________________
Do you Yahoo!?
Yahoo! Tax Center - forms, calculators, tips, more
http://taxes.yahoo.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: lucene-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: lucene-user-help@jakarta.apache.org