I expressed the idea of formalizing an xml spec for defining search
queries. My idea is that it would look something like the following
<?xml version="1.0" encoding="UTF-8"?>
<query>
<boolean type="and">
<term field="character">Bird</term>
<group>
<term field="category">Cartoon</term>
<boolean type="not">
<term field="name">Roadrunner</term>
</boolean>
</group>
</boolean>
</query>
Could be used to express the following Lucene query:
character:Bird AND (category:Cartoon NOT name:Roadrunner)
The reason for expressing the syntax in xml it to facilitate the use of
generic technologies for filtering and manipulating the query (SAX XSLT
etc).
So, say I have 4 different "Index Services" that have the similar
information stored under different fields. So I might want to translate
the query above into the following:
Server 1:
character:Bird AND (category:Cartoon NOT name:Roadrunner)
Server 2:
character:Bird AND (grouping:Cartoon NOT title:Roadrunner)
Server 3:
character=Bird AND (grouping=Cartoon -name=Roadrunner)
Server 4:
(& character=Bird (grouping=Cartoon (!name=Roadrunner)))
Now I can write SAX Filters that will generate the appropriate query for
each "Index Service".
This makes XML the stepping stone to easily get from one syntax to
another. All that needs to be written to map each syntax is:
1.) A SAX parser to generate SAX events from the query string.
2.) A ContentHandler to generate a query string from SAX events.
these can then be combined with other parsers/handlers to translate from
any syntax to another mapped syntax.
I know this is probibly outside the scope of Lucene itself as a project.
But it would be interesting if such a standard arose for query syntax,
then if Lucene supported such features it would make it even easier for
others to integrate it into their present "legacy" Search Services.
Imagine, you could install a Lucene Service and write a Parser/Handler
to map your "legacy" systems queries directly into Lucene syntax, then
it could start acting just like your "legacy" service.
-Mark Diggory
p.s.
I've attached an example schema representation of the syntax (dubed
QueryML.)
Of course this does not explore other issues that may arise when trying
to collect a multitude of results from different sources (like merging...).
Otis Gospodnetic wrote:
> There is no such standard that I know of, although somebody mentioned
> inventing(?) Query Markup Language (QML, an abbreviation already used
> for things other than Query Markup Language) the other day on either
> -user or -dev.
>
> Otis
>
> --- Pier Fumagalli wrote:
>
> >Heyoo to all...
> >
> > Simple question, I have to create a "service" for searching
> >throughout
> >our database of articles (funny enough) on www.vnunet.com...
> >
> >The idea is to send a search query in XML, and return the matched
> >items in
> >XML again, and then styling them...
> >
> >Question: is there a standard dtd/schema for those kinds of XML
> >"transactions" ??? Or should I just invent my own? Pointers, anyone?
> >
> > Pier
> >
> >
> >--
> >To unsubscribe, e-mail:
> >
> >For additional commands, e-mail:
> >
> >
>
>
> __________________________________________________
> Do you Yahoo!?
> Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
> http://mailplus.yahoo.com
>
> --
> To unsubscribe, e-mail:
> For additional commands, e-mail: