patrickfrey / strusWebService

web service (HTTP/JSON) to use the strus API as a service
http://project-strus.net
Mozilla Public License 2.0
4 stars 0 forks source link

cannot query only with restriction features #55

Closed andreasbaumann closed 6 years ago

andreasbaumann commented 6 years ago

Example in the search interface "-xxx".

Results in:

cannot evaluate query, no selection features defined null

Current workaround is to search for a feature appearing in all documents (artificial feature EVERYWHERE) and then to negate: "EVERWHERE -xxx".

The query is:

    "query" :   {
        "exclude" : [
            "exclude1_2",
            "exclude1_3"
        ]
        ,
        "features" :    [
            {
                "name" :    "exclude1_2",
                "value" :   {
                    "term" :    {
                        "type" :    "unstemmed",
                        "value" :   "test"
                    }

                }
                ,
                "weight" :  2
            }
            ,
            {
                "name" :    "exclude1_3",
                "value" :   {
                    "term" :    {
                        "type" :    "stemmed",
                        "value" :   "test"
                    }

                }
                ,
                "weight" :  1
            }

        ]
        ,
        "first_rank" :  0,
        "metadata" :    [

        ]
        ,
        "nof_ranks" :   10,
        "restrict" :    [

        ]
        ,
        "select" :  [

        ]
        ,
        "summarizer" :  [
            {
                "attribute" :   "docid",
                "name" :    "attribute",
                "params" :  [
                    {
                        "key" : "name",
                        "value" :   "docid"
                    }

                ]

            }
            ,
            {
                "attribute" :   "title",
                "name" :    "attribute",
                "params" :  [
                    {
                        "key" : "name",
                        "value" :   "title"
                    }

                ]

            }
            ,
            {
                "attribute" :   "title-addition",
                "name" :    "attribute",
                "params" :  [
                    {
                        "key" : "name",
                        "value" :   "title-addition"
                    }

                ]

            }
            ,
            {
                "attribute" :   "abstract",
                "name" :    "attribute",
                "params" :  [
                    {
                        "key" : "name",
                        "value" :   "abstract"
                    }

                ]

            }
            ,
            {
                "attribute" :   "documents",
                "name" :    "attribute",
                "params" :  [
                    {
                        "key" : "name",
                        "value" :   "documents"
                    }

                ]

            }
            ,
            {
                "attribute" :   "year",
                "name" :    "attribute",
                "params" :  [
                    {
                        "key" : "name",
                        "value" :   "year"
                    }

                ]

            }
            ,
            {
                "attribute" :   "rrb-number",
                "name" :    "attribute",
                "params" :  [
                    {
                        "key" : "name",
                        "value" :   "rrb-number"
                    }

                ]

            }
            ,
            {
                "attribute" :   "lead",
                "name" :    "attribute",
                "params" :  [
                    {
                        "key" : "name",
                        "value" :   "lead"
                    }

                ]

            }
            ,
            {
                "attribute" :   "coapplicants",
                "name" :    "attribute",
                "params" :  [
                    {
                        "key" : "name",
                        "value" :   "coapplicants"
                    }

                ]

            }
            ,
            {
                "attribute" :   "session-start",
                "name" :    "attribute",
                "params" :  [
                    {
                        "key" : "name",
                        "value" :   "session-start"
                    }

                ]

            }
            ,
            {
                "attribute" :   "session-end",
                "name" :    "attribute",
                "params" :  [
                    {
                        "key" : "name",
                        "value" :   "session-end"
                    }

                ]

            }
            ,
            {
                "attribute" :   "pub-start",
                "name" :    "attribute",
                "params" :  [
                    {
                        "key" : "name",
                        "value" :   "pub-start"
                    }

                ]

            }
            ,
            {
                "attribute" :   "pub-end",
                "name" :    "attribute",
                "params" :  [
                    {
                        "key" : "name",
                        "value" :   "pub-end"
                    }

                ]

            }
            ,
            {
                "attribute" :   "notes-uid",
                "name" :    "attribute",
                "params" :  [
                    {
                        "key" : "name",
                        "value" :   "notes-uid"
                    }

                ]

            }
            ,
            {
                "attribute" :   "doclen",
                "name" :    "metadata",
                "params" :  [
                    {
                        "key" : "name",
                        "value" :   "doclen"
                    }

                ]

            }
            ,
            {
                "attribute" :   "snippet",
                "name" :    "test",
                "params" :  [
                    {
                        "key" : "type",
                        "value" :   "text"
                    }
                    ,
                    {
                        "key" : "type",
                        "value" :   "title"
                    }
                    ,
                    {
                        "key" : "sentence",
                        "value" :   "sentence"
                    }
                    ,
                    {
                        "key" : "nof_sentences",
                        "value" :   3
                    }
                    ,
                    {
                        "key" : "match",
                        "value" :   "highlight_feat"
                    }
                    ,
                    {
                        "key" : "N",
                        "value" :   70
                    }
                    ,
                    {
                        "key" : "add_dots",
                        "value" :   1
                    }
                    ,
                    {
                        "key" : "mark",
                        "value" :   "<span class=\"highlight\">%1%</span>"
                    }

                ]

            }

        ]
        ,
        "weighting" :   [
            {
                "name" :    "bm25",
                "params" :  [
                    {
                        "key" : "b",
                        "value" :   0.75
                    }
                    ,
                    {
                        "key" : "k1",
                        "value" :   1
                    }
                    ,
                    {
                        "key" : "avgdoclen",
                        "value" :   9808
                    }
                    ,
                    {
                        "key" : "metadata_doclen",
                        "value" :   "doclen"
                    }
                    ,
                    {
                        "key" : "match",
                        "value" :   "feat"
                    }

                ]

            }

        ]

    }
patrickfrey commented 6 years ago

Query only with restriction features is not supported. There is support for browsing on documents in the core and therefore a possibility to implement a query evaluation function that does the job.