What is predicate search?

I heard this in a conversation with a coffee table, and I could not understand what it was. A little search engine didn’t cause anything useful ...

Clarification: thanks, guys, for the initial takeover ... but it turned out that the conversation was about "searching" through databses / internet, etc ....

+4
source share
4 answers

In the distribution of widespread alternating databases, traditional search patterns using indexes, etc., are broken down everywhere. For these databases, a map reduction operation is often performed. The mapping is implicitly determined by the fragments and the predicate that you pass, which matches the records matching the predicate with everything that is needed as a result. At the reduction step, the necessary aggregations are performed, etc.

Perhaps this fits the context of the discussion on the coffee table?

+1
source

Usually a predicate is a function that takes one or more arguments and returns a boolean value indicating whether any statement about the arguments is true or false.

Examples of predicates in natural language can be “blue”, “longer than two meters”, “belongs to MC Hammer”, “is underground”.

When performing a search in any system - for example, in a file system, a database table, a graph - maybe the system itself provides certain built-in search queries (the file system may have a built-in search by file name; the chart may have a built-in search by distance from given node); or, for greater flexibility, there may be a search method by providing a custom predicate function.

Depending on the details, this custom predicate function can be passed as an expression tree or a pointer to some actual executable code or query expression that needs to be analyzed. All that is required is that the system has a way to call a predicate for each candidate element; and that the predicate returns true or false for each candidate element.

Search results are exactly those elements for which the user predicate returns true.

+9
source

If they talked about .NET, they referred to the Predicate type required by many collection extension methods.

This is a delegate that represents a method that defines a set of criteria and determines whether the specified object meets these criteria.

I'm not sure if other platforms use this terminology.

//selects items in list where the `ID` property matches `id` List.Select(x => x.ID == id); 
+1
source

I don’t know if the term as a whole has some special meaning, but in a broader sense, a “predicate” is a function that takes an object (that is, some kind of candidate object) as input and returns a logical indicating whether the predicate condition was satisfied.

Expanding from this, we can conclude that predicate search is a predicate search that can be called a filter. For example, you can build a search using ANDing for two simple predicates together, say IsUppercaseString and StringStartsWith("S") * to search for lowercase letters starting with S.

  • Please note that this is pseudo code and not any specific syntax, as I keep this agnostic language
+1
source

Source: https://habr.com/ru/post/1313386/


All Articles