hibernate-search

Is @DocumentId required for Hibernate Search?

空扰寡人 提交于 2019-12-04 08:03:38
I'm using Hibernate Search and the documentation and books say I need @DocumentId on the id field so that Hibernate Search can know how to map the index to the objects. My code appears to be working fine without the @DocumentId anywhere in my code. Did Hibernate Search become smart enough to figure out that @Id field is a great default? Are there problems this will cause that are not obvious? Thanks for your time! @DocumentId is required if you are using the old-school style of mapping your entities with .hbm.xml files. If you are use that mapping approach and neglect to annotate a document id

SaaS / Multi-Tenancy approaches for Java-based (GWT, Spring, Hibernate) web applications

a 夏天 提交于 2019-12-04 07:41:27
问题 I am currently looking into converting a single-tenant Java based web-app that uses Spring, GWT, Hibernate, Jackrabbit, Hibernate Search / Lucene (among others) into a fully fledged SaaS style app. I stumbled across an article that highlights the following 7 "things" as important changes to make to a single tenant app to make it an SaaS app: The application must support multi-tenancy. The application must have some level of self-service sign-up. There must be a subscription/billing mechanism

Hibernate Search Order by child-count

拜拜、爱过 提交于 2019-12-04 06:25:21
问题 Consider: @Indexed @Entity public class TParent implements java.io.Serializable { ..... private Set<TChild> TChildSet = new HashSet<TChild>(0); @ContainedIn @OneToMany(cascade=CascadeType.ALL, fetch=FetchType.LAZY, mappedBy="TParent") public Set<TChild> getTChildSet() { return this.TChildSet; } A query would be something like this: FullTextQuery hibQuery = fullTextSession.createFullTextQuery( luceneQuery ); hibQuery.setSort( ... ) How can a sort-by-child-count be achieved? In other words, the

get the annotation information at runtime

早过忘川 提交于 2019-12-04 06:14:03
I wonder if there is any way I can get the annotation information of a class at runtime? Since I want to get the properties that sepcifily annotated. Example: class TestMain { @Field( store = Store.NO) private String name; private String password; @Field( store = Store.YES) private int age; //..........getter and setter } The annotations come from the hibernate-search,and now what I want is get which property of the "TestMain" is annotated as a 'field'(in the example,they are [name,age] ),and which is 'stored(store=store.yes)'(in the example,they are [ age ]) at runtime. Any ideas? UPDATe:

Getting error on a specific query

。_饼干妹妹 提交于 2019-12-04 04:09:46
Novice on Lucene here. I'm using it with Hibernate in a java client, and have been getting this error on a particular query: HSEARCH000146: The query string 'a' applied on field 'name' has no meaningfull tokens to be matched. Validate the query input against the Analyzer applied on this field. Search works fine for all other queries, even with empty resultset. My testing DB does have this record with 'a'. What could be wrong here? 'a' is a stopword, and will be filtered out of your query by the StandardAnalyzer. Stopwords are words which are common enough in the language your searching in, and

Hibernate Search in a Clustered Configuration?

喜你入骨 提交于 2019-12-03 14:30:03
I have a Java web app that I'm developing, using JBoss Seam as the application framework. I'd like to take advantage of Hibernate Search to provide entity searching capabilities. The integration has gone fine, and I'm getting closer to deployment. The setup for the app in production will be: 2 (or more) Tomcat app servers, load balanced PostgreSQL database on the backend My question is, how can I configure Hibernate Search so that the local Lucene indices are updated on App Server #2 when an entity is persisted on App Server #1, and vice versa? Does Hibernate Search have any sort of clustered

How to search fields with wildcard and spaces in Hibernate Search

徘徊边缘 提交于 2019-12-03 14:04:07
I have a search box that performs a search on title field based on the given input, so the user has recommended all available titles starting with the text inserted.It is based on Lucene and Hibernate Search. It works fine until space is entered. Then the result disapear. For example, I want "Learning H" to give me "Learning Hibernate" as the result. However, this doesn't happen. could you please advice me what should I use here instead. Query Builder: QueryBuilder qBuilder = fullTextSession.getSearchFactory() .buildQueryBuilder().forEntity(LearningGoal.class).get(); Query query = qBuilder

lucene index not getting sync when any update occurs in DB through hibernate

牧云@^-^@ 提交于 2019-12-03 08:18:49
I am working on some POC stuff on Hibernate Search based on Lucene using below env: hibernate-search-engine-4.4.2.Final.jar lucene-core-3.6.2.jar MySQL 5.5 Use @Indexed annotation on domain class. Use @Field(index=Index.YES, analyze=Analyze.YES, store=Store.NO) over field. Use @IndexedEmbedded over collection of Instance of different domain class. I did explicit indexing ONLY on start of application (as this is written in Hibernate Search API that Hibernate Search will transparently index every entity persisted, updated or removed through Hibernate Core, Hibernate Search Indexing ) through

How do I use boolean operators with Hibernate Search

两盒软妹~` 提交于 2019-12-03 07:02:06
I'm learning the Hibernate Search Query DSL , and I'm not sure how to construct queries using boolean arguments such as AND or OR. For example, let's say that I want to return all person records that have a firstName value of "bill" or "bob". Following the hibernate docs, one example uses the bool() method w/ two subqueries, such as: QueryBuilder b = fts.getSearchFactory().buildQueryBuilder().forEntity(Person.class).get(); Query luceneQuery = b.bool() .should(b.keyword().onField("firstName").matching("bill").createQuery()) .should(b.keyword().onField("firstName").matching("bob").createQuery())

SaaS / Multi-Tenancy approaches for Java-based (GWT, Spring, Hibernate) web applications

拥有回忆 提交于 2019-12-02 14:04:55
I am currently looking into converting a single-tenant Java based web-app that uses Spring, GWT, Hibernate, Jackrabbit, Hibernate Search / Lucene (among others) into a fully fledged SaaS style app. I stumbled across an article that highlights the following 7 "things" as important changes to make to a single tenant app to make it an SaaS app: The application must support multi-tenancy. The application must have some level of self-service sign-up. There must be a subscription/billing mechanism in place. The application must be able to scale efficiently. There must be functions in place to