Coder Social home page Coder Social logo

Comments (26)

rnewson avatar rnewson commented on May 24, 2024 1

thank you for the detailed report, I will look into it.

My first thought is that the query parser is transforming your "Administrator" to "administrator", but as it was indexed as "string" and not "text" it is held as "Administrator" in the index itself, and thus doesn't match.

assuming that's it then I agree that the query parser should not do this for string fields and I will make a fix.

from couchdb.

rnewson avatar rnewson commented on May 24, 2024 1

Yes, I mean in the index it is "Administrator" but you are not able query with the "A" as the query parser converts with the standard analyzer. you might say 'q=foo:Administrator' but the query parser is making it a term query on "administrator".

from couchdb.

rnewson avatar rnewson commented on May 24, 2024 1

"text" type means the value is analyzed. the Lucene analyzers typically force to lower case among other effects, which explains the new success.

from couchdb.

rnewson avatar rnewson commented on May 24, 2024 1

I still intend to make an enhancement. Assuming I'm right in my first comment you did nothing wrong, and I would like nouveau to do the right thing.

We know that "string" fields will not be analyzed, we need to tell the query parser to also not analyze the query string for "string" fields (and nouveau knows the index definition, so it does know which fields are "string" or "text", etc).

from couchdb.

GMishx avatar GMishx commented on May 24, 2024

But I tried to query with "admin", "administrator" and "Administrator" without any luck. Same holds for other values like "User". Thus I am suspecting something is wrong with the analyzed value from index or query not giving out the same result. Email being a special case where analyzer does not change the value, it matches.

from couchdb.

rnewson avatar rnewson commented on May 24, 2024

e.g, if you specified the "keyword" analyzer for the lastName field, the query parser won't lowercase it for you and it should then match.

from couchdb.

rnewson avatar rnewson commented on May 24, 2024

https://lucene.apache.org/core/9_10_0/core/org/apache/lucene/document/StringField.html vs https://lucene.apache.org/core/9_10_0/core/org/apache/lucene/document/TextField.html btw

from couchdb.

GMishx avatar GMishx commented on May 24, 2024

Yes, I mean in the index it is "Administrator" but you are not able query with the "A" as the query parser converts with the standard analyzer. you might say 'q=foo:Administrator' but the query parser is making it a term query on "administrator".

Can confirm that's the case. I modified the doc to give the "lastname": "administrator", then the query q=lastname:admin* gave back the expected result.

from couchdb.

GMishx avatar GMishx commented on May 24, 2024

https://lucene.apache.org/core/9_10_0/core/org/apache/lucene/document/StringField.html vs https://lucene.apache.org/core/9_10_0/core/org/apache/lucene/document/TextField.html btw

I also modified the index to be of type text rather than string as: index("text", "lastname", doc.lastname, {"store": true}); and query started working even for uppercase "Admin1".

If that's expected behavior, I can update the index creation doc.

from couchdb.

GMishx avatar GMishx commented on May 24, 2024

Yeah, I got to understand that from the (archived) couchdb-lucene project

@rnewson , you'd still like to work on this (I can also try to check the issue) with the lower-casing of string query.
Or should I close the issue as I was using wrong field type?

from couchdb.

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.