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:
PINQ – querify your datasets – introduction
Aug 21, 2014 @ 14:20:19

The SitePoint PHP blog has posted the first part of a new series they're releasing about querying your data with Pinq. It's a PHP-based query tool that provides a fluent interface for searching and traversing your data. In this first post of the series Taylor Ren introduces you to the library and shows some basic usage.

You may have heard of LINQ (Language-Integrated Query), a “set of features introduced in Visual Studio 2008 that extends powerful query capabilities to the language syntax of C# and Visual Basic”. It provides necessary interfaces and syntax to perform various queries on a given dataset so that operations like filtering, sorting, grouping, aggregating, etc can be performed. PINQ (PHP Integrated Query) is “based off the .NET’s Linq, and unifies querying across arrays/iterators and external data sources, in a single readable and concise fluent API”.

He talks about normal searching (equals matching) and "faceted searching", narrowing down the results piece by piece until you find what you need. He gives an example with some sample database data and shows the results of a simple query with a price filter and grouped by author. He includes the code to make it happen (inside a simple Silex application) too. He then takes a deeper look at the LINQ queries and how related statements are handled.

tagged: linq pinq query dataset tutorial introduction series part1

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


Trending Topics: