[
https://issues.apache.org/jira/browse/JENA-916?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14558257#comment-14558257
]
ASF GitHub Bot commented on JENA-916:
-------------------------------------
GitHub user osma opened a pull request:
https://github.com/apache/jena/pull/72
Add (?uri ?score) to jena-text
This is an implementation of
[JENA-916](https://issues.apache.org/jira/browse/JENA-916), adding support for
using a 2-element list as the subject of a text:query triple pattern to capture
the raw Lucene/Solr score of the result, i.e. (?s ?score) text:query "word" .
Some notes:
1. This changes the return type of search-related methods in TextIndex and
DatasetGraphText to List<TextHit>, when it used to be List<Node>. (The new
class TextHit encapsulates both the Node and the score.) I've changed all the
related code and tests to cope with this, but there may be external code that
relies on the old return type. Is this a problem? Do we need to leave the old
method signatures for compatibility (possibly @Deprecated) and introduce new
score-aware methods?
2. I tried to adjust the Solr side as well but I'm not sure that the
jena-text Solr backend even works at the moment (even the unit tests are
disabled). I couldn't get the current code (prior to this patch) to work with
Solr - the problem is the lack of a unique identifier field that Solr seems to
require. But I'm not a Solr expert and perhaps it can be configured to work
with jena-text. As it is, I cannot test that the score capturing actually works
with Solr.
3. I took some inspiration from LARQ and jena-csv. I can't say I have a
deep understanding of QueryIterators, Bindings and BindingMaps though and I
hope I didn't end up cargo-culting any bad practices from older code...
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/osma/jena jena-text-score
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/jena/pull/72.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #72
----
commit 4c99ec53510fc9bdda1f66a42636b3185e071e98
Author: Osma Suominen <[email protected]>
Date: 2015-05-25T12:54:56Z
First implementation of JENA-916: Add (?uri ?score) to text query.
commit 3f0c5173eb59b37011d985e491a73cdd2dc93b31
Author: Osma Suominen <[email protected]>
Date: 2015-05-25T12:57:38Z
Merge remote-tracking branch 'upstream/master'
----
> Add (?uri ?score) to text query.
> --------------------------------
>
> Key: JENA-916
> URL: https://issues.apache.org/jira/browse/JENA-916
> Project: Apache Jena
> Issue Type: Improvement
> Components: Text
> Reporter: Andy Seaborne
>
> Add returning the score for a text match hit:
> {noformat}
> (?uri ?score) :queryPF ...
> {noformat}
> See the code marked {{//** score}} in TextQueryPF, TextIndexLucene and
> TextIndexSolr
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)