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

multiple summarizers with same name #62

Open andreasbaumann opened 6 years ago

andreasbaumann commented 6 years ago

Using two summarizers with different settings (aka the feature type to summarize) results attributes in the ranklist with identical naming: in our case forward.

{"key":"forward","value":"Title"},{"key":"forward","value":"word"}

I have no way to distinguish them or name them...

andreasbaumann commented 6 years ago

There exists a method SummarizerFunctionInstance::defineResultName to rename a result. It should be implemented for all standard summarizers.

andreasbaumann commented 6 years ago
virtual void strus::SummarizerFunctionInstanceInterface::defineResultName
(const std::string &resultname,
const std::string &itemname 
)   

I know the resultsname, where do I get the itemname from?

In this case this would be forward. I could pass it from above as additional parameter to the summarizer function, but for this I have to be able to introspect it.

I would expect to get the name of all possible iterators I can rename via the FunctionDescription...

andreasbaumann commented 6 years ago

I also have to implement the virtual function in my own summarizer, forgot it and I'm returning forward hard-coded...

andreasbaumann commented 6 years ago

I'm absolutely unhappy with the current solution: attribute serves no purpose at all and the resultnames just looks weird:

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

                ]
                ,
                "resultnames" : [
                    {
                        "key" : "resultname",
                        "value" :   "title_attribute"
                    }

                ]

            }

It does the job though and gives back summarizer results in the form:

                    ,
                    {
                        "key" : "title_attribute",
                        "value" :   "A NAS tale"
                    }