You are viewing a plain text version of this content. The canonical link for it is here.
Posted to general@lucene.apache.org by aneuryzma <pa...@gmail.com> on 2011/02/25 18:46:13 UTC

how to build complex xml-based queries with Apache Lucene ?

I need to build a xml-based query with Apache Lucene.

My docs have this format:

    <doc>
    <id>361492799</id>
    <title>Dan1</title>
    <description>We had another Flickr meetup in Rochester, the biggest that
Ive been to. 12 people showed up.Da, he was to the right.</description>
    <time>18934934</time>
    <tags>flickrmeetup rochester dan totheright 200701</tags>
    <geo><latitude>324234</latitude><longitude>28342349</longitude></geo>
    <event>135961</event>
    </doc>

and the query is actually also a document that I need to compare with the
entire collection. Each attribute has a different similarity metric. e.g.
description has tf-idf cosine similarity. Time is just the difference and
"latitude" + "longitude" is compared using the harvesine distance.

For now I've only performed searches with simple textual queries such as
"word1 word2". How can I build more complex queries instead ?

thanks
-- 
View this message in context: http://lucene.472066.n3.nabble.com/how-to-build-complex-xml-based-queries-with-Apache-Lucene-tp2576872p2576872.html
Sent from the Lucene - General mailing list archive at Nabble.com.

Re: how to build complex xml-based queries with Apache Lucene ?

Posted by Chris Hostetter <ho...@fucit.org>.
: I need to build a xml-based query with Apache Lucene.
	...
: and the query is actually also a document that I need to compare with the
: entire collection. Each attribute has a different similarity metric. e.g.
: description has tf-idf cosine similarity. Time is just the difference and
: "latitude" + "longitude" is compared using the harvesine distance.
: 
: For now I've only performed searches with simple textual queries such as
: "word1 word2". How can I build more complex queries instead ?

First off, it doesn't actaully sound like you have any real requirement to 
use "xml-based queries" ... your data just happens to be in XML, and you 
wnat to query using other data that also happens to be in XML.

Second: it's not clear if you want to use the Lucene Java API directly, or 
if you wnat to use Solr -- depending on the answer to that question, i 
would suggest you send a (more detailed) description of your problem to 
the approriate user list (java-user@lucene or solr-user@lucene)

In general: mixing text based tf/idf queries with distance based queries 
is completley possible -- all things in Lucene are ultimately a Query 
object, which decides what Scoring to perform, and Lucene has Query types 
that support all of the functionality you've described.



-Hoss