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:

<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
Copyright (C) 2001-02, President and Fellows of Harvard University

This program is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. License
information is also available at http://www.gnu.org.
-->

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"; elementFormDefault="qualified">

	<xs:element name="boolean">
		<xs:complexType>
			<xs:choice maxOccurs="unbounded">
				<xs:element ref="term"/>
				<xs:element ref="group"/>
				<xs:element ref="boolean"/>
			</xs:choice>
			<xs:attribute name="type" type="xs:string" use="required"/>
		</xs:complexType>
	</xs:element>
	
	<xs:element name="group">
		<xs:complexType>
			<xs:choice maxOccurs="unbounded">
				<xs:element ref="term"/>
				<xs:element ref="group"/>
				<xs:element ref="boolean"/>
			</xs:choice>
		</xs:complexType>
	</xs:element>
	
	<xs:element name="mod">
		<xs:complexType>
			<xs:attribute name="type" type="xs:string" use="required"/>
			<xs:attribute name="multi" type="xs:boolean"/>
			<xs:attribute name="value" type="xs:byte"/>
		</xs:complexType>
	</xs:element>
	
	<xs:element name="query">
		<xs:complexType>
			<xs:choice maxOccurs="unbounded">
				<xs:element ref="term"/>
				<xs:element ref="group"/>
				<xs:element ref="boolean"/>
			</xs:choice>
		</xs:complexType>
	</xs:element>
	
	<xs:element name="term">
		<xs:complexType mixed="true">
			<xs:choice minOccurs="0" maxOccurs="unbounded">
				<xs:element ref="mod"/>
			</xs:choice>
			<xs:attribute name="field" type="xs:string" use="required"/>
		</xs:complexType>
	</xs:element>
	
</xs:schema>

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to