-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: Query all dynamic fields
PostPosted: Wed Nov 30, 2011 10:21 am 
Newbie

Joined: Mon Nov 28, 2011 8:21 am
Posts: 3
Hi,

I need a way to query all the fields in the indexed entity. The problem is that those fields are dynamically created, depending on the languages of translation and the data of the concrete entity instance. For example:

I have a Document entity. The Document has a list of Epigraphs. Each Epigraph is translated in multiple languages, so its content is indexed creating dynamic fields depending on the existing translations. The Epigraphs that a Document can contain are well defined and are always the same, but almost all of then are not required. So, the asigned Epigraphs are diferent depending on the Document instance. So far there is not any dificult...

The problem arises when analyzing the requirements for the queries. To query the documents, I need to boost some Epigraphs according to some conditions and gather some statistic data by Epigraph (for example to know the Epigraphs where the query matches). Therefore, I need to index each Epigraph in a diferent field, uniquely identified accross each document. To do this, in my FieldBridge I created a unique field named based on that Epigraph's "id" and the language of translation.

In short, I don't know how to make a query to all the Document fields, because the content of each Epigraph is indexed in a dynamic field (which I know its name) but no all Documents has all of the Epigraphs (can get exceptions due to unexistent fields).

Is there any way in Hibernate Search to make a query in all the entity's fields without having to specified each one by its name?

Thanks in advance. Any comment will be helpful.


Top
 Profile  
 
 Post subject: Re: Query all dynamic fields
PostPosted: Fri Dec 02, 2011 4:18 am 
Hibernate Team
Hibernate Team

Joined: Thu Apr 05, 2007 5:52 am
Posts: 1689
Location: Sweden
Hi,

you need to specify a field name. There is no way to search accross all fields.

Quote:
In short, I don't know how to make a query to all the Document fields, because the content of each Epigraph is indexed in a dynamic field (which I know its name) but no all Documents has all of the Epigraphs (can get exceptions due to unexistent fields).


No, you won't get an exception. If the field does not exist Lucene just does not consider it for the search. If you search on a field name which does not occur in any document you just get an empty result set.

--Hardy


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.