Re: Querying across object relationships

2009-07-29 Thread Phil Whelan
Hi Don, On Wed, Jul 29, 2009 at 1:42 PM, Donal Murtagh wrote: >    Course.name   Attendance.mandatory   Student.name >    - >    cooking                        N                      Bob >    art                                Y                      

Re: Querying across object relationships

2009-07-30 Thread Donal Murtagh
Hi Phil, I don't really have any query parsing/generation code to send you, because I'm not using Lucene directly. I'm using the Grails Searchable Plugin, which builds on both Lucene and Compass. The only relevant information I can give you is my Grails domain classes which show how I've mapped m

Re: Querying across object relationships

2009-07-30 Thread Lukáš Vlček
Hi, this is interesting but why do you use "AND" in your query when both the term are a MUST (they have +). See http://lucene.apache.org/java/2_4_1/queryparsersyntax.html for more details about Lucene query syntax. Try dropping the AND and try the following query: +courseName:cooking +mandatory:Y

Re: Querying across object relationships

2009-07-30 Thread Donal Murtagh
Hi, I tried your suggestion: "+courseName:cooking +mandatory:Y" but it still matches the student who attends a non-mandatory cooking course, and another mandatory course, which is not what I want. The only reason I was using "AND" in my query, was to be explicit about how the predicates should b

RE: Querying across object relationships

2009-07-30 Thread Steven A Rowe
Hi Donal, I'm not familiar with Compass annotations, so forgive my ignorance, but it's not clear to me what your documents look like, or how a Lucene document corresponds to your objects. What does the document you get as a hit when you search look like? That is, what fields are defined on it

Re: Querying across object relationships

2009-07-30 Thread Donal Murtagh
Basically the classes I'm indexing have the following relationships: Student 1--* Attendance 1--* Course The only root class is Student, i.e. only instances of this class can be returned from a search. I have a Student object graph that could be represented in JSON as follows: { name:

Re: Querying across object relationships

2009-07-30 Thread Lukáš Vlček
Don, To me it seems as if there is only one document in your index, and moreover the only document has mutifield courseName and mandatory fields (this means you will get the same result even if you query +courseName:art +mandatory:N). Do you think you can share how you create your domain objects an

RE: Querying across object relationships

2009-07-30 Thread Steven A Rowe
tch. Steve > -Original Message- > From: Donal Murtagh [mailto:domur...@yahoo.co.uk] > Sent: Thursday, July 30, 2009 3:10 PM > To: java-user@lucene.apache.org > Subject: Re: Querying across object relationships > > Basically the classes I'm indexing have the followin

Re: Querying across object relationships

2009-07-30 Thread Lukáš Vlček
ourse and also > attends a mandatory course?". Bob is a match. > > Steve > > > -Original Message----- > > From: Donal Murtagh [mailto:domur...@yahoo.co.uk] > > Sent: Thursday, July 30, 2009 3:10 PM > > To: java-user@lucene.apache.org > > S

Re: Querying across object relationships

2009-07-30 Thread Lukáš Vlček
;> >> In Lucene-land, the query (+courseName:cooking +mandatory:Y) matches the >> above document, because the document contains those values in those fields. >> >> So with that query, based on the Lucene document structure, you seem to be >> asking the question: "Whic

Re: Querying across object relationships

2009-07-30 Thread Renaud Delbru
Hi Donal, We released SIREn [1], a plugin for Lucene that allows indexing and querying of semi-structured data, a few days ago. Your use case seems to match perfectly what SIREn can do. SIREn enables the indexing of semi-structured data into a Lucene field, and offers additional query compon

Re: Querying across object relationships

2009-07-30 Thread Paolo DiCanio
The domain classes are defined as Groovy classes with compass annotations (see my original post). Each class maps directly to a DB table and when the application starts up, Compass automatically reads the relevant tables and adds the data to the index. Lukáš Vlček wrote: > > Don, > To me it se

RE: Querying across object relationships

2009-07-30 Thread Paolo DiCanio
So with that query, based on the Lucene document structure, you seem to be > asking the question: "Which student attends a cooking course and also > attends a mandatory course?". Bob is a match. > > Steve > >> -----Original Message- >> From: Donal Murtagh

Re: Querying across object relationships

2009-07-30 Thread Lukáš Vlček
ng +mandatory:Y) matches the > > above document, because the document contains those values in those > > fields. > > > > So with that query, based on the Lucene document structure, you seem to > be > > asking the question: "Which student attends a cooking course and also