Read Primitives — Boolean Text Search
Read Primitives benchmark · all Read Primitives queries
Boolean text search with AND/NOT operators
Representative SQL
Rendered in the benchmark’s native SQL with default parameters (no dialect translation available).
SELECT c_custkey, c_name, c_comment, MATCH(c_comment) AGAINST('+BUILDING -FURNITURE' IN BOOLEAN MODE) AS relevance_scoreFROM customerWHERE MATCH(c_comment) AGAINST('+BUILDING -FURNITURE' IN BOOLEAN MODE)ORDER BY relevance_score DESCLIMIT 50Representative DataFrame
Expression family (Polars, PySpark, DataFusion), default parameters.
def fulltext_boolean_search_expression_impl(ctx: DataFrameContext) -> Any: customer = ctx.get_table("customer") col = ctx.col
return ( customer.filter(col("c_comment").str.contains("BUILDING") & ~col("c_comment").str.contains("FURNITURE")) .with_columns(col("c_comment").str.contains("BUILDING").cast(int).alias("relevance_score")) .select("c_custkey", "c_name", "c_comment", "relevance_score") .sort("relevance_score", descending=True) .limit(50) )Get the exact query for your run
The blocks above are representative. To get the precise statement a specific platform runs at a specific scale, substitute your own values:
from benchbox import ReadPrimitives
bench = ReadPrimitives(scale_factor=0.01) # your scale factorqueries = bench.get_queries(dialect="datafusion") # your platform's dialect; drop dialect= for native SQLprint(queries['fulltext_boolean_search'])For the DataFrame form:
from benchbox.core.query_catalog import get_dataframe_render
print(get_dataframe_render('read_primitives', 'fulltext_boolean_search', family="expression").source) # or family="pandas"Source
Query text: benchbox/core/read_primitives/queries.py