barzerman / barzer

barzer engine code
MIT License
2 stars 0 forks source link

getting odd features #607

Closed bodritto closed 11 years ago

bodritto commented 11 years ago

queries like: http://eu.barzer.net/query/json? key=aRLsIvszISAReCoS6ktgviZxN0YlRpbs6DKH7vro& route=doc.features& zurch=0& query=2.DOC_NUM

all docuemtns having doc_id=2.xx probably got all features in index

query exz: http://eu.barzer.net/query/json?key=aRLsIvszISAReCoS6ktgviZxN0YlRpbs6DKH7vro&route=doc.features&zurch=0&query=2.1

0xd34df00d commented 11 years ago

Technically speaking, that's by design. Uniqueness is not limited anyhow, and since all features get into the index, you actually get all the features. We need to have a way to pass uniqueness/gramsize filter to the getter.

0xd34df00d commented 11 years ago

q parameter should be used instead of query

bodritto commented 11 years ago

actually not:

http://eu.barzer.net/query/json?key=aRLsIvszISAReCoS6ktgviZxN0YlRpbs6DKH7vro&route=doc.features&zurch=0&q=2.1

0xd34df00d commented 11 years ago

Because /zurch path should be used :)

http://localhost:8080/zurch?u=1000200&route=doc.features&q=2.1 worksforme, so do http://localhost:8080/zurch?u=1000200&route=doc.features&q=2.1&uniq=2 or http://localhost:8080/zurch?u=1000200&route=doc.features&q=2.1&uniq=2&mingramsize=2&maxgramsize=3

For some reason the corresponding queries on eu.barzer.net (like http://eu.barzer.net/zurch?key=aRLsIvszISAReCoS6ktgviZxN0YlRpbs6DKH7vro&route=doc.features&zurch=0&q=2.1 ) are rendered with the 502 error. @pltr , could you please take a look?

pltr commented 11 years ago

/zurch on eu. only works for debugging and only when you start barzer as http there manually (it isn't started by default). and of course key parameter will do nothing for zurc anyway, it's a proxy parameter

0xd34df00d commented 11 years ago

Thanks, that was already clarified with Igor this day.

0xd34df00d commented 11 years ago

Checked with query tag/stuff, seems to return only required features as well:

cmd>sr u="1000200" route="doc.features" uniq="2" maxgramsize="1" mingramsize="1" zurch="0"
2.1
QUERY:<query u="1000200" route="doc.features" uniq="2" maxgramsize="1" mingramsize="1" zurch="0">2.1</query>
{
"ents" : [
],
"entless" : [
    {
        "size": 1,
        "uniq": 2,
        "grams": [ {"text": "указан" } ]
        ,"poslist": [ { "pos": 7, "len": 12 } ]
    }
,    {
        "size": 1,
        "uniq": 2,
        "grams": [ {"text": "верн" } ]
        ,"poslist": [ { "pos": 18, "len": 14 } ]
    }
,    {
        "size": 1,
        "uniq": 2,
        "grams": [ {"text": "был" } ]
        ,"poslist": [ { "pos": 0, "len": 6 } ]
    }
]
}

All other docs I've (randomly) checked return similarly unique features.

bodritto commented 11 years ago

so now if doc_id in query is empty or non-existing, all features in index returned

i think it would be better if this like queries have empty feature list, and all features if needed should be returned by special flag or pseudo doc id, smth like "_all"

@barzerman what do u think?

0xd34df00d commented 11 years ago

Now an error is returned if document ID is unknown:

QUERY:<query u="1000200" ret="json" route="doc.features" zurch="0">231321</query>
{ "error": "unknown document ID is passed", "id": "231321" }

I've also added validation for input parameters to avoid confusion like this:

QUERY:<query u="1000200" ret="json" route="doc.features" zurch="0" maxgramsize="shitfuck">2.1</query>
{ "error": "invalid options passed" }

We could also later add some kind of error codes to simplify client-side error handling.

The shit is in master. I think the issue can be closed. Reopen if you feel like.

0xd34df00d commented 11 years ago

And, well, fetching all features for all docs is done by an empty query or a query consisting of a single space sign.