lucenenet-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "George Aroush" <geo...@aroush.net>
Subject RE: Extending QueryParser
Date Wed, 18 Oct 2006 01:47:38 GMT
Hi,

I am sorry, but I don't understand what you are trying to achieve.  Maybe
someone else can offer some help.  I don't believe the code you highlighted
has any issues for the reason that I pointed out earlier -- this code hasn't
changed since Lucene 1.4 (or even earlier) and is the same in the Java
version.

Regards,

-- George Aroush


-----Original Message-----
From: Vietpd [mailto:vietpd@ht2d.com] 
Sent: Monday, October 16, 2006 4:20 AM
To: 'Archives'
Subject: Re:Extending QueryParser

Hi, 

I will try to explain my example:

I wrote my parser to parse query for my indexed data, I extended it from
QueryParser. My data was indexed with 3 fields: title, text and description.
For every common queries like: +Dotlucene or -Dotlucene, my parser must
provide a query like this +(title:Dotlucent text:Dotlucene
description:Dotlucene) or  -title:Dotlucent -text:Dotlucene
-description:Dotlucene respectively,.. 

I overrode GetBooleanQuery and AddClause method. In GetBooleanQuery method,
I did my logic to I replaced queries with a random field (field which I
created it to be replace) by queries with fields title, text, description.
In AddClause method, I did my logic to add a clause if it satified some
conditions.

The problem is that, when I parse a query which has only one not null
clause, then the code

 
if (clauses.Count == 1 && firstQuery != null) {
      if (true)
            return firstQuery;
}
else
{
      {
            if (true)
                  return GetBooleanQuery(clauses);
      }
}

 

 

will not call the GetBooleanQuery for me to replace the random field in
queries.

 

I think, this is not only the problem for me, but for anyone who extends
QueryParser and wants to do some logics in GetBooleanQuery and AddClause
method. AddClause method only call GetBooleanQuery when the number clauses
in the query is greater than one, unless the Parse method will return the
query immediately after calling AddClause without calling GetBooleanQuery.
This is abnormal flow of calling inside the QueryParser class.

 

Thanks and best regards,



Mime
View raw message