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 Paul Libbrecht <pa...@activemath.org> on 2005/04/14 17:32:17 UTC

Reverting QueryParser ?

	
Hi,

I am currently evaluating the need for an elaborate query 
data-structure (to be exchanged over XML-RPC) as opposed to working 
with plain strings.

One thing that would heavily vote for strings would be to have query 
objects returned by Query-parser reconvertible to a string (and back).

did anyone did this ?

thanks

paul


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


Re: Reverting QueryParser ?

Posted by Doug Cutting <cu...@apache.org>.
Paul Libbrecht wrote:
> I am currently evaluating the need for an elaborate query data-structure 
> (to be exchanged over XML-RPC) as opposed to working with plain strings.

I'd opt for both.  For example:

<search>
   <boolean-query>
     <required>
       <query-parser analyzer="...">"java based" -coffee</query-parser>
     <required>
       <term-query>
         <field>site</field>
         <text>apache.org</text>
       </term-query>
   </boolean-query>
   <range-filter>
     <field>date</field>
     <start>2004</start>
     <end>2006</end>
   </range-filter>
   <sort>
     <field>date</field>
   </sort>
</search>

This would be a natural thing to generate, e.g., from an "advanced 
search" page.

Doug

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


Re: Reverting QueryParser ?

Posted by Pierrick Brihaye <pi...@free.fr>.
Hi,

Erik Hatcher a écrit :

> No, this hasn't been done except for the basic Query.toString() output 
> which for the most part is parsable again.
> 
> The question is, what do you do about the analysis process?  It's a 
> one-way transformation - and parsing again may not yield the same query.

We (the SDX developpers) have had quite the same need, i.e. to make a 
QueryParsed String parsable again, more often than most of the cases :-)

In fact, we did half of the job ; I mean... prevent analysis :-)

Look at 
http://savannah.nongnu.org/cgi-bin/viewcvs/sdx/sdx_v2/src/java/fr/gouv/culture/sdx/search/lucene/queryparser/DefaultQueryParser.jj?rev=1.16&content-type=text/vnd.viewcvs-markup

and search for : NO_ANALYSIS

You will see that we need an "UnanalyzedQuery" class which is already 
packaged for Lucene ;-)

http://savannah.nongnu.org/cgi-bin/viewcvs/sdx/sdx_v2/src/java/org/apache/lucene/search/UnanalyzedQuery.java?rev=1.4&content-type=text/vnd.viewcvs-markup

The other half could be done by a method like OriginalQuery(String 
field) that would return this kind of string representation :

field:re_analyze_me (i.e. the original token)

or, the SDX way, modify the existing Query(String field) so that it 
would return this kind of string representation :

field:|alreay_analyzed_no_need_to_reanalyze_me|

What do you think ?

Cheers,

p.b.



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


Re: Reverting QueryParser ?

Posted by Erik Hatcher <er...@ehatchersolutions.com>.
On Apr 14, 2005, at 11:32 AM, Paul Libbrecht wrote:

> 	
> Hi,
>
> I am currently evaluating the need for an elaborate query 
> data-structure (to be exchanged over XML-RPC) as opposed to working 
> with plain strings.
>
> One thing that would heavily vote for strings would be to have query 
> objects returned by Query-parser reconvertible to a string (and back).
>
> did anyone did this ?

No, this hasn't been done except for the basic Query.toString() output 
which for the most part is parsable again.

The question is, what do you do about the analysis process?  It's a 
one-way transformation - and parsing again may not yield the same 
query.

	Erik


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