Faceted search with PHP and Lucene - php

Is there any way to create a faceted search using Zend Lucene?
I'm limited to shared hosting, and I don't have any option to use Solr.

I doubt this is supported in the current version of ZF1-Lucene, you should probably use the standalone SOLR on your server and write your own wrappers on top of SOLR for your use. Before writing your own please visit below links to get some insights on an existing libraries available for PHP/Zend on top of SOLR.
https://stackoverflow.com/q/19751146/765854
https://github.com/bluedaniel/Zend-Service-Solr

Related

Implementing a search feature for multiple websites, is Apache Solr a good choice?

I am currently managing a website where those without any web experience can create their own basic multipage website. The site also offers additional 'widgets' that can be placed onto a site to provide interactive features such as comments etc.
We are looking into adding a search widget where the customer can place a search onto their website and it will search all content within their own website including the other 'widgets' that have been used (The individual page content is basic html and the widgets data for all users is stored in a single database).
For this we have looked into a number of options on how to do the indexing and searching and have came down to the following options: PHP Zend Lucene or Apache Solr.
We feel Zend Lucene will not be able to achieve what we need, mostly because some of these websites are hosted remotely but use widgets loaded through the main website. Also if we used a single index this could potentially have over 300,000 documents indexed and as I hear Zend Lucene is not good for performance.
Apache Solr seems like the preferred choice. However I have some questions regarding the setup of this and 'multiple' sites.
Would it be better to have just a single index and have some unique identifier for each document indexed by a site, then when searching we can use this identifier to restrict to documents from that site.
Or would it be better to have multiple indexes?
Or is there a better option that we have overlooked?
I am still open to suggestions at this point of how we can implement this if you think you know of a better approach.
Regarding performance, Solr has many of Lucene caching and other optimized parameters. Most people think Zend Lucene is slower than Java Lucene, so your choice might be to use SOLR, but this really depends on the specific application and server resources.
Check this good previous post : Zend_Search_Lucene vs SOLR
You might want to look at Apache Nutch, which provides web crawling on top of Lucene's search engine.

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.

Ok, last question regarding search engine on my website

I have read the intro to the zend manual, and as far as I understand I have to install the framework on my server... And my webhosting provider says they don't support that, so it's not possible...
It must be installed in order for me to use it and implement a search function of my mysql records, right?
Thanks
The Zend Framework itself does not require any specific server side extensions or additional binaries other than PHP 5. You don't need your provider to install it, you should not have any problems just uploading the thing - or even just the Lucene related parts of it - and getting started. The ZF can be used in other PHP applications without it "taking over".
Zend Framework Requirements
Zend Framework installation
No, you can simply use the MySQL LIKE operator to perform a basic search (e.g. title contains "stackoverflow", etc...), or more preferably use the MyISAM storage engine that has fulltext search capabilities.
See the manual for more information about fulltext index and searches : http://dev.mysql.com/doc/refman/5.0/en/fulltext-search.html
But AFAIK, nothing prevents you from uploading the Zend Framework yourself, and use it as usual. The only thing is that you may not be able to write files out of your apache directory (which is required for a standard zend framework folder structure), so check this article on how to set ZF up on a shared hosting.
Yes but you dont need to install the entire framework, just the tedpendencies of Zend_Search_Lucene. But all you have to do to install is upload the files and make some include path adjustments, then require the nessecary files.

Building search to the website

I have a website which has about 200 to 300 static public pages. I am required to bring about some kind of search functionality on the website which will search all of its public pages. I don't want to use external tools like Google site search, etc. Is there a tool or open source code that will index the content and then display the search results? I am looking for a tool that will maintain its own index and run on the server along with the website. If I can add items to the index and manage it that would be a plus. I have looked at Zend Search Lucene, if there is a tool out there, I am hoping to use it before I make one myself.
Zend_Search_Lucene is a very good choice. It is compatible with the Java version of Lucene (I mean the index files). It can index html documents, it's quite simple to use and configure and has a good documentation.
Using Solr as a service is an option as well.
Sphinx is another tool you might want to look at.
You can try -
Sphider is a lightweight web spider and search engine written in PHP, using MySQL as its back end database. It is a great tool for adding search functionality to your web site or building your custom search engine. Sphider is small, easy to set up and modify, and is used in thousands of websites across the world.
http://www.sphider.eu/

Categories