How to use Lucene to index data with EclipseLink [duplicate] - java

I am trying to use Lucene with EclipseLink, and was wondering if there are any good integration libraries out there? I have seen solar-flare, and it looks lime it might do what I want, but it's out of date (although i have an older version of EclipseLink, I am using 4.10 of Lucene) That may work, but I cant find any documentation, examples or tutorials on how to use it.
Any advice would be appreciated (I dont believe we can switch to Hibernate either)
Thanks in advance

If you are ready to use Lucene via a server you can use Solr (with SolrJ)
SolJ provide to you the annotations to annotate your Pojo (look at this: https://wiki.apache.org/solr/Solrj#Directly_adding_POJOs_to_Solr)

Related

How to use Lucene FieldCache for search speed improvement?

I am using Lucene 3.6 and i am trying to implement FieldCache. I have seen some posts but did not get any clear idea. Can anyone please suggest me any link where i can find proper example of FieldCache and how to use it while searching.
You dont typically use it directly, it is an internal API used by Lucene.
If you are extending Lucene's search API and need to use it, you will need to provide more details.

Alternatives to DDLUtils from apache

I would like to know which alternatives exist to replace DDL utils from Apache.
I ask this because ddlutils project seams to be Dead, and also it does not support H2 Databases. I've searched for it, and I found suggestions like liquidbase or flyway.
My problem is: These frameworks run when project starts and change DB structure based on some XML files. They are really designed for Database Migration.
What I want is a framework to CREATE/ALTER Tables in Runtime, in a high abstraction level., i.e. supportting at least Mysql, Sqlserver, oracle, and H2.
For example I could tell to the engine that I want to create a table with a Field AGE with Type Number, and the framework would rephrase to:
create table MY( id bigint(20))
create table MY(id bigint)
create table MY (id, number)
depending on the underlying db engine.
Any suggestions?
I could see there is a patch for ddlutils, for it to support H2. However I wasn't able to patch my svn checkout...
Any help will be appreciated.
thanks in advance
rui
I know this is an old thread, but wanted to give a definitive answer.
Yes, DdlUtils is dead, hasn't seen an update in 2 years now.
However, it looks like the guys might have switched over to https://www.symmetricds.org. Their repo is https://github.com/JumpMind/symmetric-ds.
As soon as you scratch away at the surface, you'll find that the core of DdlUtils is still in there (even has some of the old Apache copyright notices).
Class names have changed, APIs have changed so there is not a 1-to-1 mapping, but it is getting regular updates and includes H2 and other database support. Honestly I'd rather be getting those things instead of keeping the old APIs.
You're not going to find a guide on using Symmetric DS in the same way as the old DdlUtils doco, but there is enough in the code that you should be able to piece it together.
Take a look on jOOQ it is very useful in generating DDL (and DML too)
create.createTable("table")
.column("column1", INTEGER)
.column("column2", VARCHAR(10).nullable(false))
.constraints(
constraint("pk").primaryKey("column1"),
constraint("uk").unique("column2"),
constraint("fk").foreignKey("column2").references("some_other_table"),
constraint("ck").check(field(name("column2")).like("A%"))
)
.execute();
This looks promising: https://bitbucket.org/aragot/play-sql-dialects/src
At least as a start.
Mogwai ERD designer might help though they do not formally support H2 but you could put H2 into compatibility mode with one of the supported DB systems: https://sourceforge.net/p/mogwai

Implementing full text search in Java EE

I am making an application where I am going to need full text search so I found Compass, but that project is no longer maintained and is replaced by elasticsearch. However I don't understand it. Is it a own server that I need to do requests (get, put) etc against and then parse the JSON response? Are there no annotations like in Compass? I don't understand how this is a replacement and how I use it with Java EE.
Or are there other better projects to use?
Elasticsearch is a great choice nowadays, if you liked Compass you'll love it. Have a look at this answer that the author gave here on which he explains why he went ahead creating elasticsearch after Compass. In fact elasticsearch and Solr make both the use of Lucene pretty easy, adding also some features to it. You basically have a whole search engine server which is able to index your data, which you can then query in order to retrieve the data that you indexed.
Elasticsearch exposes RESTful APIs and it's JSON based, but if you are looking for annotations in the Compass style you can have a look at the Object Search Engine Mapper for ElasticSearch.
I would say give a try on lucene or solr. It creates a DocumentFileSystem for faster indexing
I would recommend either
Elasticsearch, if the system is big and need clustering.
Lucene or Solr, if you want to code at a low level
Hibernate search, if you are using Hibernate as your ORM.

XML processors for executing xqj in java

I need to query xml data using XQJ in my java application. I wanted to know the options that I have for xml/xquery processors.
I explored and got to know about:
oracle's xquery processor that is shipped with Oracle 11g
Saxon.
Any other suggestions?
You might want to try BaseX, which also offers a full implementation of XQJ:
http://basex.org/products/
http://docs.basex.org/index.php?title=Special%3ASearch&search=xqj
You will most probably get better results when using the native APIs, no matter which processor you are using (but of course there are reasons for using XQJ as well).
Hope this helps,
Hannes
You could certainly try MarkLogic, eXist, BaseX or Sedna XQJ drivers which are located at http://xqj.net
It would be daft to use vendor propriety APIs as you will be locked into a particular database vendor, with no improvement in performance.
Also you could try checking out the XQJ entry on Wikipedia for more clarity:
http://en.wikipedia.org/wiki/XQuery_API_for_Java
As well as having a processor you need an API. Charles Foster's XQJ.net might well help for
eXist, baseX, Sedna and Marklogic.
http://xqj.net/
zorba has an XQJ branch. Please, consult the zorba users mailing list for further information on this.

Is there a simple way to do Query By Example in iBATIS?

I had hoped this was baked into the most recent release, but if it is, I can't find the docs via a simple Google search. Failing that, I'd prefer a simple library, but I'll settle for a tutorial.
Thanks.
Ibator can help you with this. Let it autogenerate everything, and you'll find by-Example Queries in the SQL Maps, as well as corresponding Java bindings in the DAOs.
Check "Example Class Usage Notes" on http://ibatis.apache.org/docs/tools/ibator/ for more information.

Categories