Using Zend Lucene Search outside an Zend application - php

I know, there is an Lucene port in zend to get the lucene features in pure PHP.
Is there a way to use that search-code in an non-zend-application, like other PHP frameworks?
Walking through the web I found some very old howto's, but it was not able to apply those old howto to the current releases of zend framework or zend lucene search.

Related

What is Zend Expressive and Zend MVC?

I am starting a new project in PHP and wanted to choose the latest ZendFramework. I see that Zend Framework 3 has been released so I wanted to start with Zend Framework 3 itself. But when I go to the INSTALL page of Zend, they have given options as Zend MVC and Zend expressive.
I read about them and have an understanding that Expressive is a microframework while MVC is a full-stack framework. Apart from this I am not very clear about them.
I see that Zend MVC was also there for ZF2 and the documentation says MVC as a layer. I could not find Expressive for zf2 though.
Question:
Are both Zend MVC and Zend Expressive packages? and are part of zf3?
When I see the installed packages in Zend MVC and Zend Expressive, I don't see a package for Zend framework, but I see separate packages for Zend Components such as zend-http, zend-json, etc. So are these (expressive and MVC) just built over different Zend components?
How do I know that I am using ZF3?
Are both Zend MVC and Zend Expressive packages? and are part of zf3?
This depends a bit on your definition of "packages". Zend Expressive is not part of ZF3, it is a microframework alternative to ZF3. Zend MVC and Zend Expressive are both packages, and they also depend on other packages. ZF3 is what is known as a "meta package", which means it doesn't have any code of its own, it is soley a collection of other packages. The ZF3 meta package includes the Zend MVC package.
are these (expressive and MVC) just built over different Zend components?
Yes, and there is quite a bit of overlap.
How do I know that I am using ZF3?
This is more a question of semantics. If you have the Zend Framework meta package installed, that's ZF3. If you were just using the MVC package, you could argue that's still ZF3. If you are using Expressive, that's something else.
The line between ZF3 and Expressive (and when you would use one over the other) is somewhat fuzzy. This discussion may help you.
In an earlier edit you asked which you should use to create a REST API. You could do that with either.

Can Zend Framework run fully without Zend Server?

We are resurrecting some old code that used the Zend framework. The old code extends several Zend classes, invokes getOptions() and uses some other Zend functions. We tried installing Zend Framework with XAMPP (click here) without the Zend Server. We have loads of errors that prevent the legacy site from rendering properly.
Is Zend Server necessary to use all the methods, etc. of Zend Framework?
Yes, you can run Zend Framework without Zend Server (and I'd guess this is a much more common setup than using both together). The only thing I can think of in ZF that would require Zend Server would be the Zend Server Cache Backend.
It's more likely that your issue is down to a difference in configuration between your old server and new. If you can give examples of some of the errors you're getting we might be able to suggest where to look.

Interfacing PHP with Lucene without changing anything

I am building a search engine. In this regard, I have built a Lucene indexer in Java and also built a web interface in PHP where the user will submit the query. As my search is geo-temporal specific, so by PHP I have tracked the user's current time and location along with the query. Now my question is how will I pass those values from PHP to Lucene search module that is in Java.
In this context I have studied Zend. But it seems that in Zend I have to rewrite the searcher and indexer in Zend Lucene framework that is different from Java Lucene that I have used. I am asking is there any way that I can use to integrate my PHP web interface with Lucene without changing anything to underlying indexer and searcher that I have written in Java Lucene.
So in brief, I want to know how to pass those PHP variables to the underlying Lucene searcher in Java and display the output of the searcher back in PHP web interface. Thank you.
If I understand Zend Search, it is an implementation of Lucene for PHP (Lucene 2.3 in Zend 1 -- don't know which Lucene version for Zend 2). The API is not a straight port, but you can use Zend Search with vanilla Lucene indexes. Google for "Zend 2 search lucene compatibility".
The Zend_Search_Lucene and related classes that were in Zend Framework 1, which are a standalone Lucene implementation and don't depend on any other libraries, have been replaced with ZendSearch, now a git repository. However, the repository doesn't contain any documentation. I assume the Zend Framework 1 documentation for Zend_Search_Lucene applies equally to ZendSearch: http://framework.zend.com/manual/1.12/en/zend.search.lucene.index-creation.html. I don't know why ZendSearch is not part of Zend Framework 2.

Custom Search Engine on Zend Framework

We are building a Social Networking website and there are videos, user profiles and other details on the site. The site is developed using Zend Framework. It needs to develop a Site Search Engine feature on this site. It need to index all data in the website and search against that data.
I checked Sphider but it is not easy to use in Zend Framework. And I tried Sphinx but that needs lot of configuration from Terminal. Next I tried is Zend Lucene Component and it works. But I couldn't display the Videos or Profile Image on the result set.
Please suggest an easy but powerful method to build a Custom Search Engine inside website built on Zend Framework.
You should have a look at setting up a Solr search server. It is a Lucene implementation, but scales incredibly well. From my understanding Zend's Lucene implementation, while good for small amounts of data, does not scale well.
There is also a PECL Solr extension for easy access from PHP, regardless of framework.

Examples of building a REST API server using Zend Framework?

I'm new to Zend Framework (not to PHP), and I need to create a REST based API using Zend.
I've seen examples using Zend_Rest_Server, however other sources state that that has been deprecated.
I'm unable to find a solid example which shows how I should be building such an API.
Zend_Rest_Server is indeed deprecated since ZF 1.9, you should use Zend_Rest_Controller instead. The following blog posts could be helpful : Building RESTful Services with Zend Framework and Create RESTful Applications Using The Zend Framework.
May be this link would be helpful: Creating a PHP REST API Using the Zend Framework.
This code example support REST data in the format of XML and JSON.
Prerequisites:
PHP version > 5
Zend Framework 1.9.2 (at the minimum)
If you want something a little more in details, you can check the book
Zend Framework 2 Application Development.
The book explains construction of API oriented system in ZF2, through examples.
At the end of book you get:
ZF2 API
ZF2 Client side app.
The book has a lot of syntax errors as well as any book for programming,
but it's only one on the market at this moment.

Categories