Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

SitePoint PHP Blog:
PINQ – Querify Your Datasets – Faceted Search
Aug 26, 2014 @ 15:58:22

The SitePoint PHP blog has continued their series showing the use of the PINQ library for PHP (a PHP implementation of the LINQ tool). In part one they introduced the tool and showed how to it could be used to query and sort data. In this second part they move on and show how to perform a multi-faceted search on data from a MySQL database.

We are not going to cover the full aspect of faceted search in this series. Interested parties can refer to relevant articles published on Sitepoint and other Internet publications. [...] Unfortunately, faceted search is not a built-in feature provided by MySQL yet. What can we do if we are using MySQL but also want to provide our users with such a feature? With PINQ, we’ll see there is an equally powerful and straightforward approach to achieving this as when we are using other DB engines – at least in a way.

Building from the code from the first part of the series, they create a few more simple routes that let you define the different facets to use for the searching/sorting. He creates a custom facet class that uses the "traversable" handling of the PINQ to do the data manipulation. He creates a few different facet objects, each creating a customized filter. finally, he ties it all back into the endpoint and includes the updated markup to show the results. He finishes up the post mentioning a few limitations and improvements that could be made on the example as well.

tagged: pinq query dataset mysql faceted search tutorial series part2

Link: http://www.sitepoint.com/pinq-querify-datasets-faceted-search/

SitePoint PHP Blog:
Using Solarium with SOLR for Search – Implementation
May 07, 2014 @ 15:54:10

The SitePoint PHP blog has posted the third part of their series looking at using the Solarium tool to hook your PHP application into a SOLR search instance. In this latest part of the series they get down to the actual search implementation.

In the first part I introduced the key concepts and we installed and set up SOLR. In part two we installed and configured Solarium, a library which enables us to use PHP to “talk” to SOLR as if it were a native component. Now we’re finally ready to start building the search mechanism, which is the subject of this installment.

He starts with a simple search example, making a request to select the matches for a given query (given on the URL as a variable "q"). He shows how to run the select and fetch the results as a result set. He enhances this, containing the search logic inside a class and making a template to show the results. He also includes examples of how to use the "Disjunction Max", sorting and pagination functionality. Finally, he looks at a more complex type of search, a faceted search, and includes code examples of making the request and displaying the results.

tagged: solr solarium search engine tutorial implement basics faceted

Link: http://www.sitepoint.com/using-solarium-solr-search-implementation/


Trending Topics: