lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Otis Gospodnetic <otis_gospodne...@yahoo.com>
Subject Re: Searching API: QueryParser vs Programatic queries
Date Mon, 22 May 2006 14:59:07 GMT
Dave,
You said you are new to Lucene and you didn't mention this class explicitly, so you may not
be aware of it yet: PerFieldAnalyzerWrapper.
It sounds like this may be what you are after.

Otis

----- Original Message ----
From: "Irving, Dave" <dave.irving@logicacmg.com>
To: java-user@lucene.apache.org
Sent: Monday, May 22, 2006 5:15:23 AM
Subject: Searching API: QueryParser vs Programatic queries

Hi,

Im very new to Lucene - so sorry if my question seems pretty dumb.

In the application Im writing, I've been "struggling with myself" over
whether I should be building up queries programatically, or using the
Query Parser.

My searchable fields are driven by meta-data, and I only want to support
a few query types. It seems "cleaner" to build the queries up
programatically rather than converting the query to a string and
throwing it through the QueryParser.

However, then we hit the problem that the QueryParser takes care of
Analysing the search strings - so to do this we'd have to write some
utility stuff to perform the analysis as we're building up the queries /
terms.

And then I think "might as well just use the QueryParser!".

So here's what Im wondering (which probably sounds very dumb to
experienced Lucene'rs):

- Is there maybe some room for more utility classes in Lucene which make
this easier? E.g: When building up a document, we don't have to worry
about running content through an analyser - but unless we use
QueryParser, there doesn't seem to be corresponding behaviour on the
search side.
- So, Im thinking some kind of factory / builder or something, where you
can register an Analyser (possibly a per field wrapper), and then it is
applied per field as the query is being built up programatically.

Maybe this is just an "extraction" refactoring to take this behaviour
out of QueryParser (which could delegate to it).

The result could be that more users opt for a programatic build up of
queries (because it's become easier to do..) rather than falling back on
QueryParser in cases where it may not be the best choice.


Sorry if I rambled too much :o)

Dave


This e-mail and any attachment is for authorised use by the intended recipient(s) only. It
may contain proprietary material, confidential information and/or be subject to legal privilege.
It should not be copied, disclosed to, retained or used by, any other party. If you are not
an intended recipient then please promptly delete this e-mail and any attachment and all copies
and inform the sender. Thank you.

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





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


Mime
View raw message