Git Product home page Git Product logo

Comments (7)

boyter avatar boyter commented on August 24, 2024

Had a dig and found the following examples of searches which are hitting the api, but are probably not useful.

lang:ehcache
lang:battle field 3 multiplayer ps3
lang:pthread_mutex
lang:ehcache
lang:csv file
lang:att wireless coupon
lang:mediawiki inline
lang:chmod for read write execute
lang:ehcache.xml
lang:fire emblem 8 cheat
lang:xfetchname
lang:android doubletwist retail
lang:yacc source
lang:search for copy and paste
lang:pthread_mutex_t
lang:plantronics 360 bluetooth pairing

Some would produce useful results EG,

pthread_mutex_t

I have modified the searchcode end to ignore nonsensical language lookups EG

http://duckduckgo.com/?q=example+pthread_mutex
http://duckduckgo.com/?q=example+pthread_mutex_t
http://duckduckgo.com/?q=example+ehcache

now returns something which makes sense.

from zeroclickinfo-spice.

moollaza avatar moollaza commented on August 24, 2024

@boyter sorry for the delayed response and thanks for letting me know about this bug. I think the bigger problem is that the spice is triggering simply on "code" or "example" and following through with a result despite the absence of a "language" . I thought I had written the spice so that it would force the presence of one of your keywords - however it seems my code isn't doing that so I believe there is an error in my regex. I'll fix it up and we can go from there.

EDIT: Also I think I'll use the regex optimizer I previously used for the ExpandURL Spice to make the regex a little more efficient

from zeroclickinfo-spice.

boyter avatar boyter commented on August 24, 2024

No problem at all. I just fixed it on my end as much as possible so the results shouldn't be too bad now. The experience was really crappy before I made the modification as it was always showing a make file for all results before. Looks bad for DDG and for myself, so I fixed it, and made it more resilient anyway.

In some cases it actually works out better such as the examples above as they do give what I would expect.

from zeroclickinfo-spice.

moollaza avatar moollaza commented on August 24, 2024

@boyter I think i figured it out! small mistake...the list of words in the $words variable weren't surrounded by '\b' so it was picking up the "|c|" in any words that had just the letter c in them hence "example foreach" worked but "example testing" didn't trigger.

Now it will force your keywords to be present. Better?

from zeroclickinfo-spice.

boyter avatar boyter commented on August 24, 2024

@moollaza Yep, with the only exception being you are assuming that the language keyword is at the beginning of the query, which might not be the case. IE

example csv validator java TO lang:csv validator java

Would try to match on the language csv which does not exist. It's taken care of on the searchcode side though as I strip out the lang: portion where there is a language which matches nothing. I might modify it on that side anyway to search for keywords like java in the case of there being no lang syntax present and restrict it that way.

from zeroclickinfo-spice.

moollaza avatar moollaza commented on August 24, 2024

@boyter I had thought about that right after I made my earlier fix. I changed the regex to now strip the keyword, append "lang" to it, then append the rest of the search query. I pushed it to github, feel free to give it a look.

from zeroclickinfo-spice.

boyter avatar boyter commented on August 24, 2024

Looks good to me. I have been playing a bit and it certainly seems to pick things up much better now.

from zeroclickinfo-spice.

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.