Skip to content

[question] search filters #1

Open

Description

@MaKiPL

What filters can we use/are available?
I tried TAG1|TAG2 and it tried to find both, same as with space
However how do I make the search to filter only the packages that have in description BOTH of the tags?
Tried +, tried AND, tried &
Seems like there's no filtering included

Activity

  1. bitmeal commented on Apr 5, 2022

    @bitmeal
    Owner

    It is currently not possible, but would surely be advantageous.

    Current behavior is as follows:

    1. search term gets split on whitespaces
    2. all substrings are interpreted as a regular expression
    3. all regular expressions are used build the database query with $or operation
    4. the query is evaluated against a prebuild "full text search" string

    If you have any ideas for the implementation, especially regarding the user interface, you are welcome to give the implementation a shot or leave a comment. Searching the database for explicit fields is no problem in theory.

    if(search && search != null && search != '') {
    let query = {
    $or: search
    .toLowerCase()
    .split(/\s+/)
    .filter( token => token != '' )
    .map( token => token.trim() )
    .map((token) => {
    return {
    fts: (new RegExp(token))
    }
    })
    };
    // console.log(query);
    // this.db.find({ fts: (new RegExp(search)) }, (err, docs) => {
    this.db.find(query)
    .sort({ name: 1 })
    .exec((err, docs) => {
    this.loading = false;
    if(!err) {
    this.items = docs;
    }
    else {
    console.error(`error fetching packages for search term '${search}' from db!`);
    }
    }
    );
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions