-->
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.  [ 4 posts ] 
Author Message
 Post subject: querying unindexed properties
PostPosted: Wed Oct 29, 2008 12:23 pm 
Newbie

Joined: Wed Oct 29, 2008 12:15 pm
Posts: 2
hi all,
i'm trying to query unindexed properties, but using the lucene query syntax. maybe any can help me.
i'm using the jpa and have an User entity with a status property.

Code:
MultiFieldQueryParser parser = new MultiFieldQueryParser(
new String[] { "status" }, new SimpleAnalyzer());
org.apache.lucene.search.Query query = parser.parse("status:active");
FullTextQuery hibQuery = fullTextEntityManager.createFullTextQuery(query, User.class);
List<User> result = hibQuery.getResultList();


the result has always no entries! what is wrong?
thanks,
asp


Top
 Profile  
 
 Post subject:
PostPosted: Fri Oct 31, 2008 12:04 pm 
Hibernate Team
Hibernate Team

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

I am not sure what you are trying to say with - "trying to query unindexed properties". If something is not indexed you can of course not search for it in the Lucene index. Well, you can, but of course your result set will be empty.

In case there is a misunderstanding, just post your fully annotated User class and the code you use to index and then search the User entity.

--Hardy


Top
 Profile  
 
 Post subject:
PostPosted: Sat Nov 15, 2008 9:30 am 
Newbie

Joined: Wed Oct 29, 2008 12:15 pm
Posts: 2
thanks for your answer hardy,

that' exaclty the problem:
Quote:
> If something is not indexed you can of course not search for it in the Lucene index.

the property "status" which i searched for is not indexed, so that any query on it returned no result.
my thought is that it could happen that i want to search any unindexed property in future releases of my application and that the nice lucene query syntax can be applied to these unindexed properties.

if it is not possible, thats a pity, but i know about it and can go on!

ciao,
asp


Top
 Profile  
 
 Post subject:
PostPosted: Mon Nov 17, 2008 6:25 am 
Hibernate Team
Hibernate Team

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

If you want to search on an unindexed property at a later stage you just have to add @indexed to the entity, redeploy your application and rebuild your index.

Or you just index the property right from the beginning, but just never search on on it for now. Of course this might increase the index size and impact the performace. However, that depends on the problem size and use case.

--Hardy


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 4 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.