query 1.1.2

Search query parser library #

The library helps to parse search queries (e.g. custom search boxes) and enables custom search index implementations.

Supported expressions:

  • (Implicit) boolean AND: a AND b or a b
  • boolean OR: a OR b OR c
  • boolean NOT: -a or NOT a
  • group query: (a b) OR (c d)
  • text match: abc or "words in close proximity"
  • range query: [1 TO 20] (inclusive), ]aaa TO dzz[ (exclusive), or [1 TO 20[ (mixed)
  • scopes: field:(a b) or field:abc
  • field comparison: year < 2000

Usage #

A simple usage example:

import 'package:query/query.dart';

main() {
  final q = parseQuery('some text OR field:another');
  // prints "(some (text OR field:another))"
  print(q);
}

1.1.2 #

  • More lints and checks in analysis_options.yaml.

1.1.1 #

  • Support for new petitparser API.

1.1.0 #

  • Support for non-ASCII characters in scope and words.

1.0.0 #

  • Initial version.

example/example.dart

import 'package:query/query.dart';

main() {
  final q = parseQuery('some text OR field:another');
  // prints "(some (text OR field:another))"
  print(q);
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  query: ^1.1.2

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:query/query.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
35
Health:
Code health derived from static analysis. [more]
96
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
66
Learn more about scoring.

We analyzed this package on Jul 15, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.4.0
  • pana: 0.12.19

Platforms

Detected platforms: Flutter, web, other

No platform restriction found in primary library package:query/query.dart.

Health suggestions

Fix lib/src/ast.dart. (-3.93 points)

Analysis of lib/src/ast.dart reported 8 hints, including:

line 11 col 30: Use = to separate a named parameter from its default value.

line 23 col 30: Use = to separate a named parameter from its default value.

line 35 col 30: Use = to separate a named parameter from its default value.

line 48 col 30: Use = to separate a named parameter from its default value.

line 62 col 30: Use = to separate a named parameter from its default value.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0
petitparser ^2.0.0 2.4.0
Transitive dependencies
meta 1.1.7
Dev dependencies
pedantic ^1.0.0
test ^1.0.0

Admin