Sorting full-text results by custom rank

Hello, dear Virtuoso :star_struck:

We have full-text searching with sorting like this:

SELECT * WHERE {
  ?a rdfs:label ?b.
  ?b bif:contains '"Andrew*"'
  ?b crm2:pr ?pr
} ORDER BY ?pr

But it works slowly on several queries. We think, that the problem is in join with ?pr.
We tried to store ?pr value in the literals. And sort by:

SELECT *
WHERE
  {
    ?a rdfs:label ?b.
    ?b bif:contains '"Andres*"'
    BIND(SUBSTR(?o, 2, 4) as ?pr) # PR stores in the literal on position 2 to 4
  }
ORDER BY DESC (?pr)
LIMIT 10

It has no effect. Than we’ve saw, that bif:contains has word OPTION:

SELECT *
WHERE
  {
    ?s ?p ?o .
    ?o bif:contains '"Andrew*"'
    OPTION (score ?sc) .
  }
ORDER BY DESC (?sc)
LIMIT 10

It works MEGAFAST!

But we need to sort by another value :frowning:
Is there way to add our rank to index?
It could works with something like this query:

SELECT * WHERE {
  ?a rdfs:label ?b.
  ?b bif:contains '"Andrew*"'
  OPTION (pr ?pr) # this value stores in index?
} ORDER BY ?pr

Summary:
We want to implement full-text search based on rank.
Is it possible:

  1. place the rank in the index?
  2. add a column to store the rank.

How to organize it correctly?