Code Monkey home page Code Monkey logo

Comments (6)

aleksandra-kim avatar aleksandra-kim commented on September 26, 2024

Original comment by Chris Mutel (Bitbucket: cmutel, GitHub: cmutel).


CA-QC is a separate issue, as - is a special character in the search engine. Fixing this will be complicated, and is a bit too much off the path for Brightway2 development, at least for me. You can always do the following:

#!python

[x for x in Database("foo").search("bar", filter={'location': "ca"}) if x['location'] == 'QC-CA']

I will make a post to the Whoosh mailing list about the first case; note that the default analyzer is case-insensitive, but this is maybe applied inconsistently?

from brightway2-data.

aleksandra-kim avatar aleksandra-kim commented on September 26, 2024

Original comment by Chris Mutel (Bitbucket: cmutel, GitHub: cmutel).


Post to Whoosh list

from brightway2-data.

aleksandra-kim avatar aleksandra-kim commented on September 26, 2024

Original comment by Chris Mutel (Bitbucket: cmutel, GitHub: cmutel).


Reply from Matt Chaput (whoosh author):

When you use the query parser, it runs the analyzer on the text and builds the query objects from the output.
If you construct query objects directly, you are giving them the *exact* text to search for.

Our search filter uses a query object:

And([Term(k, v) for k, v in filter.items()])

However, it is not yet clear to me how to work with the Whoosh machinery to make this case-insensitive.

from brightway2-data.

aleksandra-kim avatar aleksandra-kim commented on September 26, 2024

Original comment by Bernhard Steubing (Bitbucket: bsteubing, GitHub: bsteubing).


also the "mask" option does only work with lowercase.
Knowing this limitation, couldn't you simply convert all user input to location, mask, etc. to lowercase? Just an idea.

from brightway2-data.

aleksandra-kim avatar aleksandra-kim commented on September 26, 2024

Original comment by Chris Mutel (Bitbucket: cmutel, GitHub: cmutel).


All search data stored as lowercase. Fixes #35. To get this beahviour in an existing database, use 'db.make_searchable(reset=True'

from brightway2-data.

aleksandra-kim avatar aleksandra-kim commented on September 26, 2024

Original comment by Chris Mutel (Bitbucket: cmutel, GitHub: cmutel).


Note that the fix doesn't help terms that have a dash, these have to be filtered outside the Whoosh search index.

from brightway2-data.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.