hunt-framework / hayoo

Hackage search engine
56 stars 9 forks source link

Signature search completion is broken #16

Closed sebastian-philipp closed 10 years ago

sebastian-philipp commented 10 years ago

broken-signature-search

UweSchmidt commented 10 years ago

Oops! Another problem with the query parser. The signatures can contain a lot of chars that are also used in the query syntax, e.g blanks, (, ),[,] and others. So the query string must be quoted as a single word to take the whole signature input as a search string. The double quotes can't be used, they are already in use for phrases. And phrases are internally split into words at whitespace boundaries. Quoting all the special signature chars with backslash is clumsy.

I've added quoting with single quotes for simple words, so a query signature:!(a-> b c)-> b a must be written as signature:!'(a-> b c)-> b a'. We have to do some kind of quoting here: the parentheses (,) and the whitespace must be quoted, else the above query becomes a sequence of AND queries.

By the way, would in be simpler to ask for completions separately for the both contexts or only for the normalized context and then show them in the drop down menu as normal signatures instead of an or query?

sebastian-philipp commented 10 years ago

I would expect to get a list of signatures, not a list of internal quries. I need to fix this

UweSchmidt commented 10 years ago

Is it already fixed? I can't reproduce this, when querying the hunt-server directly with something like

curl http://localhost:3000/completion/signature:'a->b'%20OR%20normalized:'a->b'/20

This gives me a useful result

{
    "code": 0,
    "msg": [
        [
            "a-\u003eb",
            32.8
        ],
        [
            "a-\u003eBool",
            5.6285777
        ],
        [
            "a-\u003eb-\u003eb",
            4.371431
        ],
        [
            "a-\u003eb c",
            3.7333328999999997
        ],
        [
            "a-\u003eb()",
            2.9999988
        ],
        [
            "a-\u003eb a",
            1.9333333000000001
        ],
        [
            "a-\u003eb-\u003ea",
            1.8571423999999999
        ],
        [
            "a-\u003eb-\u003ec",
            1.5714283
        ],
        [
            "a-\u003eb()a",
            0.25714287
        ]
    ]
}
sebastian-philipp commented 10 years ago

This needs to be fixed in the frontend