|
From: Demian K. <dem...@vi...> - 2026-02-11 18:40:47
|
Ekaterina,
Yes, exactly -- I would suggest removing the static $table from normalizeSort() and instead adding a class property called something like $sortAliases. We could then add a [SortAliases] section to config.ini and use it to populate the table. Potentially it could look like this, if we wanted the .ini to map directly to the table:
[SortDefinitions]
year[field] = publishDateSort
year[order] = desc
publishDateSort[field] = publishDateSort
publishDateSort[order] = desc
... of we could aim for simpler, more readable configuration that gets mapped into the format by some code.
Feel free to take whatever approach is easiest for you to get the process started, and then we can refine as needed. If you need my help with anything, please let me know! 😊
thanks,
Demian
-----Original Message-----
From: Katja Zinchenko <Zin...@bs...>
Sent: Wednesday, February 11, 2026 7:49 AM
To: vuf...@li...; Demian Katz <dem...@vi...>
Subject: RE: Antw: RE: [EXTERNAL] [VuFind-Tech] User function as a sort parameter (searches.ini)
Demian,
if I understand correctly, we have two options:
- just make a local copy of Params.php
- or make $table extendable over some ini/yaml configuration For now I can just extend $table with our specific sort functions.
I would prefer to follow the second option if it could be useful for others.
Thanks for your feedback
Ekaterina
>>> Demian Katz <dem...@vi...> 11.02.2026 13:06 >>>
Ekaterina,
It sounds like adding a mechanism to allow sort options to be aliased to functions is probably the best way to go forward. Would you like to contribute your local solution as a pull request for consideration in a future release?
- Demian
-----Original Message-----
From: Katja Zinchenko <Zin...@bs...>
Sent: Wednesday, February 11, 2026 7:00 AM
To: vuf...@li...; Demian Katz <dem...@vi...>
Subject: Antw: RE: [EXTERNAL] [VuFind-Tech] User function as a sort parameter (searches.ini)
Dear Demian,
dear all,
Thanks a lot for a quick answer.
I can put a user function directly in Solr sort-param like
q=*:*&sort=max(1,product(termfreq('owner','DE-XXX'),20.0))
desc&useParams=
and it works fine.
But it is not possible to do it over searches.ini like
max(1,product(termfreq('owner','DE-XXX'),20.0)) desc = xxx
Yesterday i tried to create a field for the function result (alias
locXX) and use it for sorting, which will be fine for Vufind like [General] default_record_fields = "*,locXX:max(1,product(termfreq('owner','DE-XXX'),20.0))"
[Sorting]
locXX desc = xxx
But it was my mistake, because you cannot perform any sort operations over such kind of fields
It works if we exand $table in
./module/VuFind/src/VuFind/Search/Solr/Params.php with function alias like 'locXX' => ['field' => "max(1,product(termfreq('owner','DE-XXX'),20.0))", 'order' => 'desc'],
What do you mean about it?
Thank you!
Ekaterina
>>> Demian Katz <dem...@vi...> 10.02.2026 18:47 >>>
Ekaterina,
I don't think there's currently a mechanism to support this, but I am happy to work with you on brainstorming a solution. Before I do any research, though, I just want to clarify: Are you saying that you're not sure how to do this in VuFind OR Solr? If that's the case, I definitely think the starting point would be to figure out the best Solr practice for this type of sorting (which might involve talking to the Solr community, if nobody here has an immediate idea). Once we know how to construct the appropriate Solr request to get the desired outcome, then I'm sure we can come up with a mechanism to translate the appropriate VuFind sort option into the desired result (for example, a custom search listener might be the easiest way to do the job).
- Demian
-----Original Message-----
From: Katja Zinchenko <Zin...@bs...>
Sent: Tuesday, February 10, 2026 11:17 AM
To: vuf...@li...
Subject: [EXTERNAL] [VuFind-Tech] User function as a sort parameter
(searches.ini)
Dear all,
we would like to allow one or more different boost functions as a sort option. Is it out-of-the-box possible?
I couldn't write a function directly as a sort option like
max(1,product(termfreq('owner',XX'),20.0)) desc = xxx
it is also solr-side not possible to do it like &sort=locXX
desc&fl=*,locXX:max(1,product(termfreq('owner',XX'),20.0))
Does anybody have any ideas?
Thanks a Lot
Ekaterina
_______________________________________________
Vufind-tech mailing list
Vuf...@li...
https://lists.sourceforge.net/lists/listinfo/vufind-tech
|