Giter Club home page Giter Club logo

Comments (5)

oetiker avatar oetiker commented on August 12, 2024 2

How about behaving somewhat like google does ?

from gollum-lib.

dometto avatar dometto commented on August 12, 2024

The reason is just complexity: since we don't want the user to have to write "foo|bar" for a disjunctive search term, we can't just treat the user-inputted search string as a regex. If we want to allow more advanced searches, we would therefore have to perform more varied transformations from the user-inputted string to a valid regex. There may be libraries that do this, i.e. construct regexes out of intuitively formatted user-inputted search strings: if anyone knows any and wants to try to hook it into gollum-lib in the method @sirtoobii refers to, we'd be happy to help out with a PR for that!

An easier way of adding some advanced search functionality might be to have a "Regular expression" checkbox under/next to the search bar, and treat the user-inputted search string as a regex if and only if that's set to true. Again, happy to accept and help out with a PR for this!

from gollum-lib.

oetiker avatar oetiker commented on August 12, 2024

If I am searching a needle in a haystack, it does not help me to get more hay in response to me providing more detailed search information.

If I enter red fish I would expect to get documents with the words red and fish in them. Instead I get documents with either ... is there use case for that ?

Would you be interessted in getting a patch to have this fixed?

from gollum-lib.

dometto avatar dometto commented on August 12, 2024

@oetiker as it stands, you can search for "red fish" and get lines that match both or red fish and get lines that match either. I believe this is fairly standard search practice, though it would certainly be nice to have a little help function for the search bar that makes this explicit.

I took it @sirtoobii was about the possibility of more advanced pattern matching, which would require implementing one of the two solutions I indicated.

from gollum-lib.

dometto avatar dometto commented on August 12, 2024

Just realized I maybe got @oetiker wrong and the suggestion is to return only pages (not lines) that contain both red and fish. This would certainly be a nice feature, but I would hesitate to say that it makes sense as a default: if I search for two IP addresses, say, I might still be interested in pages that contain only one of the two. Or I might expect to be given pages that include lines that match both expressions.

We're certainly interested in PRs that improve the existing search functionality, but at least these three questions need to be take into consideration:

  1. Should the user-supplied string by default be taken as intending to be matched on a page or line (current behavior) level?
  2. Should A B by default be taken as a disjunction or as a conjunction?
  3. What ways should the user be given to override these defaults, and/or to supply regular expressions themselves?

from gollum-lib.

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.